Quality RTOS & Embedded Software

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


Loading

Help porting Renesas H8S from 2329 to 2238

Posted by alfredo on October 17, 2005
Dear Firmware Engineers,

I've just made a first pass at trying to port the H8S from 2329 to 2238. It won't run.

See below for my changes.
Is there anything I've missed?
Is there a "Porting ReadMe" that I could follow?
What should I do next?

Comparing 2329 (old target) with the 2238 (new target):
* Flash PROM: goes from 384K to 256K
* RAM: goes from 32K to 16K
* Crystal: goes from 22.1184 MHz to 12 MHz
* LED Port: goes from Port 2 to Port B

Regards,
Alf Lacis
A.i. Scientific Pty Ltd
10-22 Hornibrook Esplanade
CLONTARF QLD 4019
AUSTRALIA
Ph: (+617 or 07) 3105 5087
www.aiscientific.com
========================================

ParTest.c :
* Change port from Port 2 to Port B (many instances);
* Change partstMAX_LEDs from 7 to 8 (one instance).

FreeRTOSConfig.h :
* configCPU_CLOCK_HZ from 22118400 to 12000000
* configTOTAL_HEAP_SIZE from 15*1024 to 7*1024

main.c :
* mainCOM_TEST_BAUD_RATE from 115200 to 38400


RE: Help porting Renesas H8S from 2329 to 2238

Posted by Richard on October 17, 2005
It might be that the number of tasks included in the demo is too many for the reduced amount of RAM. Does vTaskStartScheduler() (in main()) return? If so then it is indicative of not enough RAM to create the idle task.

Try:

1) First verify that your LED outputs are working without the RTOS running - just by turning them on and off within a loop prior to vTaskStartScheduler() being called.

2) Remove all the tasks other than the flash tasks. This can be done by commenting out the functions that create the demo tasks within main(). Comment out the lines vStartIntegerMathsTasks() all the way down to xTaskCreate( vErrorChecks, ...... ), but leaving in the line vStartLEDFlashTasks().

Do the flash tasks then run when they are the only tasks being created?

Regards.

RE:Help porting Renesas H8S from 2329 to 2238

Posted by alfredo on October 17, 2005
Hi, Richard,<br>
Thanks for your prompt posting.

I already thought of reducing the number of tasks. BTW, the 2238 has only 16K of RAM, which is why I reduced configTOTAL_HEAP_SIZE from 15*1024 to 7*1024.

I also set up some simple flashing before the tasks start:
<H3>int main( void )</H3>
<pre>{
/* Setup the LED's for output. */
vParTestInitialise();

/* For debugging only. */
#define DEBUG_DUMMY_MAX 100000ul
#define DEBUG_CYCLE_MAX 5
/* Block */
{
unsigned long ll;
unsigned char cc;
for ( cc = 0; cc < DEBUG_CYCLE_MAX; cc++ )
{
for ( ll = 0; ll < DEBUG_DUMMY_MAX; ll++ ) { vParTestSetLED(3, 1); }
for ( ll = 0; ll < DEBUG_DUMMY_MAX; ll++ ) { vParTestSetLED(3, 0); }
}
}

/* Start the various standard demo application tasks. */
//vStartIntegerMathTasks( tskIDLE_PRIORITY );
//vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );
vStartLEDFlashTasks( mainLED_TASK_PRIORITY );
//vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
//vStartMathTasks( tskIDLE_PRIORITY );
//vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
//vStartDynamicPriorityTasks();
//vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );

/* Start the 'Check' task. */
//xTaskCreate( vErrorChecks, (char*)"Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );

/* In this port, to use preemptive scheduler define configUSE_PREEMPTION
as 1 in portmacro.h. To use the cooperative scheduler define
configUSE_PREEMPTION as 0. */
vTaskStartScheduler();

/* Should never get here! */
return 0;
}
</pre>
No flashing! So I added this also to here:
<H3>void hw_initialise (void)</H3>
<pre>{
vParTestInitialise();
/* Block */
{
unsigned long ll;
unsigned char cc;
for ( cc = 0; cc < DEBUG_CYCLE_MAX; cc++ )
{
for ( ll = 0; ll < DEBUG_DUMMY_MAX; ll++ ) { vParTestSetLED(2, 1); }
for ( ll = 0; ll < DEBUG_DUMMY_MAX; ll++ ) { vParTestSetLED(2, 0); }
}
}

}
</pre>

