Not applicable
Jul 23, 2013
01:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 23, 2013
01:44 AM
The following sprintf call works correctly when called from main() but the result is always "0.0" when called from an interrupt (in my case a SYSTM001 interrupt)...
The following sprintf with conversion to an integer does work in the interrupt...
I have read a few posts on this problem on other ARM-GCC forums which suggest problems with stack initialization and stack size.
Any help and advice would be greatly appreciated.
Best regards
Aaron
sprintf( pStr, "%5.1f,", 69.9 );
The following sprintf with conversion to an integer does work in the interrupt...
sprintf( pStr, "%4i,", (uint16_t)69.9 );
I have read a few posts on this problem on other ARM-GCC forums which suggest problems with stack initialization and stack size.
Any help and advice would be greatly appreciated.
Best regards
Aaron
- Tags:
- IFX
5 Replies
Not applicable
Jul 23, 2013
02:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 23, 2013
02:34 AM
Another observation.
The compliler / linker do not complain if the sprintf header file is not included in the source file. This is very strange.
The compliler / linker do not complain if the sprintf header file
Not applicable
Jul 23, 2013
03:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 23, 2013
03:05 AM
Hi Aaron,
I'm interest to know where did you output the data? Is it in console window? How did you make it?
Best regards,
Zain
I'm interest to know where did you output the data? Is it in console window? How did you make it?
Best regards,
Zain
Not applicable
Jul 23, 2013
03:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 23, 2013
03:16 AM
Hi Zain,
The output goes to a USB port. I have Windows Hyperterminal monitoring the data which was always "0.0".
So I checked the output using the DAVE/Tasking debuger 'Variables' tab which also shows the string buffer to be "0.0".
Best regards
Aaron
The output goes to a USB port. I have Windows Hyperterminal monitoring the data which was always "0.0".
So I checked the output using the DAVE/Tasking debuger 'Variables' tab which also shows the string buffer to be "0.0".
Best regards
Aaron
Not applicable
Jul 23, 2013
03:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 23, 2013
03:29 AM
My stack size is currently 2048 (listed in project .ld file). Is it possible to increase this ?
Many ARM forums also state the stack must be 8 byte aligned. Is it possible to check / set this ?
Thanks
Aaron
Many ARM forums also state the stack must be 8 byte aligned. Is it possible to check / set this ?
Thanks
Aaron
Jul 26, 2013
05:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 26, 2013
05:36 AM
Hi Aaron.
I suspect while introducing a workaround for a silicon bug, we (Infineon) may have broken the ARM calling convention.
1. Kindly open the assembly startup file of the device (e.g. startup_XMC4500.s) available in the startup folder of your project.
2. Replace the Veneer macro definition with the following snippet .
/* And then define a veneer that will branch to the final excp handler */
.weak \Handler_Func\()_Veneer
.type \Handler_Func\()_Veneer, %function
\Handler_Func\()_Veneer:
LDR R0, =\Handler_Func
PUSH {LR} /* Breaks AAPCS */
SUB SP,#4 /* Restores AAPCS */
BLX R0
ADD SP,#4
POP {PC}
.size \Handler_Func\()_Veneer, . - \Handler_Func\()_Veneer
.endm
The PUSH breaks the 8 Byte boundary while the SUB instruction re-aligns the SP to a 8 byte boundary.
Regards
Prakash Kalanjeri Balasubramanian
I suspect while introducing a workaround for a silicon bug, we (Infineon) may have broken the ARM calling convention.
1. Kindly open the assembly startup file of the device (e.g. startup_XMC4500.s) available in the startup folder of your project.
2. Replace the Veneer macro definition with the following snippet .
/* And then define a veneer that will branch to the final excp handler */
.weak \Handler_Func\()_Veneer
.type \Handler_Func\()_Veneer, %function
\Handler_Func\()_Veneer:
LDR R0, =\Handler_Func
PUSH {LR} /* Breaks AAPCS */
SUB SP,#4 /* Restores AAPCS */
BLX R0
ADD SP,#4
POP {PC}
.size \Handler_Func\()_Veneer, . - \Handler_Func\()_Veneer
.endm
The PUSH breaks the 8 Byte boundary while the SUB instruction re-aligns the SP to a 8 byte boundary.
Regards
Prakash Kalanjeri Balasubramanian