I have been able to get the Event Recorder mostly working with ARM-MDK 5.27, in order to get debugging messages out of my STM32F0 (Cortex-M0) MCU. However, I've run into two issues that I am hoping someone here can help me resolve. I have not been able to find definitive answers to either in numerous web searches:
1. On my MCU, configuring the Event Recorder record count appears to use more RAM than expected. I have set my record count to 64U, which should account for 1,024 bytes (16 bytes per record). However, when I allocate an uninitialized IRAM2 region of 1,024 (0x400) bytes, I get an error than the allocation is not enough:
myproject\myproject.axf: Error: L6220E: Execution region RW_IRAM2 size (1252 bytes) exceeds limit (1024 bytes). Region contains 0 bytes of padding and 0 bytes of veneers (total 0 bytes of linker generated content).
Where do the extra 228 bytes come from? I can only allocate record counts in 2^n numbers, and whatever number I pick (64U, 128U, etc.) results in an overrun of IRAM2 when compiling, even when increasing the allocation of uninitialized IRAM2. I have to use a larger uninitialized IRAM region (e.g., 2,048 bytes) and a smaller record count (e.g., 64) in order to compile without errors. This is a waste of at least 796 bytes of RAM for a 2,048 byte allocation. How can I work around this?
2. On the same MCU, attempting to set the Event Recorder to use its time stamp source as SysTick results in a linker error about multiple definitions of SysTick_Handler:
myproject\myproject.axf: Error: L6200E: Symbol SysTick_Handler multiply defined (by eventrecorder.o and stm32f0xx_it.o).
If I define the time stamp source to be the DWT Cycle Counter, I get a warning. From my reading, it seems like DWT is emulated in the Cortex-M0, but I still get the warning:
C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.6.1\Source\EventRecorder.c(660): warning: #1215-D: #warning directive: "Invalid Time Stamp Source selected in EventRecorderConf.h!"
I want to confirm that this is working correctly with DWT and not going to cause issues.
Thanks in advance for any help!
Neil
Is the party over?
The extra bytes are from padding and a single byte used to hold timer state. From the linker map file:
Execution Region RW_IRAM2 (Exec base: 0x20020000, Load base: 0x000040d4, Size: 0x000004e4, Max: 0x00000500, ABSOLUTE, UNINIT) Exec Addr Load Addr Size Type Attr Idx E Section Name Object 0x20020000 - 0x00000001 Zero RW 3177 .bss eventrecorder.o 0x20020001 0x000040d4 0x0000003f PAD 0x20020040 - 0x000004a4 Zero RW 3178 .bss.noinit eventrecorder.o
And from EventRecorder:
AREA ||.bss||, DATA, NOINIT, ALIGN=0 SysTimerState % 1 AREA ||.bss.noinit||, DATA, NOINIT, ALIGN=6 EventBuffer % 1024 EventFilter % 128 EventStatus % 36 AREA ||.constdata||, DATA, READONLY, ALIGN=2
I only got SysTick multiply defined when using RTX or RTX5 (RTOS2) with EventRecorder configured to use SysTick. Using RTX5 pulled in a file (irq_cm4f.s) that included a definition for SysTick_Handler that in turn calls osRtxTick_Handler. Maybe it's a similar setup with stm32f0xx_it.o?