This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I need help with converting any example from Keil to SES

Hello,

I've been trying for days to convert any example from Keil to SES, I have road probably every question here on the dev zone but I am unable to fix this, I ever specially install windows on my mac to try if there it would work.

So, I have done everything from official nordic documents, I've been through several problems which I happily solve, but that I'm not able to.

I get those errors:


unplaced section: .log_dynamic_data_app [nrf_log_frontend.o], size=12, align=4

undefined symbol: __SRAM_segment_end__

undefined symbol: __start_log_const_data

undefined symbol: __start_log_dynamic_data

undefined symbol: __stop_log_const_data

I'm working on latest SEGGER, I have tried latest SDK, also 14.2 . The same errors. 

Thanks for reply

Parents
  • It seems like you are not using the correct startup code.  Startup code and linker scripts are different.  Startup code and linker script go in pair. You need to use the one made for SES.

  • Hey, I have followed instructions from here https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/segger-embedded-studio-a-cross-platform-ide but its a little bit outdated since now there is SES 4.50.

    Maybe there is a tutorial of how to rewrite programs from Keil to SES? Please like, I have spent so much hours for that, everyone seems get it done, and I am unable to transfer even Blinky example... 

  • Don't try to import project.  That is what will get you into big troubles.  It is better to start from a existing SES example project, then add the source files you need.  Note that SES compiler is very limited.  It does not support C++.  

  • I have tried this also, to be specific, I have tried to rewrite MPU9250 any example from: https://github.com/Martinsbl/nrf5-mpu-examples on base of example twi_sensor from sdk14.2 . 
    Firstly I imported his example (mpu-simple) to ses, then I have opened another window with twi_sensor example in ses, and comparing two of them together I added all nrf libraries, all nrf drivers and all application .c files that was in imported example. I did not touch any system file or something else. And I almost got it to built, but I have few errors.

    1. With compiling app_error_weak.c:
    'NRF_LOG_ENABLED' undeclared (first use in this function); did you mean 'NRF_MODULE_ENABLED'?
    (this error is not present when compiling the same document in imported example)

    2. With compiling SEGGER_RTT_printf.c
    'SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS' undeclared here (not in a function); did you mean 'SEGGER_RTT_MAX_NUM_UP_BUFFERS'?
    'SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS' undeclared here (not in a function); did you mean 'SEGGER_RTT_MAX_NUM_DOWN_BUFFERS'?

    3. With compiling SEGGER_RTT_Syscalls_SES.c
    'SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS' undeclared here (not in a function); did you mean 'SEGGER_RTT_MAX_NUM_UP_BUFFERS'?
    'SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS' undeclared here (not in a function); did you mean 'SEGGER_RTT_MAX_NUM_DOWN_BUFFERS'?

    4. With compiling SEGGER_RTT.c
    'SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS' undeclared here (not in a function); did you mean 'SEGGER_RTT_MAX_NUM_UP_BUFFERS'?
    'SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS' undeclared here (not in a function); did you mean 'SEGGER_RTT_MAX_NUM_DOWN_BUFFERS'?
    'SEGGER_RTT_CONFIG_BUFFER_SIZE_UP' undeclared here (not in a function); did you mean 'SEGGER_RTT_PRINTF_BUFFER_SIZE'?
    'SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN' undeclared here (not in a function); did you mean 'SEGGER_RTT_PRINTF_BUFFER_SIZE'?
    'SEGGER_RTT_CONFIG_DEFAULT_MODE' undeclared (first use in this function); did you mean 'SEGGER_RTT_MODE_DEFAULT'?

    And I have compiled these example in Keil with no problem at all, But I don't have enough money to buy Keil since I am student Disappointed

  • those are defined in sdk_config.h.  Look for it.  

    To work with sensors I recommend using Eclipse with IOsonata library.  SES cannot be with it used because it is C++.

    MPU-9250 driver code : 

    github.com/.../agm_mpu9250.cpp

    To use Eclipse with nRF5 series follow these blog pages : 

    https://embeddedsoftdev.blogspot.com/p/ehal-nrf51.html

    Example source code using MPU-9250 and stream data to Thing App.

    https://github.com/IOsonata/IOsonata/tree/master/ARM/Nordic/exemples/BlueIOThingy

    Eclipse project for that : 

    https://github.com/IOsonata/IOsonata/tree/master/ARM/Nordic/nRF52/nRF52832/exemples/BlueIOThingy

    SDK16 is required.

  • Hi, I did what you have recommended, I have set up Eclipse and all of that. No w I have this error:

    19:35:04 **** Incremental Build of configuration Debug for project BlueIOThingy ****

    make all 

    Building target: BlueIOThingy.elf

    Invoking: Cross ARM GNU C++ Linker

    arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -T "../../../../../../exemples/BlueIOThingy/gcc_nrf52_thingy_xxaa.ld" -Xlinker --gc-sections -L"../../../../../../../../../external/BSEC/algo/lite_version/bin/gcc/Cortex_M4" -L"../../../../lib/Eclipse/Debug" -Wl,-Map,"BlueIOThingy.map" --specs=nano.specs --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lm -lrdimon -Wl,--end-group -o "BlueIOThingy.elf"  ./src/BlueIOICM20948.o ./src/BlueIOMPU9250.o ./src/BlueIOTcs.o ./src/BlueIOTes.o ./src/BlueIOThingy.o ./src/BlueIOTms.o ./src/BlueIOTuis.o   -lIOsonata_nRF52832 -lalgobsec

    /usr/local/Caskroom/gcc-arm-embedded/9-2019-q4-major/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: cannot find -lIOsonata_nRF52832

    collect2: error: ld returned 1 exit status

    make: *** [BlueIOThingy.elf] Error 1

    "make all" terminated with exit code 2. Build might be incomplete.

    19:35:04 Build Failed. 2 errors, 0 warnings. (took 131ms)

    It seems that it cannot find -lIOsonata_nRF52832 in arm none eabi? it seems strange.

    What should I Do next?

  • You need to build the lib project first.  open the lib project from .../ARM/Nordic/nRF52/nRF52832/lib

    compile both Debug & Release build. It will generate the libIOsonata_nRF52832.a

