- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trying to add OTA DFU to our project, and some parts of it are working great. The OTA DFU loader application is working perfectly and can install an image in the app 1 section. The newly flashed app starts and runs on both CM0 and CM4 as well.
The problem I'm running into is with FreeRTOS on the CM4. The CM4 starts, the initialization before starting the rtos task scheduler runs fine, but once the task scheduler starts, the core freezes up. I don't know of a way to debug the second app when its running in DFU mode, so I'm stuck trying to find what could possibly be wrong with my setup. I gave the cm4 in app 1 more ram and flash in the linker script (15000 bytes of ram and 50000 flash) but that didn't change anything. I've tried giving the freertos task more stack memory and changed the rtos heap size as well but that hasn't helped either. The final thing I tried was to give the CM4 more stack and heap, but that also didn't help. Wondering if there's anything left I can try. The example I based this code off was CE216767 for reference.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was in contact with OP about this topic and found out the problem.
The first was redirection the start address of the CM4 code which was fixed in the second reply here.
The other problem was not enough RAM allocation. I was using a custom linker script and forgot to update the ones used for DFU instead of the original ones, leaving me with a tiny fraction of the RAM needed to run the FreeRTOS task scheduler. I believe I needed 1024*48 bytes allocated in FreeRTOS.h and without increasing the RAM in the linker script for app1, the script would fail on the stack over ram check.
All is solved now however and the program works perfectly!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you use costom FW or code example? Have you ever tried any FreeRTOS code example as DFU app1?
I will also try to test this case, and show you my test result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have tried out a FreeRTOS code example under DFU mode and there is no any problem. Did you get this working?
For cm4 successful start in DFU app1, note change below line in main_cm0p.c
Cy_SysEnableCM4(CY_CORTEX_M4_APPL_ADDR);
to
Cy_SysEnableCM4(&__cy_app_core1_start_addr);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was in contact with OP about this topic and found out the problem.
The first was redirection the start address of the CM4 code which was fixed in the second reply here.
The other problem was not enough RAM allocation. I was using a custom linker script and forgot to update the ones used for DFU instead of the original ones, leaving me with a tiny fraction of the RAM needed to run the FreeRTOS task scheduler. I believe I needed 1024*48 bytes allocated in FreeRTOS.h and without increasing the RAM in the linker script for app1, the script would fail on the stack over ram check.
All is solved now however and the program works perfectly!