-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building BLE under efm32-base #31
Comments
howdy, it's been so long i'm not -entirely- sure tbqh. i did some exploratory work on supporting the EFR32BG which would have needed to pull in the bluetooth SDK, but, ended up using NRF52s and ESP32s preferentially. i think @ravnicas might have used this previously (#25)? (as an aside, unless you need something specific to the EFM32 platform this will be a -high-effort- approach... if you're open to looking at other platforms, the NRF52 with rust/embassy is an incredible developer experience compared to the C adventures i'm used to, for wifi + BLE the ESP32 is fairly unbeatable, and i haven't tried one myself yet but the pi pico w looks like a neat option for low-performance tasks) |
Wow, you could probably boot Linux on the ESP32... well almost, might need more RAM. Not sure I'm ready for Rust, but maybe I need to learn yet another language. Would love to jump ship to ESP32, I like the WiFi option and they are surprisingly inexpensive for the feature set. The chip-specific stuff about our code is UART, systick/RTC, PWM, i2c, ADC...hmm...thats more than I thought. Well we can use what we have w/o BLE if needed, but would be nice to get BLE working to avoid reworking all the hardware integration bits. |
Hi @ryankurte, Ok so we're making progress building BLE under efm32-base. This is a How do I tweak
These need to appear This is a bit hacked together, but the following hand-coded linker line compiles most of the BLE SPP example without errors. The linker line is just a link line created by /opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld \
-plugin \
/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/liblto_plugin.so \
-plugin-opt=/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/lto-wrapper \
-plugin-opt=-fresolution=/tmp/ccZ3MWLa.res \
-plugin-opt=-pass-through=-lgcc \
-plugin-opt=-pass-through=-lg_nano \
-plugin-opt=-pass-through=-lc_nano \
-plugin-opt=-pass-through=-lgcc \
-plugin-opt=-pass-through=-lc_nano \
--sysroot=/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi \
-X \
-o \
efm32-test \
/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v8-m.main/fpv5-sp/hard/crti.o \
/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v8-m.main/fpv5-sp/hard/crtbegin.o \
/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard/crt0.o \
-L/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v8-m.main/fpv5-sp/hard \
-L/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard \
-L/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard \
-L/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1 \
-L/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc \
-L/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib \
-L/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib \
-T/home/ewheeler/src/efm32-base/protocol/bluetooth/ble_stack/linker/GCC/efr32mg21a010f1024im32.ld \
-Map=/home/ewheeler/src/efm32-base/build/efm32-test.map \
--gc-sections \
-v \
CMakeFiles/efm32-test.dir/source/main.c.obj \
CMakeFiles/efm32-test.dir/source/gatt_db.c.obj \
-lgcc \
-lc_nano \
-lnosys \
-lgcc \
-lc_nano \
-lnosys \
./CMakeFiles/efm32-test.dir/emdrv/sleep/src/sleep.c.obj \
-L../protocol/bluetooth/lib/EFR32MG21/GCC/ \
-lbluetooth \
-lmbedtls \
-lpsstore \
-lrail \
emlib/libemlib.a \
device/libdevice.a \
--start-group \
-lgcc \
-lg_nano \
-lc_nano \
--end-group \
--start-group \
-lgcc \
-lc_nano \
--end-group \
/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v8-m.main/fpv5-sp/hard/crtend.o \
/opt/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/thumb/v8-m.main/fpv5-sp/hard/crtn.o |
nice work! the right place to add this is probably protocol/CMakeLists.txt, where you could add a |
So it builds if I make the following changes to the root-level CMakeLists.txt file: -set(CMAKE_EXE_LINKER_FLAGS "${COMMON_DEFINITIONS} -Xlinker -T${LINKER_SCRIPT} -Wl,-Map=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map -Wl,--gc-sections -Wl,-v")
+set(CMAKE_EXE_LINKER_FLAGS "-L../protocol/bluetooth/lib/EFR32MG21/GCC/ ${COMMON_DEFINITIONS} -Xlinker -T${LINKER_SCRIPT} -Wl,-Map=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.map -Wl,--gc-sections -Wl,-v ")
[...]
-target_link_libraries(${PROJECT_NAME} ${LIBS} emlib cmsis device)
+target_link_libraries(${PROJECT_NAME} ${LIBS} bluetooth mbedtls psstore rail protocol emlib cmsis device ) Note that I have to hardcode a I also tried adding this to target_link_libraries(bluetooth mbedtls psstore rail) but I get the following error when I run
I think this boils down to about two questions:
Thanks for your help on this, I'm brand-new to cmake, I've only ever used it with efm32-base. -Eric |
target_link_options should do the job, and if you look at
cmake models components as targets, and the first argument to these functions is the target, target.
cmake is, certainly not easy, but among the best tools we have :-/ |
Hi Ryan,
It looks like BLE_LIB is only defined once and never referenced:
Is it used? If so, how?
We're going to play with BLE so if you have any pointers or know of other projects that have used BLE with efm32-base then it would be nice to have a look.
This is the efm32-base project we have been working on and here is a presentation about it, if you're curious.
-Eric
The text was updated successfully, but these errors were encountered: