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
Over one year ago and still no assistance with this. I found this as I am having the same problem myself. It seems to work when the source is set to the DWT cycle counter, but to have that error every time is unacceptable for production software and also does give the feeling that something isn't configured correctly...
Well, I never did get any resolution to the original issue. ARM Compiler v5 and v6 both show the error. But, I've been using the EventRecorder with the DWT for over a year now without issues. I guess it's just benign. I have all the debug code surrounded by pre-processor #defines, so my production code doesn't include the EventRecorder at all -- though my RAM value is still reduced.
I've not been able to get any other time stamp source to work at all. The EventRecorder wants to redefine the SysTick_Handler, so you either have to defer to its implementation or adjust the code accordingly.
If you get anything to work, no matter if the original issue, then it would be fair/nice to mark the question resolved and provide your findings. This is a forum not a support hotline.
42Bastian Schick said:it would be fair/nice to mark the question resolved and provide your findings
Indeed.
Well it seems the community has finally arrived, but only seek to end the conversation rather than offer any advice Maybe you should mark your own answer as the verified one and appease them even though, as you say, this is not resolved.
I will do the same as you have done with the #defines to remove the error from production builds. I'm afraid I have no idea why the IRAM2 allocation isn't enough though.
EventRecorder is a MDK tool, so why not ask Keil support? It surely needs some space for handling the recorded stuff.
The map file will tell you more.
Keil states: "164 + 16 x Number_of_Records"
Indeed - glad this helped you somewhat.
Yes, I saw this as well -- however, it does not explain the full 228 bytes. I guess it's just a waste of memory but my only current option. Thanks.
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?