Skip to contentSkip to conversation

Basics -- what tools for Walnut?

DISCUSSION Dave Strout 6 participants 9 messages Jun 5, 2002 – Jun 6, 2002

lore
Share & tools
lore
#0 lore raw

I think I'm missing a basic concept here -- I'm about to do some work on a Walnut system, so I started by loading up the HardHat Linux that came with the Walnut onto my intel desktop, then grabbing the linuxppc_2_4_devel kernel via rsync. When I try to compile, gas startes to complain about "unknown option '-m405'".

I tried running /opt/hardhat/devkit/ppc/4xx/bin/ppc_4xx-as -m405, and sure enough, it doesn't know the 405. Nor does the gas that I built from binutils 2.10.1 with --target-powerpc.

So, is there a patch I should be applying before building the cross-compile environment, or a specific set of tools somewhere, or what am I missing?

thanks,
dave.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw

The version of HardHat Linux that came with your walnut was created to match the requirements of the kernel also shipped with Hard Hat Linux.

The current _devel kernel requires a newer version of binutils that understands the -m405 architecture. Either use the kernel shipped w/ Hard Hat Linux, or you will need to get a newer tool chain. (Either build it yourself or purchase it from MontaVista...)

--Mark
(Speaking for myself, not MontaVista whom I work for.)

Quoted 11 lines · Dave Strout

I think I'm missing a basic concept here -- I'm about to do some work on a Walnut system, so I started by loading up the HardHat Linux that came with the Walnut onto my intel desktop, then grabbing the linuxppc_2_4_devel kernel via rsync. When I try to compile, gas startes to complain about "unknown option '-m405'".

I tried running /opt/hardhat/devkit/ppc/4xx/bin/ppc_4xx-as -m405, and sure enough, it doesn't know the 405. Nor does the gas that I built from binutils 2.10.1 with --target-powerpc.

Quoted 7 lines

So, is there a patch I should be applying before building the cross-compile environment, or a specific set of tools somewhere, or what am I missing?

thanks,
dave.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to Dave Strout
Quoted 7 lines · Dave Strout

I think I'm missing a basic concept here -- I'm about to do some work on a Walnut system, so I started by loading up the HardHat Linux that came with the Walnut onto my intel desktop, then grabbing the linuxppc_2_4_devel kernel via rsync. When I try to compile, gas startes to complain about "unknown option '-m405'".

Quoted 7 lines

I tried running /opt/hardhat/devkit/ppc/4xx/bin/ppc_4xx-as -m405, and sure enough, it doesn't know the 405. Nor does the gas that I built from binutils 2.10.1 with --target-powerpc.

So, is there a patch I should be applying before building the cross-compile environment, or a specific set of tools somewhere, or what am I missing?

I suspect that is a fairly old tool chain that you are using. Try modifying arch/ppc/Makefile to use

-mcpu=403

instead of

-mcpu=405

If you subscribe to the MontaVista product, the current compiler will work properly with linuxppc_2_4_devel.

-Frank
--
Frank Rowand <[email protected]>
MontaVista Software, Inc

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 1 line · Frank Rowand

I suspect that is a fairly old tool chain that you are using.

In the past, the practice was to inform people when changes were made that required a minimum revision of tools to operate properly. Simply telling people "your toolchain is too old" isn't helpful..... What version of tools is required to build this properly? Why doesn't the check in comment indicate this information when the change was made?

Quoted 3 lines

Try modifying arch/ppc/Makefile to use

-mcpu=403

Or, just remove it since it doesn't perform any useful function. On the newer tools, it's required to allow the assembler to not bitch about 4xx unique instructions, another non-useful function, IMHO.

Thanks.

	-- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#4 lore raw

It's all good -- I didn't realize there was a newer binutils. 2.12 seems to do the trick

thanks,
dave.

Quoted 18 lines · Dan Malek
Quoted 1 line · Frank Rowand

I suspect that is a fairly old tool chain that you are using.

In the past, the practice was to inform people when changes were made that required a minimum revision of tools to operate properly. Simply telling people "your toolchain is too old" isn't helpful..... What version of tools is required to build this properly? Why doesn't the check in comment indicate this information when the change was made?

Quoted 3 lines

