Re: First program on arm board



Hi JB,

Finally I was able to run my first program on ARM board. :)

Cheers Chads.

On Feb 14, 8:23 am, Chads <ashee...@xxxxxxxxx> wrote:
On Feb 14, 8:15 am, Chads <ashee...@xxxxxxxxx> wrote:



On Feb 13, 6:24 pm, Juergen Beisert <jbeis...@xxxxxxxxxxxx> wrote:

Hi,

Chads wrote:
On Jan 31, 6:23 pm, Juergen Beisert <jbeis...@xxxxxxxxxxxx> wrote:
Chads wrote:
On Jan 31, 3:17 pm, Juergen Beisert <jbeis...@xxxxxxxxxxxx> wrote:
You like the hard way? Why do you do it in assembler?

It's not working. Seems I missing lots of things here. First
thing which comes is how to write linker file for it. Can someone
please guide me or give me pointer so that I can study it. I have
found few sample linker files from Linux kernel code also and
trying to figure out how to write them.

What's your intention? A program that runs on bare metal or as part
of the Linux kernel or something that should run as a usermode
program? Programming in assembler *could* make sense if it should
run on bare metal. For the other cases you should do it in "C".

Thank you for your response.
Yes I want to run it on bare metal thats why witting it in assembly.
But you wrote:
I am very new to embedded linux. I have a pxa255 based board and I
am planning to put linux on it.

But if you plan to bring Linux in your box, why do you start with bare
metal?

Writing linker script files is not such complicated. Refer ld's
manpages. All it does is to give your code some kind of "layout" when
it gets translated to binary: Where to place the text segment content
in the file and at runtime (same for data and bss segment).
But how do you want to run this program on your bare metal? This CPU
needs some kind of setup after reset. To bring up the SDRAM controller
for example.

Juergen

First I am planning to have my basics ready. The very basic program
which I can think of is writing this code to toggle LED.

All right, you want to go the hard way...

Can you please let me know in detail what all setups will be required
to run program on bare metal?

Sorry, I can't. Because I know nothing about your hardware (only your
processor). At least your SDRAM controller must be actice and your clock
setup must be correct. Otherwise nothing will happen. And you will need

I was able to write linker script but still my first program is not
working.

Please see if someone can help.

? It seems I'm blind, I can't see anything... ;-)

JB

Hi JB,

Please find details below.

My LED is connected at GPIO 10 of PXA255. I have written following
program to ON it.

.text /*Executable code follows*/
_start: .global _start /* "_start" is required by the linkera*/
.global main /* "main" is our main program */
b main /* Start running the main program */
/* Insert your code here */

MAIN:
MOV R1, #0x40000000 /* GPDR0 for configuring the PIN 10 as
output*/
ADD R1,R1, #0x00E00000
ADD R1,R1, #0x0000000C

/*MOV R5, #0x3B9AC9FF*/

MOV R2, #0B01000000000
STR R2,[R1] /* Pin 10 now configured as Output*/

LOOP:
MOV R0,#0
MOV R6, #0x40000000 /* Register6 with a large value
stored*/

MOV R1,#0x40000000 /* Address of GPSR0 - set register*/
ADD R1,R1, #0x00E00000
ADD R1,R1, #0x00000018

MOV R2, #0B01000000000 /* Set the 10th bit */

STR R2,[R1] /* LED shall turn ON here*/

BAL LOOP
/* mov pc,lr need to see what it is ??? Return to the
caller*/
.end
And progra

I am sorry for incomplete post.

I have also written program on similar lines to OFF, Toggle LED.

I have used following steps:

1) Used cross arm assembler to create its executable file(ELF format).
2) Used cross objcopy to convert it into binary image
3) Transferring this binary image to my board at 0x0 as processor
start execution from 0x0 on reset.

I thought I might have to write a basis linker script for it? Please
let me know if I really need it or not as my memory map shows that at
0x0 it has boot flash I am witting my program there so it should work.
I have share my linker script in case you feel that I need it

Please let me know what more information is required from my side.

Thanks
Chads

.