28.01.2013 Views

Application Note Testing C167 Single Chip Applications - Hitex

Application Note Testing C167 Single Chip Applications - Hitex

Application Note Testing C167 Single Chip Applications - Hitex

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Hitex</strong> Germany<br />

– Head Quarters –<br />

Greschbachstr. 12<br />

76229 Karlsruhe<br />

Germany<br />

� +049-721-9628-0<br />

Fax +049-721-9628-149<br />

E-mail: Sales@hitex.de<br />

WEB: www.hitex.de<br />

<strong>Hitex</strong> UK<br />

Warwick University<br />

Science Park<br />

Coventry CV47EZ<br />

United Kingdom<br />

� +44-24-7669-2066<br />

Fax +44-24-7669-2131<br />

E-mail: Info@hitex.co.uk<br />

WEB: www.hitex.co.uk<br />

<strong>Application</strong> <strong>Note</strong><br />

<strong>Hitex</strong> USA<br />

2062 Business Center Drive<br />

Suite 230<br />

Irvine, CA 92612<br />

U.S.A.<br />

� 800-45-HITEX (US only)<br />

� +1-949-863-0320<br />

Fax +1-949-863-0331<br />

E-mail: Info@hitex.com<br />

WEB: www.hitex.com<br />

<strong>Testing</strong> <strong>C167</strong> <strong>Single</strong> <strong>Chip</strong> <strong>Application</strong>s<br />

This application note describes how to adapt the standard test<br />

application created by Tessy to a <strong>C167</strong> running without external<br />

memory.<br />

It assumes some familiarity with Infineon's <strong>C167</strong> architecure,<br />

the in-circuit emulator DProbe167 from <strong>Hitex</strong>, and Tasking's<br />

cross compiler for <strong>C167</strong>.<br />

This is a very specialized and detailed application note and<br />

does not serve as an introduction to Tessy.<br />

Architecture: TESSY<br />

Author: Frank Buechner<br />

Revision: 01/2008 - 003<br />

© Copyright 2008 - <strong>Hitex</strong> Development Tools GmbH<br />

All rights reserved. No part of this document may be copied or reproduced in any form or by any means without prior written consent of <strong>Hitex</strong> Development Tools. <strong>Hitex</strong> Development Tools retains<br />

the right to make changes to these specifications at any time, without notice. <strong>Hitex</strong> Development Tools makes no commitment to update nor to keep current the information contained in this<br />

document. <strong>Hitex</strong> Development Tools makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular<br />

purpose. <strong>Hitex</strong> Development Tools assumes no responsibility for any errors that may appear in this document. DProbe, <strong>Hitex</strong>, HiTOP, Tanto, and Tantino are trademarks of <strong>Hitex</strong> Development<br />

Tools. All trademarks of other companies used in this document refer exclusively to the products of these companies.<br />

<strong>Application</strong><strong>Note</strong>.dot - 11/2007 - 005


<strong>Application</strong> <strong>Note</strong><br />

Preface<br />

In order to keep you up-to-date with the latest developments on our products, we provide <strong>Application</strong><br />

<strong>Note</strong>s containing additional topics, special hints, examples and detailed procedures etc.<br />

For more information on the current software and hardware revisions, as well as our update service,<br />

please contact www.hitex.de, www.hitex.co.uk or www.hitex.com.<br />

Contents<br />

1 <strong>Testing</strong> <strong>C167</strong> <strong>Single</strong> <strong>Chip</strong> <strong>Application</strong>s 3<br />

1.1 Microcontroller Specific Issues 3<br />

1.2 Using the Tasking Development Environment 4<br />

1.2.1 Startup 4<br />

1.2.2 Considerations for Locating 6<br />

1.3 Using DProbe167 with HiTOP 4 7<br />

1.3.1 Set Mode 7<br />

1.3.2 Do Not Map 7<br />

1.4 <strong>Testing</strong> <strong>Single</strong> <strong>Chip</strong> <strong>Application</strong>s with Tessy 7<br />

1.4.1 Startup 7<br />

1.4.2 Reducing the Data Size Required by Tessy 8<br />

1.4.3 Setting the Memory Model 10<br />

1.4.4 Locating 11<br />

1.4.5 Avoid Mapping by Tessy 12<br />

1.5 Versions Used 12<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 2/12


<strong>Application</strong> <strong>Note</strong><br />

1 <strong>Testing</strong> <strong>C167</strong> <strong>Single</strong> <strong>Chip</strong> <strong>Application</strong>s<br />

