Nordic nRF51822 ARM Cortex-M0 Development using emIDE

Nordic nRF51822 ARM Cortex-M0 Development using emIDE

To avoid the hefty charges with commercial compilers I tried emIDE with some success; here are the settings I used for the EV Kit

Official emIDE website: http://www.emide.org/

Ev Kit: https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF51822-Evaluation-Kit

Exception Vectors

Any code compiled with a resident Soft Device has a vector table at the link address (eg, Soft Device 110 v7 requires user code to be at 0x16000, so the vector table will be at that address). The reset vector at 0x16004 will be the start address of the user code, but to debug the code must start at the reset vector in code location 0x00004, which is the Soft Device reset address. Ensure this happens by performing a device Reset before running code.

GDB Debugger

Breakpoints can be set and code single-stepped through the application startup assembler code, but currently 4.7.4 and 4.8.3 GDB crashes if setting a breakpoint in main.c. Note memory display works for both s100 Soft Device and application code and memory.

Link Files

Use the default gcc link files (eg gcc_nrf51_s110_xxaa.ld) located here: blahblah\nrf51822\Source\templates\gcc\

emIDE Default Version

gcc version 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601] (GNU Tools for ARM Embedded Processors)

**Global Compiler Settings gcc - 4.7.4**
Settings->Compiler->Toolchain Executables:
C:\Program Files (x86)\emIDE\emIDE V2.20\arm
Settings->Compiler->Search Directories->Compiler:
C:\Program Files (x86)\emIDE\emIDE V2.20\arm\arm-none-eabi\include

**Global Compiler Settings - gcc 4.8.3**
Settings->Compiler->Toolchain Executables:
C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2013q4

**Project-Specific Settings - Debug**
Project->Build Options->Debug->Policy:
Append target options to project options
Project->Build Options->Debug->Compiler Settings->Compiler Flags:
Produce debugging symbols [-g]
Project->Build Options->Debug->Compiler Settings->Other Options:
-std=c99
-mcpu=cortex-m0
Project->Build Options->Debug->Compiler Settings->#defines:
DEBUG=1
NRF51
DEBUG_NRF_USER
BLE_STACK_SUPPORT_REQD
BOARD_PCA10001

Project->Build Options->Debug->Linker Settings->Linker script:
.\Link\gcc_nrf51_s110_xxaa.ld

Project->Build Options->Debug->Linker Settings->Other linker options:
-mthumb
-Wl,--gc-sections
-n
-Wl,-cref
-mcpu=cortex-m0
-Wl,-Map
-Wl,${TARGET_OUTPUT_FILE}.map

Project->Build Options->Debug->Search Directories->Compiler:
C:\Program Files (x86)\emIDE\emIDE V2.20\arm\arm-none-eabi\include
.\
.\Src
.\Src\nrf51822\Board
.\Src\nrf51822\Board\s110
.\Src\nrf51822\Board\s110\ble_app_YourApp
.\Src\nrf51822\Include
.\Src\nrf51822\Include\app_common
.\Src\nrf51822\Include\ble
.\Src\nrf51822\Include\ble\device_manager
.\Src\nrf51822\Include\ble\ble_services
.\Src\nrf51822\Include\gcc
.\Src\nrf51822\Include\s110
.\Src\nrf51822\Include\sd_common
.\Src\nrf51822\Include\sdk
.\Src\nrf51822\Lib
.\Src\nrf51822\Source
.\Src\nrf51822\SVD

Project->Build Options->Debug->Search Directories->Linker:
.\Link

Project->Properties->Debugger->GDB->GDB commands after connection:
Monitor reset
monitor flash device nRF51822_xxAA
load

Project->Properties->Debugger->J-Link GDB Server->Target Device:
nRF51822_xxAA
(Uncheck) Automatically close GDB Server after debugging

Project->Properties->Debugger->J-Link GDB Server->Interface Speed:
2000

Hugh

Anonymous
  • Such a piece of good information. I'm a student and of course, I want to have money and I decided to work as a freelance writer affordable paper. Our exclusive paper service has been rated the best in completing diverse writing tasks given to students at their educational institutions, such as colleges, high schools, and universities.

  • Development of the land court is done for the comfort of the participants. The art of the discussion is ensured whether it is paying someone to write an essay illegal? Or not for the future times. The tip of the success is structured in safe items for the citizens.

  • I think you need to use -std=gnu99 (3rd section) to make the compilation of "system_nrf51.c" to work, because one of its dependencies (compiler_abstraction.h) uses asm keyword, which is not defined in c99.

    I tried to make the blinky example to compile in emIDE and changing it to gnu99 fixed the compilation error I had.