Skip to contentSkip to conversation

What mkimage arguments for standalone AVR32 app?

U-Boot Jesper Vestergaard 2 participants 4 messages May 5, 2009

lore
Share & tools
lore
#0 lore raw

Hi list

I'm trying to create a standalone application for the ICnova ap7000 Base and have compiled this little application:

#include <avr32/io.h>

int main( void )
{
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");

while(1)

   {
      ;
   }

return 0;
}

To create the header file for it I use this mkimage command:

mkimage -A avr32 -O u-boot -T standalone -C none -a 0x11000000 -e 0x11000000 -n "myapp" -d test.bin test_uboot.bin

but when i try to execute it i get this error:

ICnova> tftp 11000000 test_uboot.bin
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) Using macb0 device
TFTP from server 192.168.18.38; our IP address is 192.168.18.145 Filename 'test_uboot.bin'.
Load address: 0x11000000
Loading: #
done
Bytes transferred = 74 (4a hex)
ICnova> bootm 11000000
## Booting image at 11000000 ...

   Image Name:   myapp
   Image Type:   AVR32 U-Boot Standalone Program (uncompressed)
   Data Size:    10 Bytes =  0 kB

Load Address: 11000000
Entry Point: 11000000
Verifying Checksum ... OK
XIP Standalone Application ... OK

*** Unhandled exception 13 at PC=0x11000002
MMU exception at address 0xffffffff

   pc: 11000002    lr: 13fe87c2    sp: 13fa0b30   r12: 00000001
  r11: 13fa0ea8   r10: 13fa0b30    r9: 00000061    r8: 11000000
   r7: 13fff420    r6: 13ff9e78    r5: 13fa0f30    r4: 11000040
   r3: 00000001    r2: 11000000    r1: 00000002    r0: 13fa0ea4

Flags: qvnzc
Mode bits: hrje....g
CPU Mode: Supervisor

Stack: (0x13fa0b30 to 0x13fa0fcc)

0b20: 00000000 13ff9ab8 11000040
00000001
0b40: 13ff4ba4 11000000 00fe82d2 00fe82d3 00fe82d4 00fe82d5 13fec0f2 13ff9ab8
0b60: 13ff9e78 13fa0fa0 0000000a 13fe7cc6 00000002 13ff9e78 13fa0fa0 13fe8524
0b80: 13ff9ab8 000000f2 13fa0cb2 00000000 00000000 13fa0db2 00000001 00000000
0ba0: 00000000 00fe82e9 00fe82ea 00fe82eb 00fe82ec 00fe82ed 00fe82ee 00fe82ef
0bc0: 00fe82f0 00fe82f1 00fe82f2 00fe82f3 00fe82f4 00fe82f5 00fe82f6 00fe82f7
0be0: 00fe82f8 00fe82f9 00fe82fa 00fe82fb 00fe82fc 00fe82fd 00fe82fe 00fe82ff
0c00: 00fe8300 00fe8301 00fe8302 00fe8303 00fe8304 00fe8305 00fe8306 00fe8307
0c20: 00fe8308 00fe8309 00fe830a 00fe830b 00fe830c 00fe830d 00fe830e 00fe830f
0c40: 00fe8310 00fe8311 00fe8312 00fe8313 00fe8314 00fe8315 00fe8316 00fe8317
0c60: 00fe8318 00fe8319 00fe831a 00fe831b 00fe831c 00fe831d 00fe831e 00fe831f
0c80: 00fe8320 00fe8321 00fe8322 00fe8323 00fe8324 00fe8325 00fe8326 00fe8327
0ca0: 00fe8328 626f6f74 6d003131 30303030 30300065 73745f75 626f6f74 2e62696e
0cc0: 00fe8330 00fe8331 00fe8332 00fe8333 00fe8334 00fe8335 00fe8336 00fe8337
0ce0: 00fe8338 00fe8339 00fe833a 00fe833b 00fe833c 00fe833d 00fe833e 00fe833f
0d00: 00fe8340 00000000 00000020 13ff8338 33fe8344 00fe8345 00fe8346 00fe8347
0d20: 00fe8348 00fe8349 00fe834a 00fe834b 00fe834c 00fe834d 00fe834e 00fe834f
0d40: 13fe77c6 0000000a 13ff9e78 13fa0fa0 00000003 13fe77e8 13fa0dcf 13ff9e78
0d60: 13fa0fa0 00000003 13fec2f2 13fa0f00 13ff9e78 13fa0fa0 00000003 13fec350
0d80: 13fa0f00 13ff9e78 13fa0fa0 00000003 13fec372 13fa0f00 13ff9e78 13fa0fa0
0da0: 00000003 626f6f74 6d203131 30303030 30300065 73745f75 626f6f74 2e62696e
0dc0: 0020696e 20332073 65636f6e 64730a00 13ff9e78 13fa0fa0 00000002 6d616362
0de0: 3000c350 13fb9060 13ff9e78 13fa0fa0 00000001 13fec372 13fb9060 13ff9e78
0e00: 13fa0fa0 00000001 73657269 616c0a00 00000002 13fec372 13fa0fcc 13ff9e78
0e20: 00000000 00000020 13ff8338 3023303a 20313030 30303030 13fe77e8 13ff90bb
0e40: 13ff9e78 13fa0fa0 13fe77c6 0000000a 13ff9e78 13fa0fa0 13fff320 13fe77e8
0e60: 13ff8bea 13ff9e78 13fa0fa0 13fff320 13fec2f2 13fff32e 13ff9e78 13fa0fa0
0e80: 13fff320 13fec350 13fff32e 13ff9e78 13fa0fa0 13fff320 13fe7934 13fff32e
0ea0: 13ff9e78 13fa0ca4 13fa0caa 00000000 0000000e 13fe79fa 00000001 13ff9e78
0ec0: 13fa0fa0 00000003 13fe7ee0 00000001 13ff9e78 13fa0fa0 00000003 13fa0f34
0ee0: 00000001 00000001 195a3c25 00000000 00518b25 00000000 195a3c25 13fa901c
0f00: 13ff7cc8 00000001 00000001 00000000 00000000 00000001 13ff3c38 00000001
0f20: 00000000 00000000 00000000 00000000 20fa0fa0 00000002 13fec2f2 13fa0fcc
0f40: 13ff9e78 001fe500 09140002 13fa90a3 13fe5466 13fa0fcc 13ff9e78 13fa0fa0
0f60: 00000002 13fa0fcc 13ffaaa0 13ffaaac 13ffaaa8 13fe50c4 04000000 13ff9e78
0f80: 24007fb4 00000002 c5a5300c 13ff0c00 00000000 13ffaaac 00000000 00000000
0fa0: 13fa0fcc 00000003 0001c200 13fa0fa0 00000001 13fe5000 13fa9014 00000001
0fc0: 08583b00 13fb9170
00fe83f2
Unhandled exception

