Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Microblaze Port does not compile [edk 9.2]

Posted by threinbacher on May 29, 2008
Hi everybody,

I'm having currently a microblaze design in front of me. I already included a timer and a interrupt controller, both worked fine (without FreeRTOS). Therefore the timer and interrupt setup seems to be correct.

After adding FreeRTOS Sources to the project it couldn't even manage to compile all the files.

In the File port.c:

/src/freeRTOS/portable/port.c: In function ‘vPortYield’:
/src/freeRTOS/portable/port.c:253: error: conflicting type qualifiers for ‘uxCriticalNesting’
/src/freeRTOS/portable/port.c:85: error: previous definition of ‘uxCriticalNesting’ was here
make: *** [TestApp_Memory/executable.elf] Error 1

Line 85 of port.c looks like:
/* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task
maintains it's own count, so this variable is saved as part of the task
context. */
volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE;

An on Line 253 we can find something like that:
/* Perform the context switch in a critical section to assure it is
not interrupted by the tick ISR. It is not a problem to do this as
each task maintains it's own interrupt status. */
portENTER_CRITICAL();
/* Jump directly to the yield function to ensure there is no
compiler generated prologue code. */
asm volatile ("bralid r14, VPortYieldASM\n\t" \
"or r0, r0, r0\n\t" );
portEXIT_CRITICAL();

Do i have to set some special compiler settings to get FreeRTOS compiled? Any Help is appreciated!

Greetings from Vienna,

RE: Microblaze Port does not compile [edk 9.2]

Posted by Richard on May 29, 2008
There has been a long discussion over the last few days about the Microblaze port, which was created (and still functions under) EDK V7.1 but not under later versions. There are two issues:

1) This is the easy one to fix. The later versions of GCC generate warnings for code the old version was perfectly happy to let pass. The code currently in the FreeRTOS.org Subversion repository have fixed all these. The warning you highlight above is simply that the original declaration of the variable has a volatile qualifier, whereas the extern declaration in the macro does not. You can add the volatile qualifier to the extern declaration and the error will go away.

2) More difficult is the change in the way interrupts are installed executed in the later versions of the EDK. This is going to require a code change to fix. It might be that the contributor to the other thread has this fixed already. If you look a couple of threads down the list you will see the one I'm referring to (it has 20 or so replies). I hope to get this updated in the release soon but its not going to be in the next few days.

Regards.

