الاثنين، 23 أبريل 2012

Porting FreeRTOS to Olimex LP2378STK Using KEIL MDK ARM

1- Create a new demo folder at \FreeRTOS\Demo name it ARM7_LPC2378_Keil.
2- Download files from this link https://docs.google.com/open?id=0BwqO6Hv9feAET1ByY3lwYlR0S1U 
3- Copy freeRTOS.h, LPC2300.s, main.c to the demo folder.
4- Create a new folder at \FreeRTOS\Source\portable\RVDS name it ARM7_LPC23xx.
5- Copy port.c, portASM.s, portmacro.h from the downloaded files to the last created folder.
6- Open uVision and create a new project at the demo folder created first step choosing NXP>LPC2378 as target. NOTE: when creating the project uVision will ask to include startup file don't include.
7-  Add (main.c, LPC2300.s) files to the project source group from the demo folder \Demo\ARM7_LPC2378_Keil.
8- Add (port.c, portASM.s) files to the project source group from the  source folder \Source\portable\RVDS\ARM7_LPC23xx.
9- Right click on the project open the options : 
>at target tab change IRAM1: Size to 80000
>at output tab check create HEX file and Browse information
>at C/C++ tab copy ARM7_LPC23xx_KEIL_RVDS
 to Define, copy .;..\..\Source\portable\RVDS\ARM7_LPC23xx;..\Common\include;..\..\Source\include to include paths.
>at Asm tab copy ..\..\Source\portable\RVDS\ARM7_LPC23xx to include paths.
>at Linker tab check use memory layout.
10- the next step is to setup your debugger it depends on your one. I'll setup j-link EDU debugger :
        >at debug tab check Run to main then:
           choose use j-link/j-trace click settings and 
           choose adaptive clock and reset strategy choose 
           (software pc=0 CPSR = 0xD3 all SPSR = 0x10)
        >at utilities tab choose j-link/j-trace and uncheck update target 
          update target before debug
          on settings choose erase sectors and then add 
          LPC2000 IAP2 512KB Flash into programming algorithm 
**hint: you can use simulator first to check your routine
NOW Build your project and then start debug session.