[okl4-developer] Help with SoC Porting
Kumar Sanghvi
divinekumar at gmail.com
Sun Sep 20 07:17:36 EST 2009
Hi Jonathan,
Thank you for pointing towards the qemu logs.
Firstly, for loading okl4image.elf in qemu-omap3 simulator, I am creating a
nand image comprising of x-loader, u-boot and okl4image.elf and then loading
that nand image in qemu-omap3 simulator.
I give below commands to create the nand image
*./bb_nandflash.sh x-load.bin.ift beagle.bin x-loader
./bb_nandflash.sh u-boot.bin beagle.bin u-boot
./bb_nandflash.sh okl4image.elf beagle.bin kernel
./bb_nandflash_ecc beagle.bin 0x0 0xe80000
*
Then I give below command to run the emulator with created nand image
*./qemu-system-arm -M beagle -mtdblock beagle.bin -serial stdio -d
in_asm,int,exec,cpu*
Once the u-boot prompt comes up, at the u-boot prompt, I type as below
*OMAP3 beagleboard.org # nand read 0x80000000 0x280000 0x400000
NAND read: device 0 offset 0x280000, size 0x400000
4194304 bytes read: OK
OMAP3 beagleboard.org # go 0x80000000
*
After entering above command, emulator exits with below message
*## Starting application at 0x80000000 ...
Internal resource leak before 80000004 *//this error message
can be co-related to 'tstvs' line in below outputs from log file*
Unassigned mem readl 00000000pc 80000004
[root at localhost arm-softmmu]#
*
Following is last 20 lines of qemu log file. I have attached the full log
file with this mail.
(Since the log file is to house target asm instructions, I believe that
start of the log file will have asm instructions generated from x-loader
code and u-boot code)
*[root at localhost arm-softmmu]#tail -20 qemu.log
0x80e862cc: mov r3, r0
0x80e862d0: push {r4, lr}
0x80e862d4: mov r0, r1
0x80e862d8: mov r1, r2
0x80e862dc: blx r3 *// I suppose that this line
corresponds to u-boot command "go 0x80000000" given at u-boot prompt*
----------------
IN:
0x80000000: undefined
----------------
IN:
0x80000004: tstvs r1, r1, lsl #2 *//cannot make out what this is and
from where it is coming from? *
0x80000008: andeq r0, r0, r0
0x8000000c: andeq r0, r0, r0
0x80000010: eoreq r0, r8, r2
0x80000014: andeq r0, r0, r1
0x80000018: undefined instruction 0xf0000000 *// this seems to be the
culprit -- need to find the cause*
*So, it seems that the okl4image.elf is not loading or the 1st instruction
at the address 0x80000000 is not being recognized.
And I believe that the 1st instruction of okl4image.elf would be from
platform/SoCXX/pistachio/src/head.spp
=======================================================================================================================================
I have even tried commenting out my soc_init code in
platform/omap3530/pistachio/src/plat.c file.
However no difference is observed.
I even tried writing directly to the serial port.....but no difference.
It seems that execution is not at all reaching the soc_init. In fact, I
suspect that even the code present in head.spp,
arch/arm/pistachio/src/start.spp, arch/arm/pistachio/src/init.cc are also
not executed.
==========================================================================================================================================
At this stage, I am suspecting below:-
1. okl4image.elf itself is not getting loaded and code of head.spp is not
executed.Something is going wrong somewhere.
2. Somewhere, my memory related calculations are wrong and the generated
okl4image.elf is not proper.
3. I am making a mistake somewhere in loading the okl4image.elf in the
qemu-omap3 simulator.
However, I have tested the okl4image.elf on Beagleboard also and its not
working.
Below is output from Beagleboard in minicom
* Texas Instruments X-Loader
1.41
Starting OS
Bootloader...
U-Boot 1.3.3 (Jul 10 2008 - 16:33:09)
OMAP3530-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle Board + LPDDR/NAND
DRAM: 128 MB
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Audio Tone on Speakers ... complete
OMAP3 beagleboard.org #
OMAP3 beagleboard.org # mmcinit;fatload mmc 0 0x80000000 image.elf;go
0x80000000
reading image.elf
331564 bytes read
## Starting application at 0x80000000 ...
*
Please advise.
Thanks,
Kumar.
On Thu, Sep 17, 2009 at 5:26 AM, Jonathan Sokolowski <jsok at ok-labs.com>wrote:
> Hi Kumar,
> The assertion errors you are seeing when not setting the physical and
> virtual memory regions correctly are perfectly normal, they are simply
> ensuring alignment is sane.
>
> You should be able to determine the correct physical region/s from your
> board's datasheets.
>
> Also note that when setting base_vaddr, it should be identical to the base
> of your virtual region!
>
> As for the bad register writes, the address looks like some device exists
> at that physical address. Maybe check your datasheet for some hints?
>
> I would suggest the following to begin debugging:
> 1) If you qemu has some logging or execution tracing available, turn it on
> and analyse the trace.
> 2) Do some low-level serial printing from within the kernel, i.e. writing
> directly to serial registers.
>
> Hope this helps,
> Jonathan Sokolowski
>
> On 17/09/2009, at 9:06 AM, Kumar Sanghvi wrote:
>
> Hi All,
>
> I need some help with SoC porting part.
> I have written some code for OKL4 3.0 port for Beagleboard. The code is
> compiling fine and generating images.
> I try to load the image in Qemu-omap3 simulator and it exits with below
> error message:-
> "Unassigned mem writew 48070008 = 0xffff pc 80e9b298"
>
> I try to load the image on Beagleboard and nothing comes on serial
> terminal.
>
> It is very possible that my serial code is not written correctly. But,
> since the simulator is exiting with some memory related messages, I am
> doubtful if I have set the parameters for
> -memory[physical], memory[virtual] and vbase_address correctly.
>
>
>
> Following is the build command-line. The below error message comes if I
> don't specify or wrongly specify values for memory[virtual] and
> vbase_address in arch/arm/tools/machines.py for the cortexa8 definition:-
>
> ========================================================================================================================================================
> [root at localhost okl4_3.0-armv6]# ./tools/build.py MACHINE=beagle
> PROJECT=examples EXAMPLE=hello TOOLCHAIN=gnu_arm_eabi_toolchain
> pistachio.TOOLCHAIN=gnu_arm_toolchain PYFREEZE=false kdb_serial=true
> kdb_breakin=false debug_trace=5 verbose_init=true
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> [ELF ] build/images/image.elf
> Error:
> Now printing a traceback.
>
> Traceback (most recent call last):
> File "tools/pyelf/elfweaver.py", line 79, in ?
> main(sys.argv)
> File
> "/home/kumar/Hypervisor/OKL/experimental-okl4-30-beagleboard-porting/okl4_3.0-armv6/tools/pyelf/weaver/main.py",
> line 108, in main
> __commands__[args[1]](args[2:])
> File
> "/home/kumar/Hypervisor/OKL/experimental-okl4-30-beagleboard-porting/okl4_3.0-armv6/tools/pyelf/weaver/merge.py",
> line 270, in merge_cmd
> merge(spec_file, options)
> File
> "/home/kumar/Hypervisor/OKL/experimental-okl4-30-beagleboard-porting/okl4_3.0-armv6/tools/pyelf/weaver/merge.py",
> line 166, in merge
> namespace, image)
> File
> "/home/kumar/Hypervisor/OKL/experimental-okl4-30-beagleboard-porting/okl4_3.0-armv6/tools/pyelf/weaver/merge.py",
> line 103, in collect_image_objects
> pool.collect_xml(el, machine, pools)
> File
> "/home/kumar/Hypervisor/OKL/experimental-okl4-30-beagleboard-porting/okl4_3.0-armv6/tools/pyelf/weaver/pools.py",
> line 128, in collect_xml
> pools.add_physical_memory(self.name, machine, src=src, base=base,
> size=size)
> File
> "/home/kumar/Hypervisor/OKL/experimental-okl4-30-beagleboard-porting/okl4_3.0-armv6/tools/pyelf/weaver/pools.py",
> line 574, in add_physical_memory
> self.physical_pools[physpool].add_memory(base, size, mem_type)
> File
> "/home/kumar/Hypervisor/OKL/experimental-okl4-30-beagleboard-porting/okl4_3.0-armv6/tools/pyelf/weaver/allocator.py",
> line 352, in add_memory
> assert size % self.min_alloc == 0
> AssertionError
>
> scons: *** [build/images/image.elf] Error 1
> scons: building terminated because of errors.
>
> ========================================================================================================================================================
>
> I then set the following values and build compiles fine generating image
>
> =>platform/omap3530/tools/machines.py:
> memory[physical] = [Region(0x80000000, 0x82000000)]
>
> =>arch/arm/tools/machines.py
> class armv7(arm):
> memory = arm.memory.copy()
> #memory['virtual'] = [Region(0x1000, 0xe0000000)] # Trap NULL pointer
> derefs.
> base_vaddr = 0x10000000
> memory['virtual'] = [Region(0x1000, 0xd0000000)] # Trap NULL pointer
> derefs.
> #memory['virtual'] = [Region(0x80000000, 0xd0000000)] # Trap NULL
> pointer derefs.
> #memory['virtual'] = [Region(0x1000, 0xe0000000)] # Trap NULL pointer
> derefs.
>
> class armv7a(armv7):
> cpp_defines = armv7.cpp_defines + [("__ARMv__", 7), "__ARMv7A__"]
> arch_version = 7
>
> class cortexa8(armv7a):
> c_flags = armv7a.c_flags
> cpu = "cortexa8"
>
>
>
> ======================================================================================================================================================================
> I have attached readelf output for the generated elf image with this mail.
>
>
>
> =======================================================================================================================================================================
>
> Below is sequence of output from qemu-omap3 simulator
>
> omap3-sim output:-
>
> omap_venc_write: Bad register 0x48050c00
> omap_venc_write: Bad register 0x48050c04
> omap_venc_write: Bad register 0x48050c8c
> omap_venc_write: Bad register 0x48050c98
> omap_venc_write: Bad register 0x48050c9c
> omap_venc_write: Bad register 0x48050cac
> omap_venc_write: Bad register 0x48050cbc
> omap_venc_write: Bad register 0x48050cc0
> omap_diss_write: Bad register 0x48050044
> omap_diss_write: Bad register 0x48050048
> omap_diss_write: Read-only register 0x48050050
> omap_diss_write: Read-only register 0x48050058
> omap_disc_write: Bad register 0x48050414
> omap_disc_write: Bad register 0x480504a8
>
> At this point, u-boot prompt is available and I give below command at
> u-boot prompt:-
> beagleboard#mmcinit;fatload mmc 0 80000000 image.elf;go 80000000
>
> The simulator simply exits with below line:-
> Unassigned mem writew 48070008 = 0xffff pc 80e9b298 //This error message might indicate something
> [root at localhost arm-softmmu]#
>
>
> ==============================================================================================================================================================
>
>
> So, at this point, below are some possible failure points:-
> 1. Parameters for memory[physical],memory[virtual] and base_vaddress are
> wrongly given, so memory layout is not proper in the generated elf file.
> 2. u-boot arguments given are wrong.
> 3. Serial code written in platform/omap3530/pistachio/kdb/console.c is
> wrong, as nothing is coming on screen.
> 4. If serial code is fine, and considering that build is made with
> 'verbose_init=true', atleast some output should come from
> arch/arm/pistachio/src/init.cc file.
> But as nothing is coming on screen, not sure what is happenning.
>
> Really not able to make out where to start debugging / troubleshooting at
> this point.
> Please help with any suggestions / advise.
>
> Thanks,
> Kumar.
> <Beagle-readelf-output.rtf>_______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20090920/0570dfec/attachment-0001.htm
More information about the Developer
mailing list