[EXT_EP-9737] Stack usage incorrect on many hand-coded assembly library functions Created: 04/Mar/20 Updated: 04/Mar/20 Resolved: 04/Mar/20 |
|
| Status: | Fixed |
| Project: | Embedded Software & Tools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Medium |
| Reporter: | TI User | Assignee: | TI User |
| Resolution: | Fixed | Votes: | 0 |
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Product: | Code Generation Tools |
| Internal ID: | CODEGEN-6690 |
| Forum URL: | https://e2e.ti.com/support/microcontrollers/hercules/f/312/t/840566 |
| Found In Release: | ARM_18.1.0.LTS ARM_18.12.0.LTS ARM_20.2.0.LTS |
| Fix In Release: | ARM_20.2.1.LTS* ARM_18.12.6.LTS* ARM_18.1.8.LTS* |
| Affected Platform/Device: | default |
| Release Notes: | The worst case stack usage for most hand-coded assembly functions in the RTS library is recorded in an assembler directive. This value ends up in the DWARF information and is used by tools such as the call graph utillity. For many functions, this worst case usage was found to be inaccurate. Functions compiled from C or C++ code are not affected. |
| Description |
|
The Thumb2 variant of memcpy is in the source file memcpy_t2.asm. The function starts with these lines ... __TI_C$MEMCPY: .asmfunc stack_usage(0)
CMP r2, #0 ; CHECK FOR n == 0
However, later in the function there is this ... _ovr16: PUSH {r4 - r6} ; COPYING 16 BYTES OR MORE.
SUBS r2, #16 ;
_lp16: LDMIA r1!, {r3 - r6} ;
STMIA r0!, {r3 - r6} ;
SUBS r2, #16 ;
BCS _lp16 ;
POP {r4 - r6} ; RESTORE THE SAVED REGISTERS AND
Note the 3 registers R4, R5, R6 are pushed and popped from the stack. Therefore, the stack usage is not 0, but 12 bytes. |