Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Lattice Mico32

Posted by Jon Harper on May 19, 2010
Hi,
I would like to use the community port of FreeRTOS on a Lattice Mico32. I downloaded the files available at http://www.freertos.org/index.html?http://interactive.freertos.org/forums/104358-lattice. I tried to buid this with the version of FreeRTOS 4.7.0 (what it was created for).

There are some missing include files :
#include "system_conf.h"

#include "Timer.h"


#include "GPIO.h"

I suppose this is some lattice specific headers files, but can't find them anywhere. Does anyone have any pointers here ?

Thanks in advance

Jon

RE: Lattice Mico32

Posted by MEdwards on May 19, 2010
Yes I think you must be right, there are not FreeRTOS files. Could it be that the version of the Lattice tools has changed since the port was posted?

RE: Lattice Mico32

Posted by Jon Harper on May 21, 2010
So I got it to compile using the following Timer.h (writtten after reading the lattice mico32 timer spec)
#ifndef TIMER_H
#define TIMER_H
#include

#define TIMER_CONTROL_INT_BIT_MASK 1 << 0
#define TIMER_CONTROL_CONT_BIT_MASK 1 << 1
#define TIMER_CONTROL_START_BIT_MASK 1 << 2
#define TIMER_CONTROL_STOP_BIT_MASK 1 << 3


#define TIMER_BASE_ADDRESS 0xA0000600 // This is the timer address for my configuration, it should be changed

typedef struct {
volatile uint32_t Status;
volatile uint32_t Control;
volatile uint32_t Period;
volatile uint32_t Snapshot;
} Timer_t ;

#endif


However, context switching does not occur. I can see that the timer interrupt handler is called, I can see that the systick is incrementing, but it doesn't change context. Could someone explain what normally happens when the ISR handlers executes the following functions ?
vTaskIncrementTick();
vTaskSwitchContext();


RE: Lattice Mico32

Posted by Jon Harper on May 21, 2010
This is what when I dump the values that are logged by the trace utility :
...
TickCount :14 previous :1
TickCount :15 previous :0
TickCount :16 previous :1
TickCount :17 previous :0
TickCount :18 previous :1
...

It looks like both my tasks are beeing scheduled
However, I am sure that when I launch two tasks, only the code from the last created task is executed. The code from the other task is not executed.
Does anyone have any pointers ..?

RE: Lattice Mico32

Posted by Jon Harper on May 26, 2010
Ok, I had not seen the low level interrupt routine vPortInterruptHandler that saves and restores contexts... I was calling the high level IRQ directly. Now that I changed that, it works like a charm !

I had to add one line to port.c though, but maybe that's because i'm running a simulated timer, not the real timer from lattice.

Here's the line :
+ pTimer->Period = configCPU_CLOCK_HZ / configTICK_RATE_HZ ;
pTimer->Control = TIMER_CONTROL_START_BIT_MASK | TIMER_CONTROL_INT_BIT_MASK | TIMER_CONTROL_CONT_BIT_MASK;



[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner