Hi all,
I would like to use ULP in PlatformIO (Arduino framework).
I’m coming from Arduino IDE, and there my code works
Now I get compile errors: “undefined reference to…”
Please see:
Linking .pio\build\ulp_test\firmware.elf
.pio\build\ulp_test\src\ULPADC.ino.cpp.o:(.literal._ZL16init_ulp_programv+0x0): undefined reference to `_binary_ulp_main_bin_end'
.pio\build\ulp_test\src\ULPADC.ino.cpp.o:(.literal._ZL16init_ulp_programv+0x4): undefined reference to `_binary_ulp_main_bin_start'
.pio\build\ulp_test\src\ULPADC.ino.cpp.o:(.literal._ZL16init_ulp_programv+0x14): undefined reference to `ulp_low_threshold'
.pio\build\ulp_test\src\ULPADC.ino.cpp.o:(.literal._ZL16init_ulp_programv+0x1c): undefined reference to `ulp_high_threshold'
.pio\build\ulp_test\src\ULPADC.ino.cpp.o:(.literal._Z5setupv+0x84): undefined reference to `ulp_ADC_reading'
.pio\build\ulp_test\src\ULPADC.ino.cpp.o:(.literal._Z5setupv+0x90): undefined reference to `ulp_entry'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\ulp_test\firmware.elf] Error 1
My declarations are:
#include "esp32/ulp.h"
#include "../ulp/ulp_main.h"
#include "ulptool.h"
#include "esp_sleep.h"
#include "driver/rtc_io.h"
#include "driver/adc.h"
extern const uint8_t ulp_main_bin_start[] asm("_binary_ulp_main_bin_start");
extern const uint8_t ulp_main_bin_end[] asm("_binary_ulp_main_bin_end");
ulp_main.h contains:
#include "Arduino.h"
#pragma once
extern uint32_t ulp_entry;
extern uint32_t ulp_sample_counter;
extern uint32_t ulp_low_threshold;
extern uint32_t ulp_high_threshold;
extern uint32_t ulp_ADC_reading;
Where are those “undefined reference” coming from? I searched and tried many things during the whole day, but nothing helped…
It has to do something with ULP right? Because all the other code works just fine. This morning I imported the ULP code-fragments from my “old” (in Arduino IDE) project, and then the problem popped up.
Who has an idea to fix this?
Thanks in advance!
Best regards,
Stephan