EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Error: internal_relocation (type: OFFSET_IMM) not fixed up

Started by nik September 28, 2008
Hello

I am using gcc 4.1.1 as a cross compiler for arm on ubuntu.
Being a rookie in gcc, I have very little knowledge of it.

I am trying  to assemble the crt0.s file using the command
-desktop:~/armgcc$ arm-elf-as crt0.s


But what I am getting is :

crt0.s: Assembler messages:
crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed up
crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed up
crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed up
crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed up


The lines 157,160,162,163 that are giving errors are :
 str   r0,[r1,#PS_PCER_OFF]

str   r0,[r1,#PIO_PER_OFF]

str   r0,[r1,#PIO_CODR_OFF]

str   r0,[r1,#PIO_OER_OFF]

Please help me out with the cause and solution for this error.

Thanks.
nik wrote:
> Hello > > I am using gcc 4.1.1 as a cross compiler for arm on ubuntu. > Being a rookie in gcc, I have very little knowledge of it. > > I am trying to assemble the crt0.s file using the command > -desktop:~/armgcc$ arm-elf-as crt0.s > > > But what I am getting is : > > crt0.s: Assembler messages: > crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > > The lines 157,160,162,163 that are giving errors are : > str r0,[r1,#PS_PCER_OFF] > > str r0,[r1,#PIO_PER_OFF] > > str r0,[r1,#PIO_CODR_OFF] > > str r0,[r1,#PIO_OER_OFF] > > Please help me out with the cause and solution for this error.
There are unexpanded macros for the PIO port offsets. Are you sure that the source file is crt0.s and not crt0.S? -- Tauno Voipio
On Sep 28, 7:09=A0pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote:
> nik wrote: > > Hello > > > I am using gcc 4.1.1 as a cross compiler for arm on ubuntu. > > Being a rookie in gcc, I have very little knowledge of it. > > > I am trying =A0to assemble the crt0.s file using the command > > -desktop:~/armgcc$ arm-elf-as crt0.s > > > But what I am getting is : > > > crt0.s: Assembler messages: > > crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > > The lines 157,160,162,163 that are giving errors are : > > =A0str =A0 r0,[r1,#PS_PCER_OFF] > > > str =A0 r0,[r1,#PIO_PER_OFF] > > > str =A0 r0,[r1,#PIO_CODR_OFF] > > > str =A0 r0,[r1,#PIO_OER_OFF] > > > Please help me out with the cause and solution for this error. > > There are unexpanded macros for the PIO port offsets. > > Are you sure that the source file is crt0.s and not crt0.S? > > -- > > Tauno Voipio
Hello Tauno. Thanks for the reply. Sorry it was an typing mistake. Its crt0.S. But still the error is the same. ~/armgcc$ arm-elf-as crt0.S -o crt0.o crt0.S: Assembler messages: crt0.S:166: Error: internal_relocation (type: OFFSET_IMM) not fixed up crt0.S:169: Error: internal_relocation (type: OFFSET_IMM) not fixed up crt0.S:171: Error: internal_relocation (type: OFFSET_IMM) not fixed up crt0.S:172: Error: internal_relocation (type: OFFSET_IMM) not fixed up So, any suggestion ? One more question - Do i need both - startup.S and crt0.S ? Thanks. Nik.
nik wrote:
> On Sep 28, 7:09 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: >> nik wrote: >>> Hello >>> I am using gcc 4.1.1 as a cross compiler for arm on ubuntu. >>> Being a rookie in gcc, I have very little knowledge of it. >>> I am trying to assemble the crt0.s file using the command >>> -desktop:~/armgcc$ arm-elf-as crt0.s >>> But what I am getting is : >>> crt0.s: Assembler messages: >>> crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> The lines 157,160,162,163 that are giving errors are : >>> str r0,[r1,#PS_PCER_OFF] >>> str r0,[r1,#PIO_PER_OFF] >>> str r0,[r1,#PIO_CODR_OFF] >>> str r0,[r1,#PIO_OER_OFF] >>> Please help me out with the cause and solution for this error. >> There are unexpanded macros for the PIO port offsets. >> >> Are you sure that the source file is crt0.s and not crt0.S? >> >> -- >> >> Tauno Voipio > > Hello Tauno. > Thanks for the reply. > > Sorry it was an typing mistake. Its crt0.S. > But still the error is the same. > ~/armgcc$ arm-elf-as crt0.S -o crt0.o > crt0.S: Assembler messages: > crt0.S:166: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.S:169: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.S:171: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.S:172: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > So, any suggestion ? > > One more question - Do i need both - startup.S and crt0.S ?
You need a header where the PIO offset macros are #define'd, and you need to feed the source through the pre-processor. Use arm-elf-gcc to translate - it does understand to feed the source via the C pre-processor. Try this: arm-elf-gcc -c -Wa,-ahlms=crt0.lst crt0.S You'll get an assembly listing, too. -- Tauno Voipio tauno voipio (at) iki fi
On Sep 29, 11:55=A0pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote:
> nik wrote: > > On Sep 28, 7:09 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: > >> nik wrote: > >>> Hello > >>> I am using gcc 4.1.1 as a cross compiler for arm on ubuntu. > >>> Being a rookie in gcc, I have very little knowledge of it. > >>> I am trying =A0to assemble the crt0.s file using the command > >>> -desktop:~/armgcc$ arm-elf-as crt0.s > >>> But what I am getting is : > >>> crt0.s: Assembler messages: > >>> crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> The lines 157,160,162,163 that are giving errors are : > >>> =A0str =A0 r0,[r1,#PS_PCER_OFF] > >>> str =A0 r0,[r1,#PIO_PER_OFF] > >>> str =A0 r0,[r1,#PIO_CODR_OFF] > >>> str =A0 r0,[r1,#PIO_OER_OFF] > >>> Please help me out with the cause and solution for this error. > >> There are unexpanded macros for the PIO port offsets. > > >> Are you sure that the source file is crt0.s and not crt0.S? > > >> -- > > >> Tauno Voipio > > > Hello Tauno. > > Thanks for the reply. > > > Sorry it was an typing mistake. Its crt0.S. > > But still the error is the same. > > ~/armgcc$ arm-elf-as crt0.S -o crt0.o > > crt0.S: Assembler messages: > > crt0.S:166: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.S:169: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.S:171: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.S:172: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > > So, any suggestion ? > > > One more question - Do i need both - startup.S and crt0.S ? > > You need a header where the PIO offset macros are > #define'd, and you need to feed the source through > the pre-processor. > > Use arm-elf-gcc to translate - it does understand > to feed the source via the C pre-processor. > > Try this: > > =A0 =A0arm-elf-gcc -c -Wa,-ahlms=3Dcrt0.lst crt0.S > > You'll get an assembly listing, too. > > -- > > Tauno Voipio > tauno voipio (at) iki fi
Thanks Tauno. I tried the above mentioned option. But its still the same desktop:~/armgcc$ arm-elf-gcc -c -Wa,-ahlms=3Dcrt0.lst crt0.S crt0.S: Assembler messages: crt0.S:54: Error: internal_relocation (type: OFFSET_IMM) not fixed up crt0.S:55: Error: internal_relocation (type: OFFSET_IMM) not fixed up crt0.S:56: Error: internal_relocation (type: OFFSET_IMM) not fixed up crt0.S:57: Error: internal_relocation (type: OFFSET_IMM) not fixed up crt0.S:60: Error: internal_relocation (type: OFFSET_IMM) not fixed up Expecting your further help. And sorry for the double post. It was by mistake. Thanks.
nik wrote:
> On Sep 29, 11:55 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: >> nik wrote: >>> On Sep 28, 7:09 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: >>>> nik wrote: >>>>> Hello >>>>> I am using gcc 4.1.1 as a cross compiler for arm on ubuntu. >>>>> Being a rookie in gcc, I have very little knowledge of it. >>>>> I am trying to assemble the crt0.s file using the command >>>>> -desktop:~/armgcc$ arm-elf-as crt0.s >>>>> But what I am getting is : >>>>> crt0.s: Assembler messages: >>>>> crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> The lines 157,160,162,163 that are giving errors are : >>>>> str r0,[r1,#PS_PCER_OFF] >>>>> str r0,[r1,#PIO_PER_OFF] >>>>> str r0,[r1,#PIO_CODR_OFF] >>>>> str r0,[r1,#PIO_OER_OFF] >>>>> Please help me out with the cause and solution for this error. >>>> There are unexpanded macros for the PIO port offsets. >>>> Are you sure that the source file is crt0.s and not crt0.S? >>>> -- >>>> Tauno Voipio >>> Hello Tauno. >>> Thanks for the reply. >>> Sorry it was an typing mistake. Its crt0.S. >>> But still the error is the same. >>> ~/armgcc$ arm-elf-as crt0.S -o crt0.o >>> crt0.S: Assembler messages: >>> crt0.S:166: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.S:169: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.S:171: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.S:172: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> So, any suggestion ? >>> One more question - Do i need both - startup.S and crt0.S ? >> You need a header where the PIO offset macros are >> #define'd, and you need to feed the source through >> the pre-processor. >> >> Use arm-elf-gcc to translate - it does understand >> to feed the source via the C pre-processor. >> >> Try this: >> >> arm-elf-gcc -c -Wa,-ahlms=crt0.lst crt0.S >> >> You'll get an assembly listing, too. >> >> -- >> >> Tauno Voipio >> tauno voipio (at) iki fi > > Thanks Tauno. > > > I tried the above mentioned option. But its still the same > > desktop:~/armgcc$ arm-elf-gcc -c -Wa,-ahlms=crt0.lst crt0.S > crt0.S: Assembler messages: > crt0.S:54: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.S:55: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.S:56: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.S:57: Error: internal_relocation (type: OFFSET_IMM) not fixed up > crt0.S:60: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > > Expecting your further help. > > And sorry for the double post. It was by mistake.
OK - Now find the missing header file. The macros are probably in a .h file that should be #include'd into the source. Where is your source from? What is your target processor? (The offsets are for registers outside the ARM core, so the exact chip type is needed). -- Tauno Voipio tauno voipio (at) iki fi
On Sep 30, 9:26=A0pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote:
> nik wrote: > > On Sep 29, 11:55 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: > >> nik wrote: > >>> On Sep 28, 7:09 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: > >>>> nik wrote: > >>>>> Hello > >>>>> I am using gcc 4.1.1 as a cross compiler for arm on ubuntu. > >>>>> Being a rookie in gcc, I have very little knowledge of it. > >>>>> I am trying =A0to assemble the crt0.s file using the command > >>>>> -desktop:~/armgcc$ arm-elf-as crt0.s > >>>>> But what I am getting is : > >>>>> crt0.s: Assembler messages: > >>>>> crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed=
up
> >>>>> crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed=
up
> >>>>> crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed=
up
> >>>>> crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed=
up
> >>>>> The lines 157,160,162,163 that are giving errors are : > >>>>> =A0str =A0 r0,[r1,#PS_PCER_OFF] > >>>>> str =A0 r0,[r1,#PIO_PER_OFF] > >>>>> str =A0 r0,[r1,#PIO_CODR_OFF] > >>>>> str =A0 r0,[r1,#PIO_OER_OFF] > >>>>> Please help me out with the cause and solution for this error. > >>>> There are unexpanded macros for the PIO port offsets. > >>>> Are you sure that the source file is crt0.s and not crt0.S? > >>>> -- > >>>> Tauno Voipio > >>> Hello Tauno. > >>> Thanks for the reply. > >>> Sorry it was an typing mistake. Its crt0.S. > >>> But still the error is the same. > >>> ~/armgcc$ arm-elf-as crt0.S -o crt0.o > >>> crt0.S: Assembler messages: > >>> crt0.S:166: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> crt0.S:169: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> crt0.S:171: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> crt0.S:172: Error: internal_relocation (type: OFFSET_IMM) not fixed u=
p
> >>> So, any suggestion ? > >>> One more question - Do i need both - startup.S and crt0.S ? > >> You need a header where the PIO offset macros are > >> #define'd, and you need to feed the source through > >> the pre-processor. > > >> Use arm-elf-gcc to translate - it does understand > >> to feed the source via the C pre-processor. > > >> Try this: > > >> =A0 =A0arm-elf-gcc -c -Wa,-ahlms=3Dcrt0.lst crt0.S > > >> You'll get an assembly listing, too. > > >> -- > > >> Tauno Voipio > >> tauno voipio (at) iki fi > > > Thanks Tauno. > > > I tried the above mentioned option. But its still the same > > > desktop:~/armgcc$ arm-elf-gcc -c -Wa,-ahlms=3Dcrt0.lst crt0.S > > crt0.S: Assembler messages: > > crt0.S:54: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.S:55: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.S:56: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.S:57: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > crt0.S:60: Error: internal_relocation (type: OFFSET_IMM) not fixed up > > > Expecting your further help. > > > And sorry for the double post. It was by mistake. > > OK - Now find the missing header file. > > The macros are probably in a .h file that should be > #include'd into the source. > > Where is your source from? > What is your target processor? (The offsets are for > registers outside the ARM core, so the exact chip type > is needed). > > -- > > Tauno Voipio > tauno voipio (at) iki fi
Hello Tauno, Thanks for the response. The source is hand written by myself.Its just the simple code to switch pins high and low continuously. My target processor is LPC2368 by NXP. I have modified the RAM and ROM addresses according to the user manual. Thanks.
nik wrote:
> On Sep 30, 9:26 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: >> nik wrote: >>> On Sep 29, 11:55 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: >>>> nik wrote: >>>>> On Sep 28, 7:09 pm, Tauno Voipio <tauno.voi...@INVALIDiki.fi> wrote: >>>>>> nik wrote: >>>>>>> Hello >>>>>>> I am using gcc 4.1.1 as a cross compiler for arm on ubuntu. >>>>>>> Being a rookie in gcc, I have very little knowledge of it. >>>>>>> I am trying to assemble the crt0.s file using the command >>>>>>> -desktop:~/armgcc$ arm-elf-as crt0.s >>>>>>> But what I am getting is : >>>>>>> crt0.s: Assembler messages: >>>>>>> crt0.s:157: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>>>> crt0.s:160: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>>>> crt0.s:162: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>>>> crt0.s:163: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>>>> The lines 157,160,162,163 that are giving errors are : >>>>>>> str r0,[r1,#PS_PCER_OFF] >>>>>>> str r0,[r1,#PIO_PER_OFF] >>>>>>> str r0,[r1,#PIO_CODR_OFF] >>>>>>> str r0,[r1,#PIO_OER_OFF] >>>>>>> Please help me out with the cause and solution for this error. >>>>>> There are unexpanded macros for the PIO port offsets. >>>>>> Are you sure that the source file is crt0.s and not crt0.S? >>>>>> -- >>>>>> Tauno Voipio >>>>> Hello Tauno. >>>>> Thanks for the reply. >>>>> Sorry it was an typing mistake. Its crt0.S. >>>>> But still the error is the same. >>>>> ~/armgcc$ arm-elf-as crt0.S -o crt0.o >>>>> crt0.S: Assembler messages: >>>>> crt0.S:166: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> crt0.S:169: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> crt0.S:171: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> crt0.S:172: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>>>> So, any suggestion ? >>>>> One more question - Do i need both - startup.S and crt0.S ? >>>> You need a header where the PIO offset macros are >>>> #define'd, and you need to feed the source through >>>> the pre-processor. >>>> Use arm-elf-gcc to translate - it does understand >>>> to feed the source via the C pre-processor. >>>> Try this: >>>> arm-elf-gcc -c -Wa,-ahlms=crt0.lst crt0.S >>>> You'll get an assembly listing, too. >>>> -- >>>> Tauno Voipio >>>> tauno voipio (at) iki fi >>> Thanks Tauno. >>> I tried the above mentioned option. But its still the same >>> desktop:~/armgcc$ arm-elf-gcc -c -Wa,-ahlms=crt0.lst crt0.S >>> crt0.S: Assembler messages: >>> crt0.S:54: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.S:55: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.S:56: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.S:57: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> crt0.S:60: Error: internal_relocation (type: OFFSET_IMM) not fixed up >>> Expecting your further help. >>> And sorry for the double post. It was by mistake. >> OK - Now find the missing header file. >> >> The macros are probably in a .h file that should be >> #include'd into the source. >> >> Where is your source from? >> What is your target processor? (The offsets are for >> registers outside the ARM core, so the exact chip type >> is needed). >> >> -- >> >> Tauno Voipio >> tauno voipio (at) iki fi > > Hello Tauno, > > Thanks for the response. > > The source is hand written by myself.Its just the simple code to > switch pins high and low continuously. > My target processor is LPC2368 by NXP. I have modified the RAM and ROM > addresses according to the user manual.
Good. Please name it to something else than crt0.S - it is the usual name for the C runtime startup module. This time, it mislead my responses - it would have been plenty quicker, if I had known that we are talking about a self-coded module. So, go get the PIO definitions and you'll have the translated code. It is a different story whether it will work ... -- Regards, Tauno
On 1 Oct 2008 Tauno Voipio <tauno.voipio@INVALIDiki.fi> wrote:

[ EIGHTY SIX lines of quoting snipped]

[ 7 lines of reply snipped]

FFS please learn to remove anything from the previous messages you
aren't directly replying to, we've got better things to do than
scroll through it all.

---druck

-- 
The ARM Club Free Software - http://www.armclub.org.uk/free/
The 32bit Conversions Page - http://www.quantumsoft.co.uk/druck/
druck wrote:
> On 1 Oct 2008 Tauno Voipio <tauno.voipio@INVALIDiki.fi> wrote: >
(- quoting of snips clipped off -)
> FFS please learn to remove anything from the previous messages you > aren't directly replying to, we've got better things to do than > scroll through it all. > > ---druck >
Sorry - I was simply lazy, maybe pissed off by the misleading info at first. -- Tauno Voipio

The 2024 Embedded Online Conference