Printf of a floating point in ARM and stack alignment

Technical Note 85413

Arkitekturer:

ARM

Komponent:

general

Uppdaterad:

2020-07-23 15:28

Introduction

In some cases, printf of floating point (%f) does not seem to work.

Solution

The IAR C/C++ Compiler for ARM requires the Stack Pointer to be aligned at 8 bytes. 8-byte alignment is required by AEABI (and some instructions generated by the compiler for some cores).

The default cstartup code automatically initializes the ARM core stack(s) to an 8-byte aligned address. Make sure that your application and/or RTOS also does this.

Background

According to the MQX release notes, stack alignment is not ensured in MQX 3.7. The behavior is corrected in MQX 3.8. This problem has also been observed with other RTOSes.


All product names are trademarks or registered trademarks of their respective owners.

Det här innehållet finns tyvärr inte på svenska.

Vår webbplats finns främst på vårt koncernspråk engelska, förutom det innehåll för investerare som vi är lagstadgade att kommunicera på svenska. Vi rekommenderar att du besöker vår globala webbplats på engelska för att få en bättre upplevelse.

Vi stöder inte längre Internet Explorer. För att få bästa möjliga upplevelse av iar.com rekommenderar vi att du uppgraderar till en modern webbläsare som Chrome eller Edge.