Reply Children
  • Thanks, I did it and the project builded correct, with 2 warnings.

    I have tried flashing with JLINK simple Blinky example with .hex file and it works, but while I flashed with BlueOThingy it seems that something is wrong, bluetooth is not advertising.  I have tried to do the debug and check what is wrong and where, but I am not able to see "J LINK" in preferences -> Run/Debug ->, However I can see in Run/Debug -> Launching -> Launch Configurations  something " GDB SEGGER J-Link Debugging" But I have not idea how to set it up to see Jlink options in Run/Debug. Not many answers are on the internet also, maybe you know how to set it up? (I found about updating ARM pluggin so I did that, but it did not worked)

    And, I can't find anywhere in the code how to connect MPU9250 (SCL,SDA) pins to nrf5 dev board, I searched in web that it should be 27 and 26 pin, but also I found that gpio pins can be set as a SCL/SDA, so somewhere in the code it is probably setted up? Please help.

    Thanks for all your help. 

  • flashing Blinky will erase the softdevice.  Therefore you need to refrash softdevice outside using nrfjprog first. Then you can use Eclipse to launch the firmware.

  • To be sure..

    So I just need to type "Nrfjprog" in terminal to refresh? 

    Do you think Its good way to flash firmware into dev 5 board through Jlink program? 

    What about SCL/SDA pinout to dev 5 board?

  • oh no. You need to use the nrfjprog to flash the softdevice first. the hex file of the softdevice is in the SDK under components/softdevice/...

  • Okay, so I need to flash it twice yes?

    Firstly I did:

    " cd /Users/jacobbudny/Desktop/DEVELOPMENT/external/nRF5_SDK/components/softdevice/s132/hex "
    // to get to the folder where soft device is

    " nrfjprog --family NRF52 --program s132_nrf52_7.0.1_softdevice.hex --verify "
    // then that fo flash the softdevice

    I got that:                                      

    Parsing hex file.

    ERROR: The file specified could not be found.

    jacobbudny@Philips-MBP hex % nrfjprog --family NRF52 --program s132_nrf52_7.0.1_softdevice.hex --verify                                     

    Parsing hex file.

    Reading flash area to program to guarantee it is erased.

    Checking that the area to write is not protected.

    Programming device.

    Verifying programming.

    Verified OK.

    -----------
    // So I assume its okay?

    Than I flashed the BlueIOThingy
    " cd /Users/jacobbudny/Desktop/DEVELOPMENT/IOsonata/ARM/Nordic/nRF52/nRF52832/exemples/BlueIOThingy/Eclipse/Debug "
    // to get to the folder

    "nrfjprog --family NRF52 --program BlueIOThingy.hex --verify "

    Parsing hex file.

    Reading flash area to program to guarantee it is erased.

    Checking that the area to write is not protected.

    Programming device.

    Verifying programming.

    Verified OK.


    // And I did a reset on the board,  so I assumed it should be okay? but it still do not advertise ;/ don't know what I am doing wrong


                 





Related