I can only think of going to "start.asm" next.<br>
Any ideas,<br>
Alf

RE: Help porting Renesas H8S from 2329 to 2238

Posted by Richard on October 17, 2005
Are you able to step through the code on the target or in the HEW?

I will have to refamiliarise myself with the port, unfortunately I am travelling a bit today and tomorrow so access to email will be somewhat limited.

Regards.

RE:Help porting Renesas H8S 2329 to 2238

Posted by alfredo on October 18, 2005
Hi, Richard,
The 2238 has no on-chip debugging/stepping facilities. There is a simulator in the HEW (Hitachi Embedded Workshop), but AFAIK is really only suitable for Application-level debugging -- certainly not for tracing ISRs.

I have modified 2329S.h to 2238.h with *ONLY* the entries shown in the listing below, and I have modified the two section addresses in the .hwp file using gvim:
-> Replace every occurrence (two) of the string "00FF7C00" with "00FF7000"
(this is the start of on-chip RAM).
->Replace every occurrence (two) of the string "00FFFBFE" with "00FFEFBE"
(this is the top of RAM-1=H'FFFBFF-1 changed to H'FFEFBF-1: Stack Address).

Now, pre-task code has LED functionality (using vParTestSetLED(1, 1);). After the LED task is registered & kernel started, the LEDs do not cycle.

I will review the timer hardware registers -- it's not clear in the original 2329 build what was going on in these hardware registers -- I'll document what is going on & see if the 2238's registers are capable of performing the same function.

Thanks for your suggestions,
Alf Lacis

========================================
#ifndef __2238_h__
#define __2238_h__ 1

// LEDs
#define PEDDR ( *( ( volatile unsigned char * ) 0xFFFE3D ) )
#define PEDR ( *( ( volatile unsigned char * ) 0xFFFF0D ) )
#define PEPCR ( *( ( volatile unsigned char * ) 0xFFFE44 ) )
#define PORTE ( *( ( volatile unsigned char * ) 0xFFFFBD ) )

// Timer
#define MSTPCR ( *( ( volatile unsigned short * ) 0xFFFDE8 ) )
#define TCR1 ( *( ( volatile unsigned char * ) 0xFFFF20 ) )
#define TGR1A ( *( ( volatile unsigned short * ) 0xFFFF28 ) )
#define TIER1 ( *( ( volatile unsigned char * ) 0xFFFF24 ) )
#define TSTR ( *( ( volatile unsigned char * ) 0xFFFEB0 ) )
#define TSR1 ( *( ( volatile unsigned char * ) 0xFFFF25 ) )

// Serial Port
#define SCR1 ( *( ( volatile unsigned char * ) 0xFFFF82 ) )
#define BRR1 ( *( ( volatile unsigned char * ) 0xFFFF81 ) )
#define RDR1 ( *( ( volatile unsigned char * ) 0xFFFF85 ) )
#define SSR1 ( *( ( volatile unsigned char * ) 0xFFFF84 ) )
#define TDR1 ( *( ( volatile unsigned char * ) 0xFFFF83 ) )

#endif // #ifndef __2238_h__
========================================

RE:Help porting Renesas H8S 2329 to 2238

Posted by Nobody/Anonymous on October 18, 2005
I'm not familiar with the HEW, but often if you turn off preemption then you can debug in a simulator enough to see where a problem might be. Stepping through the scheduler starting up at least.


[ 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