Caution:<br />

This is a very specialized and detailed application note. You should be familiar with the<br />

Infineon <strong>C167</strong> architecture, the in-circuit emulator DProbe167, and the Tasking compiler for<br />

<strong>C167</strong>.<br />

It is no introduction to Tessy!<br />

1.1 Microcontroller Specific Issues<br />

If a <strong>C167</strong> microcontroller comes up in single chip mode or not, is determined during the power-up /<br />

reset of the microcontroller. The outcome is reflected in the bit 10 (ROMEN) of the register SYSCON,<br />

which is set to 1, if single chip mode is enabled. The default value of the register SYSCON is 0x0000,<br />

with ROMEN enabled, it becomes 0x0400.<br />

If <strong>Single</strong><strong>Chip</strong> mode is enabled, the microcontroller is supposed to use only chip-internal memory,<br />

especially internal ROM for Code and internal RAM for data.<br />

Using a <strong>C167</strong>CR, the internal ROM is 32k Bytes wide and normally starts at address 0 (0x0000 –<br />

0x7FFF). (The internal ROM can be remapped to start in segment 1 (0x10000 – 0x17FFFF) by the bit<br />

ROMS1 (bit 12) of the SYSCON register.)<br />

Using a <strong>C167</strong>CR, the internal RAM is 2k Bytes wide and starts at address 0xF600 (0xF600 –<br />

0xFDFF).<br />

Using a <strong>C167</strong>CR, the on-chip extension RAM (XRAM) is 2k Bytes wide and start at address 0xE000<br />

(0xE000 – 0xE7FF). The XRAM is not enabled by default, but must be enabled via bit 2 (XPEN) of the<br />

register SYSCON.<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 3/12


<strong>Application</strong> <strong>Note</strong><br />

1.2 Using the Tasking Development Environment<br />

The following reflects Tasking V8.0 R02 for <strong>C167</strong>/ST10.<br />

For a single chip application, the tiny memory model is appropriate, because all memory addresses<br />

are < 64k Bytes.<br />

The tiny model is not required, the small model should also work.<br />

1.2.1 Startup<br />

The startup code stemming from the Tasking development environment (and included in a Tasking<br />

<strong>C167</strong> application) sets the value of the register SYSCON. By default, SYSCON is set to 0x0000. This<br />

value would disable the internal ROM, therefore, provisions must be made to use startup code which<br />

sets the ROMEN bit not to 0.<br />

Because we would like to use the XRAM also, we must take provisions that bit 2 (XPEN) is set.<br />

With SYSCON = 0x0404, both ROMEN and XPEN is set.<br />

This can be done in the Tasking EDE:<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 4/12


<strong>Application</strong> <strong>Note</strong><br />

This results in the following startup code and settings of SYSCON:<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 5/12


<strong>Application</strong> <strong>Note</strong><br />

1.2.2 Considerations for Locating<br />

Next, care must be taken that program code is located to the internal ROM and data is located in the<br />

internal RAM of the microcontroller.<br />

By default, program code is located to 0, so there is nothing special to do.<br />

The data portion of an application consists (at least) of the variables of the application, the (user and<br />

system) stack, and the heap. Also the register bank resides in data memory.<br />

However, by default (and appropriate for external applications), data is located mixed with code, i.e. by<br />

default data would be located to the internal ROM memory, what will cause the application to fail, e.g.<br />

because variables cannot be written by the program.<br />

Therefore, care must be taken, that data is located in the IRAM and the XRAM. This can be done by<br />

using CLASSES locator directives. Also some memory areas have to be reserved for microcontroller<br />

purposes.<br />

Section "Locating" on p. 11 describes how these considerations result in instructions for the locator.<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 6/12


<strong>Application</strong> <strong>Note</strong><br />

1.3 Using DProbe167 with HiTOP 4<br />

1.3.1 Set Mode<br />

Setup > pRocessor > System Startup configuration:<br />

Default: 16 bit external<br />

Set to: <strong>Single</strong> chip<br />

1.3.2 Do Not Map<br />

When emulating in single chip mode, the DProbe167 automatically provides emulation memory for the<br />

internal ROM.<br />

Therefore, there is no need to use the Setup > Map command to map any memory.<br />

1.4 <strong>Testing</strong> <strong>Single</strong> <strong>Chip</strong> <strong>Application</strong>s with Tessy<br />

Please read the Tessy document 006 "Customizing Makefile Templates" !<br />

