BSP: Startup Code Woes....

I am having problems with my BSP, specifically the IPL handoff to the Startup code. The IPL finds the code in our flash, i.e. finds the signature, checksums startup correctly, copies it over to RAM, and then attempts to jump to startup_hdr.startup_vaddr. I then get an Undefined Instruction Exception. It appears that it is attempting to jump to incorrect code address. Perhaps mkifs is stuffing the wrong value in for startup_vaddr. I am not sure what is going on.

Shown below is my link file:

TARGET(elf32-littlearm)

OUTPUT_FORMAT(elf32-littlearm)

ENTRY(_start)

MEMORY

{

        stack    :           ORIGIN = 0x800000,      LENGTH = 0x1000

        ram                   :           ORIGIN = 0x801000,      LENGTH = 0x2000000

        rom                   :           ORIGIN = 0x00000000,     LENGTH = 0x800000

}

SECTIONS

{

        .text : {  *(.text)

                                            *(.rodata*)

                                            *(.glue_7)

                                            *(.glue_7t)

                                } > rom

        _etext = .;

        .data : { *(.data)

                                            *(.sdata)

                                } > ram

        .bss  : {

                                            *(.bss)

                                            *(.sbss)

                                } > ram

}

Additionally, here is my mkflashimage script:

#!/bin/sh

script to generate binary IPL for dbpxa270dp board

convert IPL to binary, pad to 4k

${QNX_HOST}/usr/bin/ntoarm-objcopy -Obinary …/install/armle/boot/sys/ipl-dbpxa270dp ipl_tmp

mkrec -r -ffull -s1M ipl_tmp > ipl-dbpxa270dp.bin

Concatenate the ipl on to the image filesystem

cat ipl-dbpxa270dp.bin ifs-dbpxa270dp.bin > ipl-ifs-dbpxa270dp.bin

clean up

rm -f ipl-tmp

Thanks,

mkifs doesn’t just make something up and stuff it into vaddr. It puts what you tell it to there. You provided a bunch of data none of which is relevant to the build file (which is where you instruct mkifs as to the final image address). You need to provide the contents of your build file and a description of you memory layout (i.e. flash address range/RAM address range).

Also, as I mentioned earlier, if the image is compressed and you copy it to the address that you supplied in the build file it won’t work since the decompression code will overwrite itself as it decompresses the image. If the image is compressed, then you probably don’t need to relocate it to RAM; just make sure that the image address is correct for the RAM and the decompression code will locate the image (at the specified address) as it is decompressed.