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

v8.0 : Gatt Server Attibute Table Size configuring at runtime

Hi

The documentation for the new feature in S110 v8 to change the gatt table size says that to change it the linker configuration needs changing.

This means it is a build time configuration. That made me gulp.

I want to be able to change it at run time.

I fully understand and accept why I would need to change the linker configuration

For module manufacturers it does mean stocking different part numbers for all those different sizes. I can just see the operations managers out there having a fit :-)

Challenge to this community ... How would you make it a runtime configuration?

My suggestions:-

(1) have a buffer statically/dynamically assigned in the application and then pass the pointer in the call to sd_ble_enable(). The fact that the current size is passed via sd_ble_enable() either means the stack copes with a pointer to the gatt table OR that it is statically assigned as say unsigned char table[1] and the stack linker configuration ensures that table[] is assigned an address which points to the highest memory location so it can grow upwards without conflict.

(2) This one requires no changes in the stack for Nordic engineers.... For my application, I change the linker configuration so that it assigns memory to global variables downwards from an address say 0x20003800, rather than upwards from say 0x20002000. (assuming stack has 0x800). Then I tweak my arm_startup_nrf51.s so that the free space in between is given over to the stack for the gatt table and rest used for my heap. This will achieve the same outcome with regards to memory requirements for the stack. (One caveat, I am not sure how to set the size of the heap dynamically in the startup file)

I would love to hear of other solutions.

For (2) above, I have no idea how to configure the linker to do that downwards allocation from an address specified in the linker tab of the compiler but I am sure it should be doable.

Related