Skip to content

Building

joric edited this page Dec 13, 2019 · 9 revisions

Put repository to the nRF5_SDK_12/bluetosis folder (nRF5_SDK_12/bluetosis/firmware and so on).

Mind that symlink or junction won't work on Windows 10 for some reason (GCC Makefile error ... is a directory. stop).

GCC

Open nRF5_SDK_12/components/toolchain/gcc/Makefile.posix make sure that GNU_INSTALL_ROOT := /usr/, then:

sudo apt install openocd gcc-arm-none-eabi
cd nRF5_SDK_12
git clone https://github.com/joric/bluetosis && cd bluetosis
cd firmware/custom/armgcc && make

Working GCC linker settings for softdevice s130 2.0.1 and [YJ-14015] modules (256K ROM, 16K RAM) appear to be:

  FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x25000
  RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x2000

To build with this settings, set stack and heap to 1024 or something in gcc_startup_nrf51.S (originally 2048). You could also use Makefile defines:

ASMFLAGS += -D__HEAP_SIZE=1024 -D__STACK_SIZE=1024

IAR

Open .eww, hit Make, that's it. I'm using a single plate (reversed) version for the debug configuration (modules soldered to the top of the PCB), to build standard version remove COMPILE_REVERSED from defines.

Firmware merging

You can also merge Bluetooth softdevice with Bluetooth firmware using mergehex utility from nRF5x Command Line Tools:

mergehex.exe -m s130_nrf51_2.0.1_softdevice.hex nrf51822_xxac.hex -o out.hex

But it's much faster and more convenient to flash softdevice just once for quicker firmware updates.

Clone this wiki locally