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

custom service, trouble compiling and running.

I'm using a nRF51822 with 256KB flash and 16KB RAM, SoftDevice v5.2.1, uVision 4.71.2.0

I can compile and run the heart rate sensor, and it will become detected by mastercontrolpanel, so my chip and circuit works

I can run a few hello world UART demos I wrote myself, without any BLE compiled in, and see the UART output through my serial terminal.

But I recently tried to add in my own BLE service. At first it would not compile. It complained about...

.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching libspace.o(.bss).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_dis.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_conn_params.o(.bss).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_bondmngr.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_conn_params.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching test.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_stack_handler.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_radio_notification.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching system_nrf51.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching udebug.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching r2bt_initers.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_error_log.o(.data).
.\keilbuild\fw_test.axf: Error: L6406E: No space in execution regions with .ANY selector matching ble_flash.o(.data).
.\keilbuild\fw_test.axf: Error: L6407E: Sections of aggregate size 0x134 bytes could not fit into .ANY selector(s).

Which I guessed was something to do with the IRAM size (guessed by Googling the problem), so I increased the IRAM size from 0x2000 to 0x2400, and the errors went away. It can now compile.

I can load the code using nRFgo Studio and my J-Link LITE Cortex M.

But it does not even get to the first printf statement, I never see anything being output through the UART.

I cannot start debugging in uVision for some reason, it says "No Algorithm found for: 00014000H - 000196CBH", so I cannot determine what my code is actually doing.

Please help. I need to know some common mistakes that I could have made.

  • Just increasing the RAM size in your project file is a little optimistic, since that (unfortunately) won't increase the physical amount of RAM available. ;)

    The solution is therefore to put this back to 0x2000, and instead reduce RAM usage in other ways. The .map file generated by the linker is a great help to know which parts of your code consumes memory, and it can also be useful to take a look at this question.

  • Thank you

    From the link you suggested, the memory allocated for app timer was indeed the culprit. My own code had left the allocation at its default, which used up too much RAM. After I decreased the allocation, and compiled using 0x2000 IRAM size, I successfully got master control panel to see my device!

  • I don't know how to decrease the allocation of the app timer & I don't know also how to solve the problem