FastLED and building locally

Hey there!

I have already posted this in the Update on Library support (eg FastLED) as it seemed appropriate, but haven’t got any response yet, so sorry for the re-post!

I have been waiting to play with FastLED and the spark core for a long time now, and i am really happy to see that the library has been ported!! So now i’m trying to build locally with NetBeans, but i keep running in to some obstacles and now i need some help moving forward.
I have just installed NetBeans again following Elco ans seulater’s tutorials (THIS) except i’m not using ST-Link to flash, and i am using the feature/HAL branch.

First of all “all warnings being treated as errors” is set, but not form the makefile. I have been looking to see if the “CFLAGS -Wno-error” is being set elsewhere but haven’t accomplished to do so. So i tried to set “-Wno-error” in the makefile, but it does not have any affect… Any idea why i am getting all warnings as errors, can it have anything to do with the Spark-CLI?

The reason i am getting an warning in the first place, is the way that FastLED is showing its version number in a warning, so I tried to just out comment that warning out in the code (the easy-fix… apparently!) but now I am getting new errors…

 Building firmware for Spark core, platform ID: 0
   text	   data	    bss	    dec	    hex	filename
  12936	    632	   3564	  17132	   42ec	../build/target/bootloader/platform-0/bootloader.elf
../build/target/main/platform-0/src/application.o: In function `addLeds<(NSFastLED::ESPIChipsets)0u, 1u, 0u, (NSFastLED::EOrder)66u>':
C:\Repos\spark-firmware\main/./libraries/FastLED/firmware/FastLED.h:191: undefined reference to `NSFastLED::CLEDController::m_pHead'
C:\Repos\spark-firmware\main/./libraries/FastLED/firmware/FastLED.h:191: undefined reference to `NSFastLED::CLEDController::m_pTail'
C:\Repos\spark-firmware\main/./libraries/FastLED/firmware/FastLED.h:191: undefined reference to `NSFastLED::CFastLED::addLeds(NSFastLED::CLEDController*, NSFastLED::CRGB*, int, int)'
../build/target/main/platform-0/src/application.o: In function `NSFastLED::CFastLED::showColor(NSFastLED::CRGB const&)':
C:\Repos\spark-firmware\main/./libraries/FastLED/firmware/FastLED.h:399: undefined reference to `NSFastLED::CFastLED::showColor(NSFastLED::CRGB const&, unsigned char)'
../build/target/main/platform-0/src/application.o: In function `loop':
C:\Repos\spark-firmware\main/src/application.cpp:25: undefined reference to `NSFastLED::FastLED'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [../build/target/main/platform-0/main.elf] Fejl 1
make: *** [main] Fejl 2

BUILD FAILED (exit value 2, total time: 7s)

I have placed the library in the library folder and included it like this “libraries/FastLED/firmware/FastLED.h”

Here is my simple code


#include "application.h"

#include "libraries/FastLED/firmware/FastLED.h"


#define NUM_LEDS 160

#define DATA_PIN D1
#define CLOCK_PIN D0