Use the help menu of Tessy: Help > Documents > Customization > Makefile templates.<br />

By default, the test application created by Tessy assumes a DProbe167 in external mode. Therefore,<br />

the creation process of the test application has to be changed with the two objectives:<br />

•<br />

•<br />

The startup code must not set SYSCON to 0, but to 0x0404.<br />

The near data must be located to the internal RAM. As a prerequisite for this, the data size required<br />

by Tessy must be reduced.<br />

1.4.1 Startup<br />

We take a start.obj holding the statup code assembled from start.asm, where SYSCON is not set to 0<br />

but to 0x0404. We could get such a file from a single chip application generated by the Tasking EDE<br />

or from the original user application.<br />

In our case, we have created a single chip application in the directory<br />

c:\Tessy\Tasking166_projects\<strong>Single</strong><strong>Chip</strong>\167cr<br />

and can take the start.obj from there<br />

c:\Tessy\Tasking166_projects\<strong>Single</strong><strong>Chip</strong>\167cr\start.obj<br />

We manipulate the appropriate makefile template, in our case<br />

c:\Programme\Razorcat\tessy\sys\templates\make\ts_make_hitop_tasking_c166.tpl<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 7/12


<strong>Application</strong> <strong>Note</strong><br />

Original content:<br />

S_LINK_OPTIONS := $(TASKING_HOME)\lib\ext\c166s.lib $(T7_FLOAT_LIB)<br />

$(T6_FLOAT_LIB) $(TASKING_7_LIB) CASE NOCC -Wo'SECSIZE(C166_US(1024))<br />

RESERVE( MEMORY( 0E800h - 0EFFFh )) RESERVE( MEMORY( 0F200h - 0F9FFh ))'<br />

Manipulated content:<br />

S_LINK_OPTIONS :=<br />

C:\Tessy\Tasking166_projects\<strong>Single</strong><strong>Chip</strong>\167cr\start.obj<br />

$(TASKING_HOME)\lib\ext\c166s.lib $(T7_FLOAT_LIB) $(T6_FLOAT_LIB)<br />

$(TASKING_7_LIB) CASE NOCC -Wo'SECSIZE(C166_US(1024)) RESERVE( MEMORY(<br />

0E800h - 0EFFFh )) RESERVE( MEMORY( 0F200h - 0F9FFh ))'<br />

If start.obj is not explicitly given to the Tasking linker, the Tasking linker takes start.obj from the library,<br />

in this case ...\lib\ext\c166s.lib. In our case, the linker finds the start.obj, which sets SYSCON to<br />

0x0404 first, and therefore there is no need to take start.obj from the library.<br />

1.4.2 Reducing the Data Size Required by Tessy<br />

The test application (i.e. the program that is loaded by Tessy in the in-circuit emulator) contains a<br />

communication buffer. The size of this buffer is by default 1024 bytes.<br />

Because the test application can only use the chip-internal resources for RAM (on a <strong>C167</strong>CR 2k Bytes<br />

IRAM + 2k Bytes XRAM = 4k Bytes) and this RAM must also hold registers, system stack etc., it is a<br />

good idea to reduce the data size required for the communication buffer.<br />

This can be done by making two changes:<br />

(1) Edit the file tslow.h in the installation directory of Tessy, e.g.<br />

c:\Programme\Razorcat\tessy\sys\include\Tessy\comm\tslow.h<br />

In the tslow.h file, change<br />

/**<br />

* Communication Buffer Sizes<br />

*/<br />

#if defined (TS_SOCKET)<br />

#define TSLOW_CONNECTION_LENGTH 10240<br />

#elif defined(TS_HITOP) || defined(TS_CROSSVIEW)<br />

#define TSLOW_CONNECTION_LENGTH 1024<br />

#elif defined(TS_FASTVIEW66) || defined(TS_SSTEP)<br />

#define TSLOW_CONNECTION_LENGTH 1000<br />

#elif defined(TS_SOFTUNE) || defined(TS_UDE)<br />

#define TSLOW_CONNECTION_LENGTH 512<br />

#elif defined(TS_CSPY)<br />

#define TSLOW_CONNECTION_LENGTH 256<br />

#elif defined(TS_SM78K0S)<br />

#define TSLOW_CONNECTION_LENGTH 16<br />

#else<br />

#define TSLOW_CONNECTION_LENGTH 128<br />

#endif<br />

to<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 8/12


<strong>Application</strong> <strong>Note</strong><br />

/**<br />

* Communication Buffer Sizes<br />

*/<br />

