Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

Hi, I have a bare metal embedded system project for a ticket printer. I currently have a SMTP protocol to send emails from my embedded system. I need to convert that unsecure SMTP protocol to use mbedTLS SMTPS. I want to import FeeRTOS into my project but am confused on which files I need from the library. There are tutorials on creating a new project with FreeRTOS but have not found any which import FreeRTOS into an existing project. I found the thread linked below, which gives me the correct port files, but I am unsure of how to configure the files into my Keil project. Any help would be appreciated, thanks. https://sourceforge.net/p/freertos/discussion/382005/thread/999a031b/

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

Section 1.2 in the pdf you can download from here might help: https://www.freertos.org/Documentation/RTOS_book.html These links may also help: https://www.freertos.org/Creating-a-new-FreeRTOS-project.html https://www.freertos.org/a00017.html (similar to book reference above). In your case, as you are using an ARM9, you will have to create a port.c file that has a clock setup specific to your chip. Also, when starting the kernel, make sure the chip is in Supervisor mode – the easiest way to ensure that is to update the C start up code to ensure it leaves the CPU in Supervisor mode before it calls main().

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

Ah, I see you already found my LPC32 port. If you’re interested, I also have a matching GCC compiler: https://github.com/thomask77/ct-ng-toolchains

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

Hi Thomas, Do you have any tips for importing FreeRTOS into my Keilv4 LPC3250 project? I only want to use FreeRTOS for the mbedTLS compatibility.

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

