This week I trying to port another RTOS to our microprocessor. The purpose to learn this OS because it usually run preemptive operation in event scheduler. Same as Contiki, FreeRTOS also a RTOS design for small and memory constraint processor. Currently, FreeRTOS had successfully ported to plenty of microprocessor which consist products of Altera, Atmel, Arm, Cadence Tensilica, Cortus, Infineon and so on.
Each of the process in FreeRTOS called task, FreeRTOS using the scheduler to control the tasks state. A task will be insert into list. In the list only a task can in running state at a time. Other tasks will be in suspend, blocked or ready state. All of the tasks will be preassigned priority and the running sequences will depend on it. If the priority of task is set too high and run without condition, the other task will be starved and run only the highest priority task.
Before I tried to porting FreeRTOS to our processor, I try to build it to another platform. I found that I failed to port it using FreeRTOS to AVR ATmega323 by using demo in the source code. Finally, through searching on the internet I found that, the hardware specific code in demo is outdated with the current avr-gcc compiler code. In demo of ATmega323, all of the outdated code are the interrupt vector names, such as SIG_UART_DATA and SIG_UART_RECV in serial.c and SIG_OUTPUT_COMPARE1A in the port.c file. All of these interrupt vector names are changed since avr-libc version 1.4.0.
SIG_UART_DATA => UART_UDRE_vect
SIG_UART_RECV => USART_RXC_vect
SIG_OUTPUT_COMPARE1A => TIM1_COMPA_vect
After changed those codes, the demo files able to compile without error. By observing to the demo file, I found that there are also an config file which is alike with Contiki config file. The contain in this file are used to let FreeRTOS know the behaviour of our porting device. The file contain clock frequency, heap size, maximum priority and so on.
This week, I had sucessfully ported FreeRTOS to our processor and compiled by using RISC-V. But due to the port.c and portmacro.c file are not successfully implement. The task are not running in the system. Next week, I will working on these two files and make the task running in the system.