[E3-hacking] Adding write support to pbltool

mark mark at xenon-computing.com
Sun Jan 29 01:39:32 GMT 2006


Mark Underwood wrote:
> --- Jonathan McDowell <noodles at earth.li> wrote:
> 
>> On Sat, Jan 28, 2006 at 01:09:06AM +0000, David Given wrote:
>>> On Friday 27 January 2006 23:16, Jonathan McDowell wrote:
>>> [...]
>>>> I haven't looked at the code, but my notes say NOR flash is at 0x0,
>>>> SDRAM is at 0x10000000 and SRAM is at 0x20000000.
>>> That's different from the E2. Do you know if the jump-to opcode works
>>> on the E2's version of pbl? Because while pblq can write to RAM and
>>> flash, it can't execute anything.
>> I believe you can jump to code in SRAM, but not SDRAM. So you'd load
>> your kernel into SDRAM, load a small piece of setup code into SRAM and
>> jump to that. It would setup registers as appropriate and jump to the
>> kernel.
>>
>> J.
> 
> Thanks for the help. I can now write my program to my RAM (both SRAM & SDRAM) and have read back
> the contents and it match's what I have written :-). I have implemented the exec function so I
> _should_ now be able to run my own program on my E3. However, I have written a few simple assember
> programs and haven't seen any life from them (no UART output). I have tested the exec code by
> reading some data from the E3 and then running pbl exec 0x00000000 which starts the unit booting,
> so unless the have changed to byte order of the address that you need to pass to pbl for the exec
> the only thing I can think is wrong is my test program (my ARM assembly is a bit rusty :-( ). 
>  
> I have attached both my modifed pbltool and my latest test program. Any pointers would be great.
> If anyone has got some standalone code to run on the E3 please could you send me it so I can try
> it out. 
>  
> Mark
> 

Hi,

After making a minor change to your source I get the following output :

(/mnt/usr3/src/ckermit/) C-Kermit>c
Connecting to /dev/ttyS0, speed 9600
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
?îîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîî
< many lines snipped>
?îîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîîî
(Back at here)
----------------------------------------------------
(/mnt/usr3/src/ckermit/) C-Kermit>


So I think the code is executing now

Here is your (modified) source code ...



                .text

_start: .global _start

entry:
        ldr r1, uart0_base      @ Load R1 with the base address of UART0
        mov r0, #0              @ R0 = 0
        strb r0, [r1, #0x04]    @ Store 0 in in IER of UART0
        ldr r1, uart1_base      @ Load R1 with the base address of UART1
        strb r0, [r1, #0x04]    @ Store 0 in in IER of UART1
        ldr r1, uart2_base      @ Load R1 with the base address of UART2
        strb r0, [r1, #0x04]    @ Store 0 in in IER of UART2

loop:
        mvn r0, #0x30           @ Store '0' in r0
        ldr r1, uart0_base      @ Load R1 with the base address of UART0
        strb r0, [r1]           @ Store 0 in the TX of UART0

        mvn r0, #0x31           @ Store '1' in r0
        ldr r1, uart1_base      @ Load R1 with the base address of UART1
        strb r0, [r1]           @ Store 0 in the TX of UART1

        mvn r0, #0x32           @ Store '2' in r0
        ldr r1, uart2_base      @ Load R1 with the base address of UART2
        strb r0, [r1]           @ Store 0 in the TX of UART2
        b loop                  @ Carry on forever


uart0_base:
        .word 0xfffb0000
uart1_base:
        .word 0xfffb0800
uart2_base:
        .word 0xfffb9800
_end:


By the way, I got errors when I tried to write to 0x20000000 so I tried
0x20010000 just as a test and it worked.

assembled as ...
/opt/cross/arm/bin/arm-linux-gnu-as -marm9tdmi --gdwarf2 uart_hi.S

linked as
/opt/cross/arm/bin/arm-linux-gnu-ld -o dummy a.out

I'm completely new to ARM so if the above is wrong I welcome corrections.



Regards, Mark.





More information about the e3-hacking mailing list