- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a project on a PSoC 4200 BLE which uses a lot of RAM (about 2k remaining). I'm using FreeRTOS, but because I'm only using static allocation, I have the heap size set to 0 to give my application as much RAM as possible.
I recently started trying to implement an Upgradeable Stack Bootloader for this project, following the instructions in AN97060. After making the required changes to my project, the application project fails to build with error M0120 (section '.heap' will not fit in region '.ram").
This seems to be caused by the custom linker script from the OTA changes needing heap space which I don't have room for. I see that the BLE component datasheet says that for the stack-only BLE component in the stack project, "requires approximately 3024 additional bytes of heap memory".
My questions are:
1: Why does having the component in stack-only mode require any heap space when having OTA disabled does not?
2: Why is this heap space necessary when the stack is being used by the application rather than just by the stack application? The component works fine with no heap space when OTA is disabled.
3: Is there any way around this problem or can I not do OTA firmware upgrade when my application requires most of the PSoC's RAM, even if most of that RAM is available to the stack application when the real application isn't running?
Thanks.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the Stack project (BLE component in stack only mode), the BLE Stack requires RAM memory that must be allocated statically. So, the Application project (BLE component in profile only mode) provides some space reserved for the BLE Stack operation, using custom linker scripts. This results in reducing the amount of the RAM memory available for the Application project.
If the size of the heap or stack needs to be changed, the custom linker scripts must be adjusted instead of System tab of Cydwr. Please refer steps elaborated in section: 'Custom linker scripts limitations' of code attached code example document.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And I guess that second question can be stated differently as "if the stack suddenly needs heap space when it's in stack-only mode, where was it getting that memory before, and why isn't it freed up when it needs the heap for it"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When Cypress shut their support down and pushed everybody to this forum, I was under the impression that Cypress support engineers would be active on it to answer questions. Is that not the case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Appologies for the delay.
In OTA disabled mode cyBle_stackMemoryRam is allocated from SRAM. Whereas, in stack only mode the BLE component allocates from heap memory. As per the BLE component implementaion it is necessary to allocate 3024 additional heap bytes once used in the stack-only mode. It is not possible to optimize this resource usage. You need to fit in the firmware within the available memory space or upgrade to a higher device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So if in that mode, cyBle_stackMemoryRam is no longer allocated statically, why is it still using the same amount of memory in addition to the heap requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looking at the generated map file, we see that there's still 0xAE0 (2784) bytes of memory being statically allocated to CyBle_stackMemoryRam. What is this memory being used for if it also needs the heap?
.noinit 0x20001a30 0xae0 .\CortexM0\ARM_GCC_541\Debug\xxxxx.a(BLE0.o)
0x20001a30 cyBle_stackMemoryRam
.data 0x20002510 0x398 load address 0x000297b0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When can I expect a Cypress response to this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Our Field Application Engineer (FAE) will get in touch with you. Please share your workspace to understand the project configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the Stack project (BLE component in stack only mode), the BLE Stack requires RAM memory that must be allocated statically. So, the Application project (BLE component in profile only mode) provides some space reserved for the BLE Stack operation, using custom linker scripts. This results in reducing the amount of the RAM memory available for the Application project.
If the size of the heap or stack needs to be changed, the custom linker scripts must be adjusted instead of System tab of Cydwr. Please refer steps elaborated in section: 'Custom linker scripts limitations' of code attached code example document.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content