FreeRTOS on ADuC834 using internal 2k XRAM

nobody wrote on Friday, April 14, 2006:

I tried to port FreeRTOS to Analog Devices ADuC834.
Everything is ok when I only run the idle task (no other task) using 2k of external XRAM. When I switch over to internal 2k XRAM ( CFG834 = 0x01; in _sdcc_external_startup() ) the system hangs up in the macro

#define portCOPY_XRAM_TO_STACK()

because

ucStackBytes = pxXRAMStack[ 0 ];

is not set correctly (value of ucStackBytes is 255).

Is anybody experienced in using FreeRTOS with internal XRAM?
Thank you in advance.

Bernhard

rtel wrote on Sunday, April 16, 2006:

Sorry, I’m not familiar with this device.  Which compiler are you using?  Sounds most likely to be a linker problem.

Regards.

nobody wrote on Monday, April 17, 2006:

Richard, I’m using SDCC 2.5.0. The ADuC834 is controller with an 8051-based core and instruction set and integrated adc and dac peripherals. It runs with 12.58 MHz and 12 clock periodes per machine cycle.

I must use the function vPortInitialiseBlocks() in the _sdcc_external_startup() to get the variable

static size_t xNextFreeByte = ( size_t ) 0;

in heap_1.c set correctly.

Best regards

Bernhard

This is the whole program:

#include <ADuC834.h>

/* Standard includes. */
#include <stdlib.h>
#include <stdio.h>

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

/*-----------------------------------------------------------*/
/*
* startup configuration of controller
*/
unsigned char _sdcc_external_startup( void)
{
  // configure core clock
  PLLCON = 0;        // core clock = 12.582912 MHz
  while ( ( PLLCON & 0x40) == 0 ) ;  // wait for PLL to lock
//  CFG834 = 0x01;        // enable 2k internal XRAM
  // configure UART
  T3CON = 0x85;        // configure timer 3…
  T3FD = 0x12;            // …for 9600 baud
  SCON = 0x52;            // configure UART (using timer 3)

  vPortInitialiseBlocks();
 
  return 0;
}
/*-----------------------------------------------------------*/

/*-----------------------------------------------------------*/
/*
* use the idle task hook for toggling the LED on port P1.1
*/
void vApplicationIdleHook( void )
{
  P1 ^= 0x01;
}
/*-----------------------------------------------------------*/

/*-----------------------------------------------------------*/
/*
* Starts blink task, then starts the scheduler.
*/
void main( void)
{
  char ch;

  ch = getchar();   // wait for keypress to continue
  printf( "\nFreeRTOS Blink Demo\n" );

  /* Finally kick off the scheduler.  This function should never return. */
  /* only use the idle task for tests */
  vTaskStartScheduler();

  printf( "Should never reach here!!!\n" );
 
  /* Should never reach here as the tasks will now be executing under control
  of the scheduler. */
}
/*-----------------------------------------------------------*/