Reply by Domen Puncer July 8, 20102010-07-08
--- In l..., "adrianunderwater" wrote:
>
> On another note.... yes lr pc sp do work by default, as does ip... but what is ip used for??? I can't find any reference to it in the doc, and after 5 years of working on the lpc21xx and lpc23xx I have never used it, Except when I define it explicitly (as a different register..) so I'll need to rename and re organize my code anyways.

Scratch register for Intra Procedure calls, I think.

An Engineer's Guide to the LPC2100 Series

Reply by Pete Vidler July 8, 20102010-07-08
On 07/07/2010 08:33, adrianunderwater wrote:
> - Would anyone have an idea to how to rename a register in GNU

The #define should work, provided that the file is passed through the C
preprocessor first (which it isn't by default). To do this, try
compiling with gcc and passing "-x assembler-with-cpp" as an option.

If you're on a case-sensitive OS/toolchain, you can use the ".S" file
extension (capital S), which should do the same thing.

...but doesn't the GNU assembler allow the alternate names by default?
Just using ip, sp, lr and pc directly works for me (don't know about U
and W though).

Pete

--
Pete Vidler
Senior Systems Developer,
TTE Systems Ltd

Work: http://www.tte-systems.com
Home: http://petevidler.com
Reply by adrianunderwater July 7, 20102010-07-07
Thanks for such a quick answer (to both of you!!)

Well, the C preprocessor was the problem... I did think it was being used, but it wasn't. So there... errors come from making unfounded assumptions!

On another note.... yes lr pc sp do work by default, as does ip... but what is ip used for??? I can't find any reference to it in the doc, and after 5 years of working on the lpc21xx and lpc23xx I have never used it, Except when I define it explicitly (as a different register..) so I'll need to rename and re organize my code anyways.
--- In l..., Pete Vidler wrote:
>
> On 07/07/2010 08:33, adrianunderwater wrote:
> > - Would anyone have an idea to how to rename a register in GNU
>
> The #define should work, provided that the file is passed through the C
> preprocessor first (which it isn't by default). To do this, try
> compiling with gcc and passing "-x assembler-with-cpp" as an option.
>
> If you're on a case-sensitive OS/toolchain, you can use the ".S" file
> extension (capital S), which should do the same thing.
>
> ...but doesn't the GNU assembler allow the alternate names by default?
> Just using ip, sp, lr and pc directly works for me (don't know about U
> and W though).
>
> Pete
>
> --
> Pete Vidler
> Senior Systems Developer,
> TTE Systems Ltd
>
> Work: http://www.tte-systems.com
> Home: http://petevidler.com
>

Reply by adrianunderwater July 7, 20102010-07-07
Hi all...

I have an IAR assembly project (LPC2378) that I am porting to GNU. In IAR renaming registers is easy and straightforward, using #define, as such:

1: #define IP r12
2: #define U r11
3: #define W r0

and using like this:

4: add IP,r0,#45
5: add U,r0,#43

When I tried this in GNU, 2 problems appear...

- I get a compile error on line 5: "U is not an Arm register"
- Looking at the assembled code, in line 4: IP is replaced by another register all together. And I can not find any reference to another IP elsewhere...

- Would anyone have an idea to how to rename a register in GNU
- And does anyone know why my #define did not complain when I (re?)defined IP..?

Thanks, Adrian