What could be wrong?

#1 lore raw
Quoted 2 lines · On Tuesday 05 May 2009 04:55:44 Jesper Vestergaard wrote:

mkimage -A avr32 -O u-boot -T standalone -C none -a 0x11000000 -e 0x11000000 -n "myapp" -d test.bin test_uboot.bin

the entry/load addresses need to match reality. you cant pick them out of the air without properly setting them everywhere.

you also didnt say how you compiled/linked the standalone code ... you must be sure to not use any files/libraries/toolchain that expect an operating system (like Linux).

Quoted 4 lines

ICnova> tftp 11000000 test_uboot.bin
ICnova> bootm 11000000
Load Address: 11000000
Entry Point: 11000000

you shoulud not load (tftp) the bootable image to the same address that it will be uncompressing to (load address).

really you should read doc/README.standalone and the simple examples in examples/ instead of trying random commands.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090505/ca226833/attachment.pgp

#2 lore raw
Quoted 6 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 05 May 2009 04:55:44 Jesper Vestergaard wrote:

mkimage -A avr32 -O u-boot -T standalone -C none -a 0x11000000 -e 0x11000000 -n "myapp" -d test.bin test_uboot.bin

Quoted 7 lines

the entry/load addresses need to match reality. you cant pick them out of the air without properly setting them everywhere.

you also didnt say how you compiled/linked the standalone code ... you must be sure to not use any files/libraries/toolchain that expect an operating system (like Linux).

Here's how i compiled it:
avr32-gcc -O2 -Wall -c -fmessage-length=0 -mpart=ap7000 -ffunction-sections -o test.o test.c
avr32-ld test.o -e 0x00000000 -T simple.lds -o test.out avr32-objcopy -O binary test.out test.bin

And the simple.lds:
SECTIONS
{
. = 0x11000000;
/*. = 0x00000000; */
.text : { *(.text) }
/* . = 0x8000000; */
.data : { *(.data) }
.bss : { *(.bss) }
}

and a objectdump:

avr32-objdump -d test.out

test.out: file format elf32-avr32

Disassembly of section .text.main:

11000000 <main>:

11000000:    d7 03           nop
11000002:    d7 03           nop
11000004:    d7 03           nop
11000006:    d7 03           nop
11000008:    c0 08           rjmp    11000008 <main+0x8>
Quoted 6 lines
Quoted 6 lines

ICnova> tftp 11000000 test_uboot.bin
ICnova> bootm 11000000
Load Address: 11000000
Entry Point: 11000000

Quoted 7 lines

you shoulud not load (tftp) the bootable image to the same address that it will be uncompressing to (load address).

really you should read doc/README.standalone and the simple examples in examples/ instead of trying random commands.
-mike

According to the Makefile in the example directory i should load the binary to 0x00000000

    ifeq ($(ARCH),avr32)
    LOAD_ADDR = 0x00000000
    endif

but looking at the uboot startup it says that the flash is placed at that address and that the SDRAM is placed at 0x10000000.
Flash: 8 MB at address 0x00000000
SDRAM: 64 MB at address 0x10000000

Which of the addresses should i use?

I couldn't find any documentation about what entry address i should use for the avr32 but according to the README.standalone it is only the power pc which needs a entry address different from the load address so i guess load address=entry address.

#3 lore raw
Quoted 11 lines · On Tuesday 05 May 2009 06:05:19 Jesper Vestergaard wrote:

According to the Makefile in the example directory i should load the binary to 0x00000000

    ifeq ($(ARCH),avr32)
    LOAD_ADDR = 0x00000000
    endif

but looking at the uboot startup it says that the flash is placed at that address and that the SDRAM is placed at 0x10000000.
Flash: 8 MB at address 0x00000000
SDRAM: 64 MB at address 0x10000000

Which of the addresses should i use?

someone who actually knows/uses AVR32 will have to answer
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090505/53003bab/attachment.pgp