|
|
 | | From: | funkymunky | | Subject: | Trying out simple asm code on an at91rm9200 | | Date: | 31 Dec 2004 22:45:48 -0800 |
|
|
 | Hi, Im an undergrad student, and a newbie to the ARM. Im working on a board based on the AT91RM9200 uC. Im relying on the default boot program, no external flash present, using the xmodem protocol to load the foll. program thru hyperterminal.
Im just sending a nibble to the I/O pins to make some of them low, but this isnt working:
#include int main() { __asm { start:MOV r1, #0xFFFFF800 //PIO C
MOV r0,#0xF //only the last 4 pins needed STR r0, [r1] //send to PIO_PER MOV r0, #0 STR r0, [r1, #0x4] //send to PIO_PDR
MOV r0, #0xF //output enabled on last 4 pins STR r0, [r1, #0x10]//send to PIO_OER MOV r0, #0 STR r0, [r1, #0x14] //send to PIO_ODR
MOV r0, #0xF //sync output on last 4 pins, ODSR made writable STR r0, [r1, #0xA0] //send to PIO_OWER MOV r0, #0 STR r0, [r1, #0xA4] //send to PIO_OWDR
MOV r0, #0xA STR r0, [r1, #0x38] //send this to the pins (ODSR) loop: B loop //infinite loop } }
after this ->
armcc -c test.c armlink test.o -o test.axf fromelf test.axf -bin -o test.bin
then i load this bin file onto the controller. But nothing happens..whats going on :-(
like i said, there is no other bootprogram present other that the default. i thnk it should work, my code resides at 0x0 after the remap..it should be executed :-(
thanx in anticipation Mayank
|
|
 | | From: | Tauno Voipio | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | Sat, 01 Jan 2005 17:29:36 GMT |
|
|
 | funkymunky wrote: > Hi, > Im an undergrad student, and a newbie to the ARM. Im working on a > board based on the AT91RM9200 uC. Im relying on the default boot > program, no external flash present, using the xmodem protocol to load > the foll. program thru hyperterminal. > > Im just sending a nibble to the I/O pins to make some of them low, but > this isnt working: > > #include > int main() > { > __asm > { > start:MOV r1, #0xFFFFF800 //PIO C > > MOV r0,#0xF //only the last 4 pins needed > STR r0, [r1] //send to PIO_PER > MOV r0, #0 > STR r0, [r1, #0x4] //send to PIO_PDR > > MOV r0, #0xF //output enabled on last 4 pins > STR r0, [r1, #0x10]//send to PIO_OER > MOV r0, #0 > STR r0, [r1, #0x14] //send to PIO_ODR > > MOV r0, #0xF //sync output on last 4 pins, ODSR made writable > STR r0, [r1, #0xA0] //send to PIO_OWER > MOV r0, #0 > STR r0, [r1, #0xA4] //send to PIO_OWDR > > MOV r0, #0xA > STR r0, [r1, #0x38] //send this to the pins (ODSR) > loop: B loop //infinite loop > } > } > > after this -> > > armcc -c test.c > armlink test.o -o test.axf > fromelf test.axf -bin -o test.bin > > > then i load this bin file onto the controller. But nothing > happens..whats going on :-( > > like i said, there is no other bootprogram present other that the > default. i thnk it should work, my code resides at 0x0 after the > remap..it should be executed :-( > > thanx in anticipation > Mayank >
Get the AT91RM9200 data sheet (doc 1768.pdf) from the Atmel website, and read the parts of parallel I/O and power controller.
In the set/reset method controlling the holding registers in the AT91 chips, there is no sense to write zeroes to either the set register or the reset register.
Have a look at the parallel I/O diagram on page 336 and verify that you have enabled all the paths needed.
Also, check that the parallel I/O clock must be enabled at the PMC (power management controller) to have the parallel I/O fuly functional.
--
Tauno Voipio tauno voipio (at) iki fi
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 18 Jan 2005 01:02:58 -0800 |
|
|
 | hi Marco,
thanx for your effort. i had visited the atmel website earlier and ive been using the same code, albeit on ADS. looks like ure using the GNUarm tools, which is good for me, since iv now decided to switch over to the GNU toolkit, since my ADS trial period is over, and there are no "student" versions available.
However, i have no clue whatsover on how to go about it. Ive just downloaded the 56 meg gnu arm toolkit from gnuarm.com. how do i go about "configuring" the toolchain to work with my setup? i have a custom board based on the AT91RM9200. and what do i doif i want to use cygwin?
Thanx in anticipation Mayank
|
|
 | | From: | Doru | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 19 Jan 2005 09:31:46 -0800 |
|
|
 | Hi,
You can try to download the evaluation version for the Microcross GNUXTOOLS-ARM that installs both Cygwin and the ARM tools. This will create a setup that can later be reproduced without using the Microcross distribution.
I've ported some of the Atmel's examples for the GNU ARM compiler and I can share them if needed.
Best regards, Doru.
|
|
 | | From: | Ulf Samuelsson | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | Fri, 21 Jan 2005 21:29:24 +0100 |
|
|
 | "Doru" skrev i meddelandet news:1106155906.184855.91780@c13g2000cwb.googlegroups.com... > Hi, > > You can try to download the evaluation version for the Microcross > GNUXTOOLS-ARM that installs both Cygwin and the ARM tools. This will > create a setup that can later be reproduced without using the > Microcross distribution. > > I've ported some of the Atmel's examples for the GNU ARM compiler and I > can share them if needed.
Why not put them on www.at91.com ?
/Ulf S
> > Best regards, > Doru. >
|
|
 | | From: | funkymunky | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 1 Jan 2005 10:41:15 -0800 |
|
|
 | >Also, check that the parallel I/O clock must be enabled >at the PMC (power management controller) to have the >parallel I/O fuly functional.
I had read the following in the Atmel manual: "The Power Management Controller controls the PIO Controller clock in order to save power. Writing any of the registers of the user interface does not require the PIO Controller clock to be enabled. This means that the configuration of the I/O lines does not require the PIO Controller clock to be enabled. However, when the clock is disabled, not all of the features of the PIO Controller are available. Note that the Input Change Interrupt and the read of the pin level require the clock to be validated. After a hardware reset, the PIO clock is disabled by default (see Power Management Controller). The user must configure the Power Management Controller before any access to the input line information."
But since im not reading the input at the pins, only writing to them , do i still have to setup the PMC?
|
|
 | | From: | funkymunky | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 1 Jan 2005 09:09:10 -0800 |
|
|
 | >get your shift and apostrophe key >fixed er...i didnt get that..what were u trying to say, cud u plz elaborate?
|
|
 | | From: | Marco Cavallini | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | Sun, 16 Jan 2005 20:57:28 +0100 |
|
|
 | Hello, I tested this code on an AT91RM9200 and is perfect for your needings. You can find the starting code (which I used for this test) in the Atmel website. Hope this helps
Marco Cavallini ============================================== Koan s.a.s. - Software Engineering (x86 and ARM) Linux and WinCE solutions for Embedded and Real-Time Software Klinux : the embedded distribution for industrial applications - Microsoft Windows Embedded Partner - Intel PCA Developer Network member Via Pascoli, 3 - 24121 Bergamo - ITALIA Tel. (++39) 035-255.235 - Fax (++39) 178-223.9748 http://www.koansoftware.com - http://www.klinux.org ==============================================
/* * AT91RM9200-Boot/AT91RM9200-Loader/entry.S */
#include
.text .align
#define AT91_USER_Stack_Begin 0x00204000 #define AT91_Stack_Begin 0x00204000
/* ------------------------ List of Exported resources -------------------------*/ .globl __entry,_entry .globl __stext,_stext .globl _start,start
/*------------------------------------------------------------------------------*/ /* Define the vector table.*/ /* The reset vector jumps to the handler code.*/ /* All others just dead loop on themselves!*/ /*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/ /* InitReset. This code is executed with the FLASH at address 0.*/ /*------------------------------------------------------------------------------*/ startoftext: rstvec: B InitReset undefvec: B undefvec swivec: B swivec pabtvec: B pabtvec dabtvec: B dabtvec rsvdvec: B rsvdvec irqvec: ldr pc, [pc,#-0xF20] fiqvec: ldr pc, [pc,#-0xF20]
#------------------- #- The reset handler #------------------- InitReset:
#------------------------------------------------------------------------------ #-Low level Init (PMC, AIC, EBI, ....) #------------------------------------------------------------------------------
ldr r1, = AT91_USER_Stack_Begin # Insure word alignement bic r1, r1, #3 # Init stack USER mov sp, r1
bl AT91F_LowLevelInit
#--------------------------------- #- Setup the stack for each mode #--------------------------------- ldr r0, =AT91_Stack_Begin
#- Set up Supervisor Mode and set SVC Mode Stack msr CPSR_c, #(ARM_MODE_SVC | I_BIT | F_BIT) # Init stack FIQ mov r13, r0 sub r0, r0, #SVC_STACK_SIZE
#- Set up Interrupt Mode and set IRQ Mode Stack msr CPSR_c, #(ARM_MODE_IRQ | I_BIT | F_BIT) # Init stack IRQ mov r13, r0 sub r0, r0, #IRQ_STACK_SIZE
#- Set up Fast Interrupt Mode and set FIQ Mode Stack msr CPSR_c, #(ARM_MODE_FIQ | I_BIT | F_BIT) # Init stack Abort mov r13, r0 sub r0, r0, #FIQ_STACK_SIZE
#- Set up Abort Mode and set Abort Mode Stack msr CPSR_c, #(ARM_MODE_ABORT | I_BIT | F_BIT) # Init stack Abort mov r13, r0 sub r0, r0, #ABT_STACK_SIZE
#- Set up Undefined Instruction Mode and set Undef Mode Stack msr CPSR_c, #(ARM_MODE_UNDEF | I_BIT | F_BIT) # Init stack Undef mov r13, r0 sub r0, r0, #UND_STACK_SIZE
#- Set up User Mode, set User Mode Stack and enable interrupts msr CPSR_c, #(ARM_MODE_SYS | F_BIT) # Init stack Sup mov r13, r0
#------------------------------------------------------------------------------ # TEST TEST TEST TEST TEST TEST TEST TEST TEST # Marco Cavallini - www.KoanSoftware.com #------------------------------------------------------------------------------
// PIO C LDR r1, =0xFFFFF800
// enables PIO control on the last 4 pins MOV r0,#0xF STR r0, [r1] //send to PIO_PER
//output enabled on last 4 pins MOV r0, #0xF STR r0, [r1, #0x10]//send to PIO_OER
//sync output on last 4 pins, ODSR made writable MOV r0, #0xF STR r0, [r1, #0xA0] //send to PIO_OWER
//send this to the pins (ODSR) set four LSB bits MOV r0, #0xF STR r0, [r1, #0x38]
#------------------------------------------------------------------------------ #- Branch on C code Main function (with interworking) #---------------------------------------------------- #- Branch must be performed by an interworking call as either an ARM or Thumb #- main C function must be supported. This makes the code not position- #- independant. A Branch with link would generate errors #------------------------------------------------------------------------------
/* b _main */
#------------------------------------------------------------------------------ #- Loop for ever #--------------- #- End of application. Normally, never occur. #- Could jump on Software Reset ( B 0x0 ). #------------------------------------------------------------------------------ End: b End
|
|
 | | From: | William Munns | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 4 Jan 2005 09:36:21 GMT |
|
|
 | "funkymunky" wrote in news:1104561948.471093.280530@c13g2000cwb.googlegroups.com:
> like i said, there is no other bootprogram present other > that the default. i thnk it should work, my code resides at > 0x0 after the remap..it should be executed :-( >
after what remap?, does the code that does the remap cause a branch to the reset handler after it has compleated?
Other than this, what version of the compiler are you using? in the more recent versions of the compiler you are advised not to use register names (does it give you any warnings?) and in the above case it may assume they are 'int' with the names 'r0' etc. and then optimize them (you may be looking for 'volatile' here).
Use fromelf -c imagename.o to see the generated code.
What you are attempting looks like assembler - would it be better to do it in the assembler (remember the 'ENTRY' directive)
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 18 Jan 2005 01:07:03 -0800 |
|
|
 | hi Marco,
thanx for your effort. i had visited the atmel website earlier and ive been using the same code, albeit on ADS. looks like ure using the GNUarm tools, which is good for me, since iv now decided to switch over to the GNU toolkit, since my ADS trial period is over, and there are no "student" versions available.
However, i have no clue whatsover on how to go about it. Ive just downloaded the 56 meg gnu arm toolkit from gnuarm.com. how do i go about "configuring" the toolchain to work with my setup? i have a custom board based on the AT91RM9200. and what do i doif i want to use cygwin?
Thanx in anticipation Mayank
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 18 Jan 2005 01:06:59 -0800 |
|
|
 | hi Marco,
thanx for your effort. i had visited the atmel website earlier and ive been using the same code, albeit on ADS. looks like ure using the GNUarm tools, which is good for me, since iv now decided to switch over to the GNU toolkit, since my ADS trial period is over, and there are no "student" versions available.
However, i have no clue whatsover on how to go about it. Ive just downloaded the 56 meg gnu arm toolkit from gnuarm.com. how do i go about "configuring" the toolchain to work with my setup? i have a custom board based on the AT91RM9200. and what do i doif i want to use cygwin?
Thanx in anticipation Mayank
|
|
 | | From: | roeido at yahoo.com | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 19 Jan 2005 00:27:37 -0800 |
|
|
 | Hi,
You could start with this aricle which helped me a lot. http://www.bloodshed.net/dev/SetDevCPPArm.pdf
Good luck
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 18 Jan 2005 00:18:30 -0800 |
|
|
 | hi Marco,
thanx for your effort. i had visited the atmel website earlier and ive been using the same code, albeit on ADS. looks like ure using the GNUarm tools, which is good for me, since iv now decided to switch over to the GNU toolkit, since my ADS trial period is over, and there are no "student" versions available.
However, i have no clue whatsover on how to go about it. Ive just downloaded the 56 meg gnu arm toolkit from gnuarm.com. how do i go about "configuring" the toolchain to work with my setup? i have a custom board based on the AT91RM9200. and what do i doif i want to use cygwin?
Thanx in anticipation Mayank
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 19 Jan 2005 10:45:27 -0800 |
|
|
 | Doru wrote:
> I've ported some of the Atmel's examples for the GNU ARM compiler and I > can share them if needed.
Hi Doru,
Id be most obliged if you would share your GNU ARM examples. If you can, plz send them at : mayank_583 at yahoo dot com
thanx in anticipation Mayank
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 18 Jan 2005 01:08:26 -0800 |
|
|
 | hi Marco,
thanx for your effort. i had visited the atmel website earlier and ive been using the same code, albeit on ADS. looks like ure using the GNUarm tools, which is good for me, since iv now decided to switch over to the GNU toolkit, since my ADS trial period is over, and there are no "student" versions available.
However, i have no clue whatsover on how to go about it. Ive just downloaded the 56 meg gnu arm toolkit from gnuarm.com. how do i go about "configuring" the toolchain to work with my setup? i have a custom board based on the AT91RM9200. and what do i doif i want to use cygwin?
Thanx in anticipation Mayank
|
|
 | | From: | news at sprow.co.uk | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 1 Jan 2005 08:58:41 -0800 |
|
|
 | funkymunky wrote:> Hi,> Im an undergrad student, and a newbie to the ARM.[snip code]You need to do a couple of things - enable the corresponding peripheral clock - get your shift and apostrophe key fixedThe rest of the code looked enough to be going on with,Sprow.
|
|
 | | From: | Mayank Kaushik | | Subject: | Re: Trying out simple asm code on an at91rm9200 | | Date: | 18 Jan 2005 01:08:18 -0800 |
|
|
 | hi Marco,
thanx for your effort. i had visited the atmel website earlier and ive been using the same code, albeit on ADS. looks like ure using the GNUarm tools, which is good for me, since iv now decided to switch over to the GNU toolkit, since my ADS trial period is over, and there are no "student" versions available.
However, i have no clue whatsover on how to go about it. Ive just downloaded the 56 meg gnu arm toolkit from gnuarm.com. how do i go about "configuring" the toolchain to work with my setup? i have a custom board based on the AT91RM9200. and what do i doif i want to use cygwin?
Thanx in anticipation Mayank
|
|
|