RE: Microblaze Port does not compile [edk 9.2

Posted by threinbacher on May 29, 2008
Hi,

Thanks a lot for your detailed reply.

Yeah - i read the Microblaze Thread. Even though i think my setup is a bit differnt, since i have already the timer up and running on my system.

Unfortunatelly, i still could'nt manage to get FreeRTOS compiled:

I fixed in portmacro.h :
from
extern volatile unsigned portBASE_TYPE uxCriticalNesting;
to
extern unsigned portBASE_TYPE uxCriticalNesting;


But i still got a bunch of other warnings/errors regarding

tmp/cctx8Z9x.o: In function `xCoRoutineCreate':
/src/freeRTOS/croutine.c:118: undefined reference to `pvPortMalloc'

And a lot more - all complaining about undefined references to pvPortMalloc, vPortFree.


Hmm, did i forgot something?


greetings from Vienna,




RE: Microblaze Port does not compile [edk 9.2

Posted by woops_ on May 29, 2008
Most likely forgot to include heap_x.c. look in the source\portable\memmang directory.

RE: Microblaze Port does not compile [edk 9.2

Posted by threinbacher on May 29, 2008
hi,

@woops_

That worked fine for me. Thanks a lot.

But, i still didn't manage to compile the sources:

tmp/ccktBDYh.o: In function `xTaskResumeAll':
/tasks.c:1145: undefined reference to `traceTASK_SWITCHED_OUT'
and
/tmp/ccGwpPZG.o: In function `Toggler2':
/application.c:75: undefined reference to `vParTestInitialise'

application.c:

/* Board Includes */
#include "xparameters.h"
#include "stdio.h"
#include "xutil.h"
#include "xgpio.h"
#include "xtmrctr.h"
#include "xintc.h"

/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"

/* Hardware library includes. */
#include <xintc.h>

#define mainTINY_STACK70
#define LED_CHANNEL1

static void prvSetupHardware( void );
static void Toggler1( void *pvParameters );
static void Toggler2( void *pvParameters );
static void initGPIO( void );

XGpio GpioOutput; /* The driver instance for GPIO Device configured as O/P */


// Create all the tasks, then start the scheduler.
int main (void)
{
print("Starting OS now! \r\n");

portDISABLE_INTERRUPTS();

prvSetupHardware();

xTaskCreate( Toggler1, "Tog1", mainTINY_STACK, ( void * ) 10, tskIDLE_PRIORITY+3, NULL );
xTaskCreate( Toggler2, "Tog2", mainTINY_STACK, ( void * ) 20, tskIDLE_PRIORITY, NULL );

/* Finally start the scheduler. */
vTaskStartScheduler();

/* Should not get here as the processor is now under control of the scheduler! */

return 0;
}
/*-----------------------------------------------------------*/

static void Toggler1( void *pvParameters )
{
/* The parameters are not used. */
( void ) pvParameters;

/* Block for 500ms. */
const portTickType xDelay = 500 / portTICK_RATE_MS;


for( ;; )
{
XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, ~(1 << 3));
vTaskDelay( xDelay );
}
}

static void Toggler2( void *pvParameters )
{
/* The parameters are not used. */
( void ) pvParameters;

/* Block for 1s. */
const portTickType xDelay = 1000 / portTICK_RATE_MS;


for( ;; )
{
XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, ~(1 << 1));
vTaskDelay( xDelay );
}
}
/*-----------------------------------------------------------*/

static void prvSetupHardware( void )
{
XIntc_mMasterEnable( XPAR_OPB_INTC_0_BASEADDR );

/* Initialise the GPIO used for the LED's. */
vParTestInitialise();
}
/*-----------------------------------------------------------*/

static void initGPIO( void )
{
XStatus Status;

Status = XGpio_Initialize(&GpioOutput, XPAR_LEDS_4BIT_DEVICE_ID);

// Set the direction for all signals to be outputs
XGpio_SetDataDirection(&GpioOutput, LED_CHANNEL, 0x0);

// Set the GPIO outputs to high
XGpio_DiscreteWrite(&GpioOutput, LED_CHANNEL, 0x0);
}



Again, any ideas on that?

Greetings from Vienna,



RE: Microblaze Port does not compile [edk 9.2

Posted by threinbacher on May 29, 2008
Hi all,

Found a stupid bug in the application.c posted above.

Finally, there is still one error that i can't get rid of:

undefined reference to `traceTASK_SWITCHED_OUT' in tasks.c:1145

tasks.c:1145 looks like:


What the hell is wrong in here? - Any help appreciated.

greetings from vienna,



RE: Microblaze Port does not compile [edk 9.2

Posted by threinbacher on May 29, 2008
tasks.c:1145 looks like:

}
->portEXIT_CRITICAL();

return xAlreadyYielded;
}

RE: Microblaze Port does not compile [edk 9.2

Posted by Richard on May 29, 2008
Source/include/FreeRTOS.h should include the lines:

#ifndef traceTASK_SWITCHED_OUT
/* Called before a task has been selected to run. pxCurrentTCB holds a pointer
to the task control block of the task being switched out. */
#define traceTASK_SWITCHED_OUT()
#endif

to #define the call away.

Did you base your project on the Xilinx PowerPC port? If so then traceTASK_SWITCHED_OUT is used for the floating point register saves. Check you don't have fpu_macros.h included within FreeRTOSConfig.h.

Regards

RE: Microblaze Port does not compile [edk 9.2

Posted by threinbacher on May 29, 2008
@ Richard

Your hint did the trick. -> Thanks a lot.

It seems that the system with the current interrupt handling executes a reset after the other.
Seems that i run into the same prMore difficult is the change in the way interrupts are installed executed in the later versions of the EDK. This is going to require a code change to fix. It might be that the contributor to the other thread has this fixed already. If you look a couple of threads down the list you will see the one I'm referring to (it has 20 or so replies). I hope to get this updated in the release soon but its not going to be in the next few days. oblem than the other guys here in the forum.

I can provide some code to initialize Timer and the Interrupt Controller for exk 9.2 if needed...

greetings,

RE: Microblaze Port does not compile [edk 9.2

Posted by Erik Andresen on June 1, 2008
No sorry, I havn't fixed it yet. I still have a problem on the stack. I was hoping to find some time on Monday to debug it.
When jumping back from the ISR, I currently miss the return address by two instructions.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists