# Making a port for LPC2378 on MCB2300

**URL:** <https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127>\
**Category:** Kernel\
**Created:** [October 4, 2007, 9:57am UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127 "2007-10-04T09:57:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 4, 2007, 9:57am UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/1 "2007-10-04T09:57:18Z")

</div>

**[karelvergauwe](https://sourceforge.net/u/karelvergauwe/)** wrote on [Thursday, October 04, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637):

Hello,

I want to make a port for LPC2378 on the Keil MCB2300 for the Keil uVision development tool. I have a full version. From where can I start so that I can do it fast. I tried starting from the ARM7\_LPC2129\_Keil example who came with version 4.5.0 but I keep having errors (like portable files who are not included (…\…\Source\include\portable.h(188): error:&nbsp; #20: identifier "portSTACK\_TYPE" is undefined)). I also tried starting from the SAM7 example, but had the same linking problems.

Can I build a complete project from scratch, just with copying the necesery files?

If I have it working i’ll send it to include it in a next version. Lot’s of people could use a working example for this dev tool i think.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 4, 2007, 12:08pm UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/2 "2007-10-04T12:08:26Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Thursday, October 04, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/9fbd):

Have you got the SAM7 Keil demo from Richard?&nbsp; It uses the ARM compiler and will probably be a good reference to convert to LPC2378.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 4, 2007, 1:54pm UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/3 "2007-10-04T13:54:23Z")

</div>

**[karelvergauwe](https://sourceforge.net/u/karelvergauwe/)** wrote on [Thursday, October 04, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/5146):

Yes I have it, but I cannot get it running. I keep getting errors because some identifiers cannot be found. I tried to search for them myself but didn’t work…

If someone has a working example of SAM7 and is sure it is compiling can you send it to me (karel \_at postron dot be). So I can test it. Perhaps my libraries aren’t ok? In the options there weren’t any include paths filled in. I tried to add some, but I think I still miss some…

thanks

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 4, 2007, 7:30pm UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/4 "2007-10-04T19:30:08Z")

</div>

**[biker126](https://sourceforge.net/u/biker126/)** wrote on [Thursday, October 04, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/6396):

about the portable.h error (and probably a lot of related "identifier" errors) search for the portmacro.h

in that file there’s the include path of the portable.h. but it needs to be enabled with the correct define (to be honest you can just put “portable.h” anywhere inside the project and just make sure the compiler knows where it is ;-)).

in portable.h there are things like "portSTACK\_TYPE" or "portBASE\_TYPE" etc. defined. so as soon as your compiler finds that header file a lot of errors should be done (and prolly new coming up as its always when porting :-P)

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 5, 2007, 9:59am UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/5 "2007-10-05T09:59:52Z")

</div>

**[karelvergauwe](https://sourceforge.net/u/karelvergauwe/)** wrote on [Friday, October 05, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/49be):

I have include the portable.h and portmacro.h (from keil arm7) in the project; also the AT91SAM7S64\_inc.h and lib\_AT91SAM7S64.h files. Now almost all my errors are gone but I always have following warning:

…\ARM7\_AT91SAM7S64\_KEIL\_RV\AT91SAM7S64\_inc.h(71): warning:&nbsp; #47-D: incompatible redefinition of macro "AT91C\_AIC\_PRIOR" (declared at line 192 of "…\…\Source\portable\Keil\SAM7\AT91SAM7S64.h")

This is probably because I include the lib\_AT91SAM7S64.h in my AT91SAM7S64\_inc.h file wich is linked a couple of times. How can I avoid this problem? Where should I include this file?

I do also have 30 errors with the same fault:

…\ARM7\_AT91SAM7S64\_KEIL\_RV\lib\_AT91SAM7S64.h(311): error:&nbsp; #134: expected a field name

for example in the following code:

308&nbsp; \_\_inline int AT91F\_PDC\_IsTxEmpty ( // \return return 1 if transfer is complete  
309&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AT91PS\_PDC pPDC )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // \arg pointer to a PDC controller  
310&nbsp;&nbsp;&nbsp; {  
311&nbsp;&nbsp;&nbsp; return !(pPDC-\>PDC\_TCR);&nbsp;&nbsp; This gives the error  
312&nbsp;&nbsp;&nbsp; }

What is wrong? It’s code from the SAM7 example who was delivered to me and is normally working with Keil RVDM compiler (I think)

I will be very pleased with any commment

thanks

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 5, 2007, 10:13am UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/6 "2007-10-05T10:13:51Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Friday, October 05, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/49be/4809):

How is \_\_inline defined?&nbsp; Do Keil provide their own versions of these files?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 5, 2007, 11:56am UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/7 "2007-10-05T11:56:52Z")

</div>

**[karelvergauwe](https://sourceforge.net/u/karelvergauwe/)** wrote on [Friday, October 05, 2007](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/4bbe):

I found that the problem lies in the pointer to a variable of the pPDC struct. I also have this with other structures who have been made.

example:  
in file: AT91SAM7S64.h is the struct being made, with at the end a pointer \*AT91PS\_AIC;

typedef struct \_AT91S\_AIC {  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_SMR[32];&nbsp;&nbsp;&nbsp;&nbsp; // Source Mode Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_SVR[32];&nbsp;&nbsp;&nbsp;&nbsp; // Source Vector Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_IVR;&nbsp;&nbsp;&nbsp;&nbsp; // IRQ Vector Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_FVR;&nbsp;&nbsp;&nbsp;&nbsp; // FIQ Vector Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_ISR;&nbsp;&nbsp;&nbsp;&nbsp; // Interrupt Status Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_IPR;&nbsp;&nbsp;&nbsp;&nbsp; // Interrupt Pending Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_IMR;&nbsp;&nbsp;&nbsp;&nbsp; // Interrupt Mask Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_CISR;&nbsp;&nbsp;&nbsp;&nbsp; // Core Interrupt Status Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; Reserved0[2];&nbsp;&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_IECR;&nbsp;&nbsp;&nbsp;&nbsp; // Interrupt Enable Command Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_IDCR;&nbsp;&nbsp;&nbsp;&nbsp; // Interrupt Disable Command Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_ICCR;&nbsp;&nbsp;&nbsp;&nbsp; // Interrupt Clear Command Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_ISCR;&nbsp;&nbsp;&nbsp;&nbsp; // Interrupt Set Command Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_EOICR;&nbsp;&nbsp;&nbsp;&nbsp; // End of Interrupt Command Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_SPU;&nbsp;&nbsp;&nbsp;&nbsp; // Spurious Vector Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_DCR;&nbsp;&nbsp;&nbsp;&nbsp; // Debug Control Register (Protect)  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; Reserved1[1];&nbsp;&nbsp;&nbsp;&nbsp; //  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_FFER;&nbsp;&nbsp;&nbsp;&nbsp; // Fast Forcing Enable Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_FFDR;&nbsp;&nbsp;&nbsp;&nbsp; // Fast Forcing Disable Register  
&nbsp;&nbsp;&nbsp; AT91\_REG&nbsp;&nbsp;&nbsp;&nbsp; AIC\_FFSR;&nbsp;&nbsp;&nbsp;&nbsp; // Fast Forcing Status Register  
} AT91S\_AIC, \*AT91PS\_AIC;

in file: lib\_AT91SAM7S64.h the pointer is being copied to pAic in the first line of Configuration

\_\_inline unsigned int AT91F\_AIC\_ConfigureIt (  
&nbsp;&nbsp;&nbsp; AT91PS\_AIC pAic,&nbsp; // \arg pointer to the AIC registers  
&nbsp;&nbsp;&nbsp; unsigned int irq\_id,&nbsp;&nbsp;&nbsp;&nbsp; // \arg interrupt number to initialize  
&nbsp;&nbsp;&nbsp; unsigned int priority,&nbsp;&nbsp; // \arg priority to give to the interrupt  
&nbsp;&nbsp;&nbsp; unsigned int src\_type,&nbsp;&nbsp; // \arg activation and sense of activation  
&nbsp;&nbsp;&nbsp; void (\*newHandler) () ) // \arg address of the interrupt handler  
{  
&nbsp;&nbsp;&nbsp; unsigned int oldHandler;  
&nbsp;&nbsp;&nbsp; unsigned int mask ;

&nbsp;&nbsp;&nbsp; oldHandler = pAic-\>AIC\_SVR[irq\_id];

&nbsp;&nbsp;&nbsp; mask = 0x1 \<\< irq\_id ;  
&nbsp;&nbsp;&nbsp; //\* Disable the interrupt on the interrupt controller  
&nbsp;&nbsp;&nbsp; pAic-\>AIC\_IDCR = mask ;  
&nbsp;&nbsp;&nbsp; //\* Save the interrupt handler routine pointer and the interrupt priority  
&nbsp;&nbsp;&nbsp; pAic-\>AIC\_SVR[irq\_id] = (unsigned int) newHandler ;  
&nbsp;&nbsp;&nbsp; //\* Store the Source Mode Register  
&nbsp;&nbsp;&nbsp; pAic-\>AIC\_SMR[irq\_id] = src\_type | priority&nbsp; ;  
&nbsp;&nbsp;&nbsp; //\* Clear the interrupt on the interrupt controller  
&nbsp;&nbsp;&nbsp; pAic-\>AIC\_ICCR = mask ;

&nbsp;&nbsp;&nbsp; return oldHandler;  
}

Afterwords we try to get for example AIC\_IVR from pAic with code:  
pAic-\>AIC\_IVR = …

Does someone know where the problem lies??? My compiler does not recognize the fields in my structure…

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [January 31, 2008, 5:09am UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/8 "2008-01-31T05:09:36Z")

</div>

**[suresh\_kumar](https://sourceforge.net/u/suresh_kumar/)** wrote on [Thursday, January 31, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/9fbd/d972):

hi  
I am also looking for the same ,myself using LPC2378 and want it working wilt keil compiler and i tried to convert using LPC2129 but failed since it gave lot of error but any how i did changes to it and got some of the errors cleared but i have a assembler error  
&nbsp;&nbsp;&nbsp; \_\_asm{ LDR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LR, [LR, #+60]&nbsp;&nbsp;&nbsp; };

this gives a error asking for macro parameter needed, can any one tel wt is it.

pvPortMalloc is a function related to memory but we have 3 files related to it which one to use do suggest . since this might be usefull for all using LPC2378 controller using keil compiler

Regards  
Suresh

---

<div class="post-metadata">

**Author:** ![SergentSloGin](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/sergentslogin/32/48_2.png) [@SergentSloGin](https://forums.freertos.org/u/SergentSloGin)\
**Post date:** [January 31, 2008, 7:47am UTC](https://forums.freertos.org/t/making-a-port-for-lpc2378-on-mcb2300/5127/9 "2008-01-31T07:47:22Z")

</div>

**[jmr1972](https://sourceforge.net/u/jmr1972/)** wrote on [Thursday, January 31, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/e2de771c/#2637/9fbd/d972/ecad):

Which heap management file you should use depends on you application. I would suggest you read the documentation for FreeRTOS mainly its porting guide. For memory configuration have a look at [http://www.freertos.org/a00111.html](http://www.freertos.org/a00111.html)