Try modifying arch/ppc/Makefile to use

-mcpu=403

Quoted 10 lines

Or, just remove it since it doesn't perform any useful function. On the newer tools, it's required to allow the assembler to not bitch about 4xx unique instructions, another non-useful function, IMHO.

Thanks.

    -- Dan

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#5 lore raw
In reply to Dave Strout
Quoted 6 lines · In message <[email protected]> you wrote:

I think I'm missing a basic concept here -- I'm about to do some work on a Walnut system, so I started by loading up the HardHat Linux that came with the Walnut onto my intel desktop, then grabbing the linuxppc_2_4_devel kernel via rsync. When I try to compile, gas startes to complain about "unknown option '-m405'".

...

Quoted 3 lines

So, is there a patch I should be applying before building the cross-compile environment, or a specific set of tools somewhere, or what am I missing?

Have a look at our ELDK, see http://www.denx.de/ELDK/

We support a couple of 405 boards (although the walnut is not one of those).

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected]
"Faith: not *wanting* to know what is true." - Friedrich Nietzsche

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#6 lore raw

Can compile, now on to booting

Thanks all for the help with the toolchain -- I'm now cranking out ppc code.

Now to boot. What I'm actually trying to do is replace a VxWorks environment on one of my companies products with Linux. The unit is 405GP based, and pretty close to a walnut, as far as I can tell (comparing the mem map in the docs with the 405gp.h file in the kernel). I'm hoping to get away with using the existing boot monitor, at least in the short term. The monitor has the ability to load an ELF executable & jump to it, but I'm not getting very far beyond that -- in fact it crashes with the pc at the first instruction. I've tried my freshly-built 2.4.18 kernel, and the ppcboot executable, and they both crash on the first instruction.

I don't have a hardware debugger for this, so I'm sort of at a loss. There are some LED's on the front that I could try & write some asm to blink as I go along, but since I hang on the first instruction, I'm not sure that would help.......

All thoughts greatly appreciated.

dave.

Dumps:

Linux:
ftp 134.141.133.254:vmlinux to SDRAM size=1430968
Booting system S/W at entry 0xc0000000
Starting at 0xc0000000...

program
Exception current instruction address: 0xc0000000
Machine Status Register: 0x00029200
Condition Register: 0x24200082
Task: 0x1f1a8e0 "tBoot"

r0 = c034dc sp = 1f1a4d0 r2 = 0 r3
= 0
r4 = 1f80000 r5 = 1f1a8e0 r6 = 29200 r7 =
1200
r8 = 20 r9 = ca0000 r10 = 4 r11
= 0
r12 = 0 r13 = 0 r14 = 0 r15
= 0
r16 = 0 r17 = 0 r18 = 0 r19
= 0
r20 = 0 r21 = 0 r22 = 0 r23
= 0
r24 = 0 r25 = 0 r26 = 0 r27 =
ca0000
r28 = ca0000 r29 = c0000000 r30 = 1ffffc8 r31 =
c0000000
msr = 29200 lr = c034e4 ctr = 0 pc =
c0000000
cr = 24200082 xer = 0

ppcboot:

ftp 134.141.133.254:ppcboot to SDRAM size=186232 + 4 Booting system S/W at entry 0xfff80000 Starting at 0xfff80000...

program
Exception current instruction address: 0xfff80000
Machine Status Register: 0x00029200
Condition Register: 0x24200082
Task: 0x1f1a8e0 "tBoot"

r0 = c034dc sp = 1f1a4d0 r2 = 0 r3
= 0
r4 = 1f80000 r5 = 1f1a8e0 r6 = 29200 r7 =
1200
r8 = 20 r9 = ca0000 r10 = 4 r11
= 0
r12 = 0 r13 = 0 r14 = 0 r15
= 0
r16 = 0 r17 = 0 r18 = 0 r19
= 0
r20 = 0 r21 = 0 r22 = 0 r23
= 0
r24 = 0 r25 = 0 r26 = 0 r27 =
ca0000
r28 = ca0000 r29 = fff80000 r30 = 1ffffc8 r31 =
fff80000
msr = 29200 lr = c034e4 ctr = 0 pc =
fff80000
cr = 24200082 xer = 0