void setup() { 
    FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, GRB>(leds, NUM_LEDS);

void loop() { 

Why am i getting those errors, have i implemented the library in a wrong way? Should i add anything to the makefile?

Also I wondered what is the best way to handle different libraries and multiply projects(application.cpp’s and other files) in NetBeans? Should i follow the uber library guide and just add them into the libraries folder and how can i choose witch project should get compile, in best meaner? I have looked around to see i someone have done something similar, but haven’t got a real breakthrough yet.

Thanks! :smiley:

@simoher, I will give the library a shot tonight. I am not using Netbeans but I am setting up an Eclipse debug environment (Windows). In the meantime, I simply compile via a command line. :smile:

Cool! I don’t have an ST-LINK/2v at the moment and i think i will be wasting my time trying to set up Eclipse, without a tutorial showing me how to do that, without the ST-LINK/2v…

I have put this in the makefile to make sure FastLED.h is included in the project.


# Include FastLED library code
CPPSRC += $(call target_files,$(MODULE_PATH)/libraries/FastLED,*.cpp)
CSRC += $(call target_files,$(MODULE_PATH)/libraries/FastLED,*.c)

But now Netbeans is telling med that there is a problem with the millis() function…

Building firmware for Spark core, platform ID: 0
   text	   data	    bss	    dec	    hex	filename
  12936	    632	   3564	  17132	   42ec	../build/target/bootloader/platform-0/bootloader.elf
src/application.cpp: In function 'void loop()':
src/application.cpp:25:12: error: call of overloaded 'millis()' is ambiguous
src/application.cpp:25:12: note: candidates are:
In file included from ./inc/application.h:29:0,
                 from src/application.cpp:5:
../wiring/inc/spark_wiring.h:68:15: note: system_tick_t millis()
 system_tick_t millis(void);
In file included from ./libraries/FastLED/pixeltypes.h:5:0,
                 from ./libraries/FastLED/controller.h:5,
                 from ./libraries/FastLED/FastLED.h:37,
                 from src/application.cpp:8:
./libraries/FastLED/lib8tion.h:1871:10: note: uint32_t NSFastLED::millis()
 uint32_t millis();
make[1]: *** [../build/target/main/platform-0/src/application.o] Fejl 1
make: *** [main] Fejl 2

I have also tried to compile with Spark-CLI but it is still telling me:

application.cpp:8:21: fatal error: FastLED.h: No such file or directory  #include <FastLED.h>


application.cpp:7:39: fatal error: libraries/FastLED/FastLED.h: No such file or directory
#include "libraries/FastLED/FastLED.h"

weather i am trying to include it directly.

Maybe is should say that i am using the HAL/feature branch, i will try using the master branch to see if that makes the difference.

I have also tried using the master branch now, but i get the same errors. When compiling with Spark-CLI it can’t see the library, and i’m still getting the other errors in Netbeans (it can see the library)… mmmh :sweat:

@simoher, which .mk file did you put those additions in? I can compile just fine with Spark DEV and everything in a single directory, keeping the “platforms” directory. I used Blink.ino and removed the “FastLED/” reference in the #include. But not so much luck on the feature/HAL branch. Perhaps I’ll try the master branch next.

@simoher, I got it to compile on the master branch. The makefile uses .mk files in the src directory for each library. Once I set that up correctly, all the modules compiled and linked. Now I need to figure out the HAL makefile setup for the libraries. :smile:

UPDATE: Got it to compile on HAL as well :stuck_out_tongue:

Just remembered that I have an 8 neopixel strip so I will test the library tonight if I can. :smile:

1 Like

Wee, im excited to hear that you got it compiling and that it was just it! I will try look in to it tomorrow!

1 Like

@simoher, tested with 8-neopixel strip and it looks good. I think the library still needs some fine tuning but it is coming along well. :smile:

Nice, i have some LPD8806 strips so the timing is not that strict. How have you added the library in the makefile, the same way i am trying to do it, am i close or am i doing it completely wrong?

@peekay123, i have tried to add the includes, edited to referee to the right folders ofc., to almost every “makefile” and .mk file i found, but spark-CLI simply wont see it, so i must be doing something completely wrong :grin:
Netbeans is clearly seeing the files when i add them in the any of the makefiles, but keep spitting out errors with the millis() function like this:

    Building target: core-firmware.elf
Invoking: ARM GCC C++ Linker
mkdir -p ./
arm-none-eabi-g++ -g3 -gdwarf-2 -Os ..............................
./obj/src/FastLED/FastLED.o: In function `NSFastLED::CFastLED::countFPS(int)':
C:\Repos\core-firmware\build/../src/FastLED/FastLED.cpp:194: undefined reference to `NSFastLED::millis()'
C:\Repos\core-firmware\build/../src/FastLED/FastLED.cpp:198: undefined reference to `NSFastLED::millis()'
collect2.exe: error: ld returned 1 exit status
make: *** [core-firmware.elf] Fejl 1

It starts to annoy me a little, i must be close :smile:

@simoher, for the HAL branch, I created an fastledtest directory under main/applications. I then copied ALL the .cpp and .h files but kept the platforms directory as-is (also included in the directory). I then run make (via a git shell) from the main directory and BOOM it works! No modifications to any make files. Easy peasy :stuck_out_tongue:

Thank you @peekay123 for using time on this! I have still no luck and i really don’t get why it does not work… How hard can it be man, i have tried doing the same things in a lot of different ways now, and it just wont work! Seeing the same errors in every different try… Would you mind sheering you “main” folder, i’m getting sick of this game… I just want to play with my F@#¤&?! LED’s… hehe :blush:

Finally got it working!! :triumph:
But i had to remove the calls to millis() from the countFPS() function.
And again, thank you @peekay123, for looking into it!

Finally! :smiley:

1 Like