#if defined (TS_SOCKET)<br />

#define TSLOW_CONNECTION_LENGTH 10240<br />

#elif defined(TS_HITOP) || defined(TS_CROSSVIEW)<br />

#define TSLOW_CONNECTION_LENGTH 256<br />

#elif defined(TS_FASTVIEW66) || defined(TS_SSTEP)<br />

#define TSLOW_CONNECTION_LENGTH 1000<br />

#elif defined(TS_SOFTUNE) || defined(TS_UDE)<br />

#define TSLOW_CONNECTION_LENGTH 512<br />

#elif defined(TS_CSPY)<br />

#define TSLOW_CONNECTION_LENGTH 256<br />

#elif defined(TS_SM78K0S)<br />

#define TSLOW_CONNECTION_LENGTH 16<br />

#else<br />

#define TSLOW_CONNECTION_LENGTH 128<br />

#endif<br />

in order to reduce the buffer size from 1024 to 256 Bytes.<br />

(2) In Tessy, create a new attribute named "BufferSize" for the respective Tessy module / testobject<br />

("Properties" in the context menu of the module / testobject > "Attributes" tab).<br />

and set the value of that attribute to the same size as in tslow.h.<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 9/12


<strong>Application</strong> <strong>Note</strong><br />

1.4.3 Setting the Memory Model<br />

By default, the test application created by Tessy uses the small memory model.<br />

What has to be done to use the tiny model?<br />

•<br />

•<br />

Create start.obj in the tiny model.<br />

In the makefile template:<br />

(1) Change the compiler command line option –Ms to –Mt:<br />

S_COMP_OPTIONS := -x -g -O0 -Mt -w -s -DTESSY -DTS_SLAVE -DTS_HITOP -<br />

DTS_C166<br />

(2) Change the model of the libraries linked to the test application from<br />

TASKING_7_LIB := $(shell tessy_file_exist<br />

"$(TASKING_HOME)\lib\ext\rt166s.lib")<br />

T7_FLOAT_LIB := $(shell tessy_file_exist<br />

"$(TASKING_HOME)\lib\ext\fp166s.lib")<br />

T6_FLOAT_LIB := $(shell tessy_file_exist<br />

"$(TASKING_HOME)\lib\ext\ntf166t.lib")<br />

to<br />

TASKING_7_LIB := $(shell tessy_file_exist<br />

"$(TASKING_HOME)\lib\ext\rt166t.lib")<br />

T7_FLOAT_LIB := $(shell tessy_file_exist<br />

"$(TASKING_HOME)\lib\ext\fp166t.lib")<br />

T6_FLOAT_LIB := $(shell tessy_file_exist<br />

"$(TASKING_HOME)\lib\ext\ntf166t.lib")<br />

(3) Change the linker options from<br />

S_LINK_OPTIONS := … $(TASKING_HOME)\lib\ext\c166s.lib …<br />

to<br />

S_LINK_OPTIONS := … $(TASKING_HOME)\lib\ext\c166t.lib …<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 10/12


<strong>Application</strong> <strong>Note</strong><br />

1.4.4 Locating<br />

CUSTACK is the class name for the stack and heap.<br />

CNEAR is the class name for the "near data", i.e. the variables.<br />

CINITIRAM is the class name for initialized variables.<br />

Use the CLASSES and RESERVE directives of the locator to place the data to the desired memory<br />

addresses ...<br />

-Wo'SECSIZE(C166_US(1024)) IRAMSIZE(2048)\<br />

RESERVE( MEMORY( 0E800h - 0EEFFh ))\<br />

RESERVE( MEMORY( 0F200h - 0F5FFh ))\<br />

CLASSES(CINITIRAM(0xf620 TO 0xf6FF))\<br />

CLASSES(CUSTACK(0xE000 TO 0xE3FF))\<br />

CLASSES(CNEAR(0xE400 TO 0xE7FF))'<br />

... in the makefile template file. This results in the following memory map:<br />

Name No. Start End Length Type<br />

---------------------------------------------------------------<br />

?INTVECT................... ... 000000h 0001FFh 000200h ....<br />

TS_IS_VALUE_IN_RANGE_S_IR_N 0 000200h 000201h 000002h LDAT<br />

C166_INIT.................. 5 000202h 000213h 000012h LDAT<br />

C166_BSS................... 6 000214h 00022Dh 00001Ah LDAT<br />

TSLOWS_HITOP_3_CO.......... 9 00022Eh 000236h 000009h LDAT<br />