Objdump says:
[dstrout@dstrout dstrout]$ ~/tools/bin/powerpc-linux-objdump -D ppcboot | head -20

ppcboot: file format elf32-powerpc

Disassembly of section .resetvec:

fffffffc <.resetvec>:
fffc: 4b f8 01 04 b fff80100 <_start>
Disassembly of section .text:

fff80000 <version_string-0x4>:
fff80000: 27 05 19 56 dozi r24,r5,6486

fff80004 <version_string>:

fff80004:    50 50 43 42     rlwimi    r16,r2,8,13,1
fff80008:    6f 6f 74 20     xoris    r15,r27,29728
fff8000c:    31 2e 31 2e     addic    r9,r14,12590
fff80010:    35 20 28 4a     addic.    r9,r0,10314
fff80014:    75 6e 20 20     andis.    r14,r11,8224
fff80018:    35 20 32 30     addic.    r9,r0,12848
fff8001c:    30 32 20 2d     addic    r1,r18,8237

[dstrout@dstrout dstrout]$ ~/tools/bin/powerpc-linux-objdump -D vmlinux | head -20

vmlinux: file format elf32-powerpc

Disassembly of section .text:

c0000000 <_start>:

c0000000:    7c 7f 1b 78     mr    r31,r3
c0000004:    7c 9e 23 78     mr    r30,r4
c0000008:    7c bd 2b 78     mr    r29,r5
c000000c:    7c dc 33 78     mr    r28,r6
c0000010:    7c fb 3b 78     mr    r27,r7
c0000014:    3b 00 00 00     li    r24,0
c0000018:    48 00 23 49     bl    c0002360 <initial_mmu>

c000001c <turn_on_mmu>:

c000001c:    38 00 10 32     li    r0,4146
c0000020:    7c 1b 03 a6     mtsrr1    r0
c0000024:    3c 00 c0 00     lis    r0,-16384
c0000028:    60 00 22 c0     ori    r0,r0,8896
c000002c:    7c 1a 03 a6     mtsrr0    r0

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#7 lore raw

Re: Can compile, now on to booting

I did this once on a mpc860 board. It involved running the uncompressed kernel image through vxhack.c from Dan Malek with a few fixes since the segments seemed to have moved around. The VxWorks loader would then load the hacked image through bootp or tftp. I also had to have one of the Linux bootloader files initialize a bd_t structure. I was able to poke around in memory and find where the VxWorks loader was keeping the environment.

Don

Quoted 132 lines · Dave Strout

Thanks all for the help with the toolchain -- I'm now cranking out ppc code.

Now to boot. What I'm actually trying to do is replace a VxWorks environment on one of my companies products with Linux. The unit is 405GP based, and pretty close to a walnut, as far as I can tell (comparing the mem map in the docs with the 405gp.h file in the kernel). I'm hoping to get away with using the existing boot monitor, at least in the short term. The monitor has the ability to load an ELF executable & jump to it, but I'm not getting very far beyond that -- in fact it crashes with the pc at the first instruction. I've tried my freshly-built 2.4.18 kernel, and the ppcboot executable, and they both crash on the first instruction.

I don't have a hardware debugger for this, so I'm sort of at a loss. There are some LED's on the front that I could try & write some asm to blink as I go along, but since I hang on the first instruction, I'm not sure that would help.......

All thoughts greatly appreciated.

dave.

Dumps:

Linux:
ftp 134.141.133.254:vmlinux to SDRAM size=1430968
Booting system S/W at entry 0xc0000000
Starting at 0xc0000000...

program
Exception current instruction address: 0xc0000000
Machine Status Register: 0x00029200
Condition Register: 0x24200082
Task: 0x1f1a8e0 "tBoot"

r0 = c034dc sp = 1f1a4d0 r2 = 0 r3
= 0
r4 = 1f80000 r5 = 1f1a8e0 r6 = 29200 r7 =
1200
r8 = 20 r9 = ca0000 r10 = 4 r11
= 0
r12 = 0 r13 = 0 r14 = 0 r15
= 0
r16 = 0 r17 = 0 r18 = 0 r19
= 0
r20 = 0 r21 = 0 r22 = 0 r23
= 0
r24 = 0 r25 = 0 r26 = 0 r27 =
ca0000
r28 = ca0000 r29 = c0000000 r30 = 1ffffc8 r31 =
c0000000
msr = 29200 lr = c034e4 ctr = 0 pc =
c0000000
cr = 24200082 xer = 0