I imported the port.c, list.c, queue.c, and task.c source files and headers into my Keilv4 LPC3250 project. When I try to build the project, I get these errors: .objFGL46.axf: Error: L6218E: Undefined symbol intenable (referred from port.o). .objFGL46.axf: Error: L6218E: Undefined symbol intinstallirqhandler (referred from port.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortISRStartFirstTask (referred from port.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortTickHandler (referred from port.o). .objFGL46.axf: Error: L6218E: Undefined symbol pvPortMalloc (referred from queue.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortEnterCritical (referred from queue.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortExitCritical (referred from queue.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortFree (referred from queue.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortYield (referred from queue.o). I cannot find where these functions are defined. Any advise?

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

.objFGL46.axf: Error: L6218E: Undefined symbol intenable (referred from port.o). .objFGL46.axf: Error: L6218E: Undefined symbol intinstallirqhandler (referred from port.o).
Looks like these are library specific functions used by whichever port.c file you used as a base. Where did you get the port.c file from?
.objFGL46.axf: Error: L6218E: Undefined symbol vPortISRStartFirstTask (referred from port.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortEnterCritical (referred from queue.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortExitCritical (referred from queue.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortYield (referred from queue.o).
Not sure why that is not there.
.objFGL46.axf: Error: L6218E: Undefined symbol vPortTickHandler (referred from port.o).
Maybe that was defined externally?
.objFGL46.axf: Error: L6218E: Undefined symbol pvPortMalloc (referred from queue.o). .objFGL46.axf: Error: L6218E: Undefined symbol vPortFree (referred from queue.o).
Those is defined in one of the heap implementations. Include FreeRTOS/source/portable/MemMang/heapn.c – where ‘n’ is 1 to 5, try with 4 first (heap4.c). Please attach the port.c and portmacro.h files to a post here and let us know where they came from.

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

I used the port files from Thomas following the thread link I fist posted and then to this download link: https://interactive.freertos.org/hc/en-us/community/posts/210027446-LPC32xx-ARM9-with-FPU-support-using-GCC I was looking in other Arm demo port files and found some of my undefined symbols but they are not for my processor. Including the heap_4.c file resolved 2 of the 9 errors. I attached the port files. Another file was includsed with the port files, portISR.c, which would resolve some of my error but when I try to build the portISR.c file I get these errors and warnings: srcportISR.c(68): warning: #1207-D: unknown attribute “interrupt” void vPortYieldProcessor( void ) attribute((interrupt(“SWI”), naked)); srcportISR.c(68): warning: #1207-D: unknown attribute “naked” void vPortYieldProcessor( void ) attribute((interrupt(“SWI”), naked)); srcportISR.c(71): warning: #1207-D: unknown attribute “interrupt” void vPortIRQHandler( void ) attribute((interrupt(“IRQ”), naked)); srcportISR.c(71): warning: #1207-D: unknown attribute “naked” void vPortIRQHandler( void ) attribute((interrupt(“IRQ”), naked)); srcportISR.c(90): warning: #223-D: function “portRESTORECONTEXT” declared implicitly portRESTORECONTEXT(); srcportISR.c(107): error: #20: identifier “LR” is undefined __asm volatile ( “ADD LR, LR, #4” ); srcportISR.c(110): warning: #223-D: function “portSAVECONTEXT” declared implicitly portSAVECONTEXT(); srcportISR.c(116): warning: #223-D: function “portRESTORECONTEXT” declared implicitly portRESTORECONTEXT(); srcportISR.c(123): warning: #223-D: function “portSAVECONTEXT” declared implicitly portSAVECONTEXT(); srcportISR.c(128): warning: #1267-D: Implicit physical register R2 should be defined as a variable ” LDR r2, =0x40008000 nt” /* Base address of MIC */ srcportISR.c(128): error: #29: expected an expression ” LDR r2, =0x40008000 nt” /* Base address of MIC */ srcportISR.c(161): warning: #223-D: function “portRESTORECONTEXT” declared implicitly portRESTORECONTEXT(); srcportISR.c(228): error: #20: identifier “SP” is undefined “STMDB SP!, {R0} nt” /* Push R0. */ srcportISR.c(253): error: #20: identifier “SP” is undefined “STMDB SP!, {R0} nt” /* Push R0. */ srcportISR.c(271): warning: #1267-D: Implicit physical register R0 should be defined as a variable “MOV R0, #0 nt”

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

Update: It appears that the portISR.c errors are occuring because the project is being compiled using the ARM compilier and not the GCC compiler. I switched it to the GCC compilier and fixed the errors but caused new ones since my original project will not work on the GCC compilier. So I am stuck because the FreeRTOS needs the GCC compiler but my project needs the ARM compilier. Any advise?

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

The parts of the port written in C should work with any compiler. There could possibly be a few minor exceptions if compiler specific extensions have been used, but they would be easy to fix. The portion of the port written in assembly will need editing so the assembly intrinsic syntax is as expected by your assembler, but the actual assembly instructions required will be the same – so you will need to a little cut and paste work but not actually need to change any of the code.

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

I have been trying to resolve the warnings and errors but have no luck doing so. I found this file, ISRSupport.h, which includes the definitions of some of the functions giving me errors. This header file appears to be in assembly code and was located in: FreeRTOSv10.2.0FreeRTOSSourceportableIARLPC2000ISRSupport.h Am I supposed to include this file in the portISR.c file?

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

That file just provided portSAVECONTEXT and portRESTORECONTEXT, but they are already defined in the portmacro.h file that you posted. Your problem is that the portmacro.h file is using GCC syntax. I believe if you use the latest ARM compiler it is based on LLVM, which will probably compile the GCC syntax happily – maybe even the
__attribute__((whatever))
syntax from your other posts, which is also GCC specific but generally understood by other compilers such as LLVM and IAR these days. If not, you will need to convert the macros to ARM syntax. You will find examples of asm files written for the ARM compiler in the various ports off of this location: https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/portable/RVDS/

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

Hi Richard, I still havn’t got the FreeRTOS port to work, but I wanted to know if I do get this working, will mbedTLS work? FreeRTOS is supported by mbedTLS but I am not sure if it will work with FreeRTOS on the LPC3250 ARM9. Do you know if mbedTLS will work in a ported FreeRTOS?

Importing FreeRTOS – Bare Metal LPC3250 Arm9 on Keilv4

To my knowledge mbedTLS is just a C library with no dependencies on the RTOS, or the other way around. mbedTLS is used in lots of Amazon FreeRTOS examples that run on many different hardware platforms.