LPC17xx port using Keil

cluribe2 wrote on Thursday, February 18, 2010:

I’m new to FreeRTOS and I’m trying to use the files I received with the NXP application book that I just purchased. I get a compiler error in task.c, port.c and queue.c which all point to the same macro, i.e. portSET_INTERRUPT_MASK(), which states #1113: Inline assembler not permitted when generating Thumb code." What can I do to fix this? Thanks for your help.

cluribe2 wrote on Thursday, February 18, 2010:

I forgot to mention, the target micro is LPC1768 and I am using uVision 4.0. After searching the help files, I found where I can use #pragma arm and #pragma thumb around the inline assembly code. However, this generates an additonal error, "#1114-D: this feature not supported on target architecture/processor.

davedoors wrote on Friday, February 19, 2010:

uVision does not allow inline assembler in THUMB code, and the LPC1768 only allows THUMB code, so this makes the compiler really dumb. There is no way around the inline assembler problem but you can move the code into an assembly file.

cluribe2 wrote on Friday, February 19, 2010:

Thank you for your reply. However, I think that only applies to macros because it had no problem with vPortSVCHandler() and vPortStartFirstTask() in port.c. Or, am I missing something?

rtel wrote on Friday, February 19, 2010:

Thank you for your reply. However, I think that only applies to macros because it had no problem with vPortSVCHandler() and vPortStartFirstTask() in port.c. Or, am I missing something?

The two functions you reference are actually assembler functions, they are just defined within a C file.  This is quite different to inline assembler, where assembly instructions are manually inserted into C functions.

Regards.

cluribe2 wrote on Friday, February 19, 2010:

No, you’re right. It just wasn’t compiling port.c due to the error I think.

cluribe2 wrote on Friday, February 19, 2010:

Once I took care of the error in the macros, I got the same error #1113 when it tried to compile port.c in the functions mentioned above and in the xPortPendSVHandler() function as well.

rtel wrote on Friday, February 19, 2010:

The code that comes with the LPC17xx eBook is configured to compile with GCC, and in particular with the LPCXpresso IDE.  Am I right in thinking you are trying to compile it with Keil?  I would not expect that to work, however the FreeRTOS download contains a port layer for Keil too so if you want to use Keil you would be better off using the Keil port layer directly rather than trying to convert the GCC port layer.

The book demos rely on the terminal output too - I’m not sure what the Keil IDE will do with the terminal output.

Can you just try using the LPCXpresso IDE?  It is a free download.  Once you have gone through the book examples you can set up a project using Keil based on one of the standard demos in the main download.

Regards.

cluribe2 wrote on Friday, February 19, 2010:

Yes, I am trying to compile with Keil uVision 4.0. I had tried to find that Keil layer earlier but I guess I was looking in the wrong place. I found it now and it does compile. I only get a warning now, #1207-D: attribute “naked” ignored in port.c.

I downloaded & installed the LPCXpresso IDE and all the examples compiled ok. However, I can’t debug because the target is Keil’s MCB1700 board using ULINK2 device. I couldn’t find a way to select that device from the IDE.

Thanks for your help.

ujush wrote on Tuesday, July 13, 2010:

Hello cluribe2,

You mention that you already compile the examples from LPC17xx ebook into keil.

I have also same problem as yours but unfortunately I can’t compile it successfully., could you please share it to me what did u you do? What are the files you included in the project? Is just the same on the project included in the LPCXpresso IDE?
I also try the source code examples for LPC17xx from FreeRTOS in LPCXpresso IDE and it works fine but I need to run on keil for some reasons.
Unfortunately I’m stuck of it on rebuilding or changing some files on KEIL.
Thanks.

ujush wrote on Wednesday, July 14, 2010:

Hello,

Good for me, I already compile the files successfully.

cluribe2 wrote on Monday, July 19, 2010:

I’m sorry I did not reply earlier but I was on vacation last week. I’m glad that you got it to compile successfully.

ujush wrote on Tuesday, July 20, 2010:

Yeah, I successfully compile one of the Examples of LPC17xx but unfortunately I can’t debug and can’t view the output. Is your’s is completely compile and can you debug the examples completely? Didn’t you encountered some errors during debugging?
What did you do?
Coz i’m stuck on debugging the codes and I think is on port.c the vPortStartFirstTask() or in the startup_LPC17xx.s…

Thanks.

cluribe2 wrote on Tuesday, July 20, 2010:

I didn’t compile and debug the examples under Keil. I created my own project under Keil then added the FreeRTOS files to my project.  For port.c, I used c:\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c. I had some errors, but I was able to resolve them. Using the correct port.c file is the key. For LPCXpresso, I never could find how to use the ULINK2 debug probe so I was not able to debug those examples.