ppcboot:

ftp 134.141.133.254:ppcboot to SDRAM size=186232 + 4 Booting system S/W at entry 0xfff80000 Starting at 0xfff80000...

program
Exception current instruction address: 0xfff80000
Machine Status Register: 0x00029200
Condition Register: 0x24200082
Task: 0x1f1a8e0 "tBoot"

r0 = c034dc sp = 1f1a4d0 r2 = 0 r3
= 0
r4 = 1f80000 r5 = 1f1a8e0 r6 = 29200 r7 =
1200
r8 = 20 r9 = ca0000 r10 = 4 r11
= 0
r12 = 0 r13 = 0 r14 = 0 r15
= 0
r16 = 0 r17 = 0 r18 = 0 r19
= 0
r20 = 0 r21 = 0 r22 = 0 r23
= 0
r24 = 0 r25 = 0 r26 = 0 r27 =
ca0000
r28 = ca0000 r29 = fff80000 r30 = 1ffffc8 r31 =
fff80000
msr = 29200 lr = c034e4 ctr = 0 pc =
fff80000
cr = 24200082 xer = 0

Objdump says:
[dstrout@dstrout dstrout]$ ~/tools/bin/powerpc-linux-objdump -D ppcboot | head -20

ppcboot: file format elf32-powerpc

Disassembly of section .resetvec:

fffffffc <.resetvec>:
fffc: 4b f8 01 04 b fff80100 <_start>
Disassembly of section .text:

fff80000 <version_string-0x4>:
fff80000: 27 05 19 56 dozi r24,r5,6486

fff80004 <version_string>:

fff80004:    50 50 43 42     rlwimi    r16,r2,8,13,1
fff80008:    6f 6f 74 20     xoris    r15,r27,29728
fff8000c:    31 2e 31 2e     addic    r9,r14,12590
fff80010:    35 20 28 4a     addic.    r9,r0,10314
fff80014:    75 6e 20 20     andis.    r14,r11,8224
fff80018:    35 20 32 30     addic.    r9,r0,12848
fff8001c:    30 32 20 2d     addic    r1,r18,8237

[dstrout@dstrout dstrout]$ ~/tools/bin/powerpc-linux-objdump -D vmlinux | head -20

vmlinux: file format elf32-powerpc

Disassembly of section .text:

c0000000 <_start>:

c0000000:    7c 7f 1b 78     mr    r31,r3
c0000004:    7c 9e 23 78     mr    r30,r4
c0000008:    7c bd 2b 78     mr    r29,r5
c000000c:    7c dc 33 78     mr    r28,r6
c0000010:    7c fb 3b 78     mr    r27,r7
c0000014:    3b 00 00 00     li    r24,0
c0000018:    48 00 23 49     bl    c0002360 <initial_mmu>
Quoted 9 lines

c000001c <turn_on_mmu>:

c000001c:    38 00 10 32     li    r0,4146
c0000020:    7c 1b 03 a6     mtsrr1    r0
c0000024:    3c 00 c0 00     lis    r0,-16384
c0000028:    60 00 22 c0     ori    r0,r0,8896
c000002c:    7c 1a 03 a6     mtsrr0    r0

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#8 lore raw

Re: Can compile, now on to booting

Ahhh -- I was hoping that somebody would have some thoughts like that. Could someone send me a copy of vxhack.c ? The link in the FAQ ( ftp://ftp.mvista.com/pub/Area51/ppc-8xx/vxhack.c ) doesn't have anything anymore....

thanks,
dave.

Quoted 10 lines · Donald White

I did this once on a mpc860 board. It involved running the uncompressed kernel image through vxhack.c from Dan Malek with a few fixes since the segments seemed to have moved around. The VxWorks loader would then load the hacked image through bootp or tftp. I also had to have one of the Linux bootloader files initialize a bd_t structure. I was able to poke around in memory and find where the VxWorks loader was keeping the environment.

Don

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/