TSTCOMM_IR_NB.............. 10 000238h 000238h 000001h LDAT<br />

TS_IS_VALUE_IN_RANGE_S_3_PR 2 00023Ah 000487h 00024Eh CODE<br />

TSLOWS_HITOP_1_PR.......... 7 000488h 000749h 0002C2h CODE<br />

TSTCOMM_3_PR............... 12 00074Ah 000ADDh 000394h CODE<br />

TS_TIMER_C166_1_PR......... 13 000ADEh 000B79h 00009Ch CODE<br />

TSCOML_1_PR................ 15 000B7Ah 000EE3h 00036Ah CODE<br />

TS_SRC01_1_PR.............. 17 000EE4h 000F35h 000052h CODE<br />

TS_IS_VALUE_IN_RANGE_USR_1_ 18 000F36h 000F45h 000010h CODE<br />

__C_INIT_PR................ 19 000F46h 000F9Fh 00005Ah CODE<br />

__CSTART_PR................ 20 000FA0h 000FE9h 00004Ah CODE<br />

__FPCODE................... 21 000FEAh 001011h 000028h CODE<br />

C166_US.................... 4 00E000h 00E3FFh 000400h LDAT<br />

TS_IS_VALUE_IN_RANGE_S_4_NB 3 00E400h 00E415h 000016h LDAT<br />

TSLOWS_HITOP_2_NB.......... 8 00E416h 00E625h 000210h LDAT<br />

TS_TIMER_C166_2_NB......... 14 00E626h 00E6F5h 0000D0h LDAT<br />

TSCOML_2_NB................ 16 00E6F6h 00E6FBh 000006h LDAT<br />

Reserved................... ... 00E800h 00EEFFh 000700h ....<br />

Extended SFR Area.......... ... 00F000h 00F1FFh 000200h ....<br />

Reserved................... ... 00F200h 00F5FFh 000400h ....<br />

Reg. bank 0................ ... 00F600h 00F61Fh 000020h ....<br />

TS_IS_VALUE_IN_RANGE_S_ID_N 1 00F620h 00F621h 000002h LDAT<br />

TSTCOMM_ID_NB.............. 11 00F622h 00F622h 000001h LDAT<br />

System Stack............... ... 00FA00h 00FBFFh 000200h ....<br />

SFR Area................... ... 00FE00h 00FFFFh 000200h ....<br />

The first 1k of the XRAM is used for the user stack (0xE000 – 0xE3FF).<br />

The second 1k of the XRAM is used for the data of the test application.<br />

The first 32 Bytes of the IRAM are used for the register bank 0 (0xF600 – 0xF61F).<br />

The system stack follows the initialized data (two parts) of the application (0xF620 – 0xF622).<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 11/12


<strong>Application</strong> <strong>Note</strong><br />

1.4.5 Avoid Mapping by Tessy<br />

Normally, Tessy maps emulation memory. This is done by sending the HiSCRIPT commands in<br />

c:\Tessy\hitop_init_c166.scr<br />

to HiTOP.<br />

The standard contents of c:\Tessy\hitop_init_c166.scr is<br />

// This is a Tessy generated init script for HiTOP C16x / ST10<br />

// You may edit this script but BE CAREFUL WITH ANY CHANGES!<br />

LOAD OBJECT ""<br />

MAP REMOVE<br />

BREAK REMOVE<br />

// Setup memory map<br />

MAP M1 AT 0x0000 END 0x7FFF<br />

MAP M2 AT 0xC000 END 0xFFFF<br />

MAP M3 AT 0x10000 END 0xFFFFF<br />

Changing this to<br />

// This is a Tessy generated init script for HiTOP C16x / ST10<br />

// You may edit this script but BE CAREFUL WITH ANY CHANGES!<br />

LOAD OBJECT ""<br />

MAP REMOVE<br />

BREAK REMOVE<br />

// Setup memory map<br />

// MAP M1 AT 0x0000 END 0x7FFF<br />

// MAP M2 AT 0xC000 END 0xFFFF<br />

// MAP M3 AT 0x10000 END 0xFFFFF<br />

avoids mapping by Tessy. (It is not harmful if mapping stays enabled.)<br />

1.5 Versions Used<br />

Tessy V2.2.15<br />

Tasking V8.0 R02 for <strong>C167</strong>/ST10<br />

HiTOP V4.11 for DProbe167<br />

© Copyright 2008 <strong>Hitex</strong> Development Tools GmbH Page 12/12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!