This is the mail archive of the
mailing list for the newlib project.
Re: ARM CM3 printf() problem
- From: Weston Schmidt <weston_schmidt at alumni dot purdue dot edu>
- To: Freddie Chopin <freddie_chopin at op dot pl>
- Cc: newlib at sourceware dot org
- Date: Thu, 4 Apr 2013 01:20:25 -0700
- Subject: Re: ARM CM3 printf() problem
- References: <CAMBZiN3ENEi4Q7ScHWV1K4eJWQBwnDmN__cMWB4hwnqyd3_wHg at mail dot gmail dot com> <515D2E31 dot 90104 at op dot pl>
Thank you very much - it turns out I hadn't build gcc with multilibs
enabled. I added that option, rebuilt gcc and it works perfectly.
On Thu, Apr 4, 2013 at 12:39 AM, Freddie Chopin <email@example.com> wrote:
> General advice regarding printf():
> 1. Make sure that your stack is double-word aligned - that is 8-bytes
> 2. Make sure you have A LOT of stack, printf can use up to 1kB of stack -
> really! If you don't plan to use floating point you can cut that down by
> using integer-only version iprintf().
> Your problem is caused by wrong linking - notice that the problematic
> instruction is "blx <even-address>", so it tries to switch to ARM mode,
> which does not exist for Cortex-M3. First of all you need to use gcc (or
> g++) for linking, not ld directly - this way it's easier to deal with
> multilib. Second thing is that you need to have proper multilibs, compiled
> for cortex-m3 in thumb mode...