µTasker Forum > ATMELTM AT91SAM7X and AVR32

porting uTasker to the winarmgcc

(1/3) > >>

tecnoemerson:
Hi

I have olimex board sam7x, i have tested it with uTasker compiled with IAR,  Marker sent to me bin file so it work very well.

I want use WinARM, i have made good code with it, USB CDC and USART, so i want use uTasker in my devices.

I want porting uTasker to compile with winarm, i have utasker makefile, but i had problem with libarm_enable_irq() and libarm_disable_irq() in sam7x.c file, functions from Rowley, i have used:

extern void __irq_en(void);  // enable interrupt in assembler code
 extern void __irq_dis(void);  // disable interrupt in assembler code

This form:

void libarm_disable_irq()
{
   __irq_dis();
}

void libarm_enable_irq()
{
  __irq_en();
 }

This modification don`t create compilation erros, but uTasker don`t work in board, i am trying debugger with openocd and insight GDB.

I had contacted winarm developer Martin Thomas, i ask him if winarm has lib that can fix this problem so he replied me:
         
         "Please browse the examples that come with WinARM for files called
          armVIC.h/.c (even if you find them in LPC2000 examples they can be used
          for the AT91SAM7 too). The functions enableIRQ and disableIRQ offer the
          needed functionality."

I use this files and functions inside, but i got another error in end of make compilation:

arm-elf-gcc -march=armv4t -mlittle-endian -mthumb -mthumb-interwork -Wall -Wstrict-prototypes -I..\..\uTaskerV1.3 -D _GNU -D _HW_SAM7X -g -c -Os ..\winarm_irq\armVIC.c  -o Build\armVIC.o
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s: Assembler messages:
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:25: Error: selected processor does not support `mrs r1,cpsr'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:39: Error: selected processor does not support `msr cpsr,r3'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:62: Error: selected processor does not support `mrs r1,cpsr'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:76: Error: selected processor does not support `msr cpsr,r3'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:98: Error: selected processor does not support `mrs r0,cpsr'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:108: Error: selected processor does not support `msr cpsr,r3'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:130: Error: selected processor does not support `mrs r0,cpsr'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:141: Error: selected processor does not support `msr cpsr,r2'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:163: Error: selected processor does not support `mrs r0,cpsr'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:173: Error: selected processor does not support `msr cpsr,r3'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:195: Error: selected processor does not support `mrs r0,cpsr'
C:\DOCUME~1\Emerson\LOCALS~1\Temp/ccYbbaaa.s:206: Error: selected processor does not support `msr cpsr,r2'
make.exe: *** [Build\uTasker.o] Error 1[/color]

well, if somebody has experience in porting or how i can  fix the problem, please tell me.

I have makefile to winarm and uTasker bin to IAR, i have to openocd.cfg file and how load insight and openocd by programmenotepad, i can send by email just request me.

Thanks

Emerson M A Alves
Brazil
emerson@saaepirapora.com.br

mark:
Hi Emerson

Try compiling this file from WinArm without the -mthumb flag. I have a feeling that the assembler instructions which are throwing errors are ARM mode instructions and so will not assemble in Thumb mode. Since the project is using -mthumb-interwork it is possible to mix ARM and Thumb compiled programs - the compiler sorts out the mode switching.

Good luck

Mark

tecnoemerson:
Yeah! Mark


I removed -mthum flag, so  fix the assembly error, but bin file don`t work in olimex board, but usb now is stable, before usb was in reset loop, maybe watchdog. The size of the file is 75kb was 52.

Thanks

Emerson

mark:
Emerson

Only remove the thumb flag in the single winARM C-file.
This should only increase the complete code by a very small amount. The present increase is surprisingly large and doesn't sound right.

With the debugger try to work your way through the following porting list. It is probably not complete but it will serve as a starting point to see at about which point the code is failing.

1. The start up code must set up the memory correctly. The link file that I sent should be used as a reference and the start up code must also use the defines there for setting up the various stack pointers.

2. The start up code must initialise PLL, default interrupt handlers and variables – it is best to call AT91F_LowLevelInit() in sam7x.c

3. Then the code must jump to main() in SAM7x.c

4. It has to be checked that the heap initialisation is correct. __heap_end__ is used as start address for the heap (__heap_end__ is taken from the linker script file)

5. The uTasker tasks will then be configured and the timer interrupt (TICK) configured. The interrupts will also be enabled.

6. The interrupt TICK will be called if the low level interrupt handler is working correctly.

Note that I have created a file called startup_gnu.s which is use as a start up file in the project and it contains all that is needed. It is also compatible with the linker script file. Verify that you are using this rather than one supplied with the GNU compiler. Then try to step through the code to see what is working correctly and where it goes wrong.

Once the TICK is operating correctly, the watchdog will be retriggered every 200ms and an output or LED will be blinking (see which one is defined in app_hw_sam7X.h and modify to suit the board in question if needed).
As long as it gets this far the basis is ready and any additional problems will be very specific (compiler specialities like packing, but this should be solved for GCC).

Good luck

Regards

Mark

tecnoemerson:
Mark

I have dedicated a lot in porting uTasker.

Ok, i removed -mthumb flag just  armVIC.o file from winarm, the  file size is smaller than previous, almost 55kb, so now i am trying debug it,  i use openocd and insight, so i have some questions:

Can i use simulator to test code?

What is fisrt file after reset sam7x?  is sam7x.c and function AT91_LowLevel_init?

Thank you again.


Emerson M A Alves
Brazil

Navigation

[0] Message Index

[#] Next page

Go to full version