Home

For M16C/60,30,Tiny,20,10,R8C/Tiny series C

image

Contents

1. New Project Workspace Projects ie Application Ts Empty Application KEN Import Makefile Library Generated Files Aoplestr Properties 1 Workspace Name Project Name a Directory IF WorkS pace Browse CPU family M16C Tool chain Renesas M16C Standard z The C language startup includes the following files 1 resetprg c Initializes the microcomputer 2 initsct c Initializes each section by clearing them to 0 and transferring initial values 3 heap c Reserves storage for the heap area 4 fvector c Defines the fixed vector table 5 intprg c Declares the entry function for variable vector interrupts 6 firm c firm_ram c Reserves storage for the program and workspace areas used by firm of FoUSB E8 as dummy areas when OnChipDebugger is selected Please do not alter the file 7 estartdef h Defines the sizes of stack and heap 8 initsct h Contains statements for the processes assembler macros that initialize each section Please do not alter the file 15 28 REJ10J1778 0100 9 resetprg h Includes each header file 10 typedef h Declares each type by typedef Please do not alter the file 11 sfrXX h sfrXX inc The sfr definition header file of CPU chosen when a project was created is registered to the work space 6 2 Processing of Each Generated File resetprg c essential The content of this file va
2. The compiler does not create any temporary variables 10 28 REJ10J1778 0100 Example void sub unsigned int void func void Condition 3 sub 10 Workaround Do Not select compile option Ostack_frame_align OSFA or use genter along with Ostack_frame_align OSFA 3 4 17 Precaution about performing right shift operations Under the condition that an optimizing option is selected at compilation System Error may arise if the result of shifting a 32 bit data piece to the right by the number of bits within a range of 11 to 15 is directly stored in or cast to a variable of 16 bits long Tool News http tool support renesas com eng toolnews 070716 tn4 htm Conditions This problem may occur if the following conditions are all satisfied 1 Any of the following optimizing options is selected to enhance the speed of program execution and minimize ROM consumption O OR and OR_MAX 2 A data piece of 32 bits long is shifted right by the number of bits within a range of 11 to 15 3 The result in 2 above is directly stored in or cast to a variable of 16 bits long 4 The compiler specifies the register in which the data piece to be shifted in 2 and the 16 bit variable in 3 are stored Example int i long 1 1 nt 1 gt gt 15 Workaround Do not directly store the result of right shifting a 32 bit data piece in or cast it to a 16 bit variable but assign it t
3. gnone finfo fNII misra_all r csv MISRA C Checker SQMiint V 1 00 Release 1A 5 2 Conformance with MISRA C Rule in HEW Generation Source Code In C Source code that HEW High performance Embedded Workshop generates automatically it is found that some rules are against the MISRAC Rule but these violations do not constitute a drawback to any operation 5 2 1 Cause of Rule Violation In C Source code that HEW generates the major causes for rule violation are as follows C Compiler specifications pragma etc cope of variable defined by Header File Definition of type used in Bit Field 5 2 2 Inspection No running counter to the rule The following are Inspection Nos that run counter to the Rule 1 13 14 18 22 54 59 71 99 110 111 115 126 5 2 3 Evaluation Environment Compiler M38T NC380WA V 5 44 Release 00 Compile Option c misra_all MISRA C Checker SQMiint V 1 03 Release 00 1 These results were produced after inspection using MISRAC Rule Checker SQMLint 14 28 6 C language Startups 6 1 REJ10J1778 0100 V 5 40 Release 00 A or earlier version of compilers does not support startup programs written in C language Please note that the conventional startups written in assembler such as ncrt0 a30 sect30 inc and nc_define inc can be used the same way as in the past To use the conventional ncrt0 a30 sect30 inc and nc_define inc select Application indicated by 1 in the new project workspace below
4. 28 Te REJ10J1778 0100 About Installation of C compiler Package For details on how to install please refer to C Compiler Package Guidebook 2 The latest information Please refer to the following for the latest information on this product http tool support renesas com eng toolnews p_m16c_1 htm 3 Precautions on Product 3 1 3 2 3 3 When using the compiler please be sure to follow the precautions and suggestions described below About Integrated Development Environment TM TM does NOT support M8T NC30WA V 5 44 Release 00 Therefore the following cannot be specified 1 Create a new project of M38T NC30WA V 5 44 Release 00 with TM 2 Port the projects created by TM to High performance Embedded Workshop Please refer to C Compiler Package Guidebook for the method of porting the project created by TM to High performance Embedded Workshop About the version of MR30 Real time OS This C compiler can be used with M38T MR30 V 3 30 Release 1 or later versions Caution When you install M3T MR30 please be sure to install in the same directory bin lib30 inc30 as this C compiler package Precautions on M16C Family Dependent Code 3 3 1 Precautions regarding the M16C interrupt control register When O5 optimizing option is used the compiler generates in some cases BTSTC or BTSTS bit manipulation instructions In M16C the BTSTC and BTSTS bit manipulation instructions are prohibited from rewri
5. Fills fixed vectors other than reset with a dummy function dummy_int oragma interrupt v Function_Name The Function_Name is registered in the vector table When the function is defined this definition needs pragma interrupt 3 Defines the entry function The function to be executed upon reset is registered in a fixed vector intprg c This file may be needed depends on the target MCU II DMAO software int 8 pragma interrupt _dmaO vect 8 void _dma0 void II DMA1 software int 9 pragma interrupt _dmal vect 9 void _dma1 void DMA2 software int 10 pragma interrupt _dma2 vect 10 void _dma2 void DMAS software int 11 pragma interrupt _dma3 vect 11 void _dma3 void Skipped 1 Declares the variable vector interrupt function The functions corresponding to each variable vector interrupt function are declared A variable vector table is generated at the same time 2 Defines the variable vector interrupt function Please write the content of processing in the functions corresponding to the interrupt vector numbers used Example To use interrupt vector number 9 DMA1 void _dmal void 4 Omission 3 If intprg c is unnecessary Please remove it from file registration to exclude it from the target to be linked firm c firm_ram c Only when on chip debugger is selected DO NOT change the content of this file directly The content is altered automatically depending on t
6. inline assemble features such as pragma ASM pragma ENDASM directives and asm function C compilers cannot hold information on the scopes of the above mentioned arguments and register variables So be sure to save and restore register contents on and from the stack when registers are loaded using inline assemble functions described above 3 4 8 Precautions about debugging of a program using _Bool type When you debug the program which uses the _BOOL type please confirm whether the debugger supports the _BOOL type In using the debugger which does not support the _BOOL type please use a debugging option gbool_to_char gBTC at the time of compile 3 4 9 Precautions regarding the preprocessing directive define To define a macro which will be made the same value as the macro ULONG_MAX always be sure to add the suffix UL 3 4 10 Precautions on macro definition If the name of a macro itself is used in the content of a macro definition and the defined macro is specified in an argument to other function like macro macro replacement cannot be executed correctly Example int a 10 define a at define p x y X t y macro name a w void func void int i p a a results in i 80 i 40 is correct Workaround Make sure the macros passed to the arguments to function like macros are defined with a name that is not used in the macro definition int a 10 define b ata C
7. oc cccccsscsessssssescssssescssesssessssssesssssscsescsssseseseesesesesesssseseesssesesesseseseesesesssseseseeseseseeeseseaneeseaeens 12 3 5 Suggestions Concerning File Names cccsssssssssssssscsssesssescsescscscscsescssscsssssesssesssesescscsesescsesssescecsacsssesesescsesescsescseseeessesees 12 3 6 Precautions about virus check programs cccccssssssssssssesesssssscsescsessescsssesesssssesesscssscsesesesssecseseseseseaeeescseseseseeecaeeeseaeeeseeees 12 REJ10J1778 0100 4 Contents of upgrade from V 5 43 Release 00 cccscssssssescsescsescsssescssssssssssssssesssesesesesescsesessscssscsesssussesescsesesesescseacssscssecseecseecees 13 4 1 Contents of upgrade about C compiler cccccesssessssssssssssssssessscscsescsescsescscsessscsssssesssssesssesssesesessesseesseessneceseseesseessensaes 13 A VAS Function improvement asss a aeii a a e a a e e r aa a Re E e a i Ti aid 13 AAV Wixed Probleme 2tscncciitsaccccecsacscvstostel a R E E A noes cchsadeiedl 13 4 2 Contents of upgrade about C language startup files oc cccccsecsssesssescsescssscssscsescsessssscssssesssesesssesssesescecsnscenscssenssesssensaes 13 4 2 1 Addition of C language startup files ccccccssessssssscsesssessssscssscssesssesssesssesssescacscecscssscsssesessssssesescsescsescsssceseeseseseeeees 13 42 2 lt Wied Problems eane EE A E A ERA 13 4 3 Content of upgrade about Assembler startup files ccccccccsessesssessscscsescssscsssessscsssssesssssesesesess
8. Generated PR What kind of initialization routine would you like to create q q None Firmware Address Generate main Function e source file X Use OnChip Debugging Emulator b a WorkRAM Address Size Ba lt Back n Finish Cancel 4 Select this check box when you use the standard function library When this check box is selected function calls to _init0 in resetprg c are enabled Furthermore device c and init c are registered to the project 5 Select this check box when you use the memory management function library When this check box is selected function calls to heap_init in resetprg c are enabled Furthermore heapdef h and heap c are registered to the project 24 28 4 5 REJ10J1778 0100 Select OnChipDebugger New Project 2 5 Setting the Contents of Files to be Generated S What kind of initialization routine would you like to create g Use Standard I 0 vos 8 IV Use Heap Memory Heap Size 0x300 Generate main Function Ic source file T 7 6 Select the appropriate debugger when you use OnChipDebugger You can select either FoUSB or E8 as debugger However there may be a case when you can t select one of or both of the debuggers depending on the target MCU When this selection is made firm c is registered and the area for the debugger displayed at 7 is saved as the variable area Duplication of the user s program and
9. REJ10J1778 0100 For M16C 60 30 Tiny 20 10 R8C Tiny series C compiler Package V 5 44 Release 00 Release note Rev 1 00 Renesas Solutions Corporation Apr 16 2008 Abstract Welcome to M16C 60 30 Tiny 20 10 R8C Tiny series C compiler Package M3T NC30WA V 5 44 Release 00 This document contains supplementary descriptions to User s Manual When you read certain items in the User s Manual please read this document as well 1 2 3 About Installation of C compiler Package cccssssssssssssssssssssssssesesssesssssssesssessesssssssesesssseseseesesessssesesesssseseesssesesnsseseseeesseseaeees 3 The atest mOra iO i a E E E R E R a E R tiated devsetbones Precautions on Product 3 1 About Integrated Development Environment TM ccccssssssssssssssssssssssssssescssssssessesesessssesssesesseescssseeuseseeessaseseaeseeseeaes 3 3 2 About the version of MR30 Real time OS scscssssssssssssssssssssssscssesssscssesssecssscssssssecssecasecssecssecssscasecssscsssecsscsssecsscssscesscesseeses 3 3 3 Precautions on M16C Family Dependent Code ccccccsssesssescsesesesesssesesessscsssscsssesssesesescsesesescsssesescseessessessseseseseseacseseneaes 3 3 3 1 Precautions regarding the M16C interrupt control register c c cccscssscsssesssesesssssscsccsssescsescscscsescecsesceeeeseeseseseseseaes 3 3 3 2 Precautions about access Of SFR area cccecsssssssessssssessssssssesessssesessssssesesssesesessssesessesssesessssesesesseseesesesesesee
10. STACKSIZE _ 0x80 define__ISTACKSIZE _ 0x80 define__HEAPSIZE _ 0x80 26 28 List of registered files New Project 5 5 Changing the File Names to be Created resetprg initsct initsct fyvector intprg sht62 sft62 heap test10 cstartdef Next Finish Cancel Here you can check the list of files to be registered Section order Renesas M16C Standard Toolchain Configuration Debug E All Loaded Projects aften k C source file Assembly source file C Assembly Link Librarian Lme Cia M4 gt Category lt n A Section Graci Section define scalar types initialize for C language include some headder initialize each sections define the macro for in define the fixed vector define the top address define the sfr register define the sfr register define the size of hear main program file define the size of stacl Addres OxQ0000300 FirmRam OxO0000400 data_SE bss SE bss 50 data NE bss NE data_NO bss NO Options Link L r8clib G 8002000 Firn rea MS 0 CONFIGDIR PROJECTNAME x30 ORDER FirmRam_NE 0300 data_SE 0400 bss_5E data_50 bss_ REJ10J1778 0100 1 To confirm the order in which sections are linked and the addresses to which they are linked take a look at 27 28 REJ10J1778 0100 Category Section Order in Renesas M16C Standard Toolchain Link Sec
11. The standard I O functions consume much RAM If you use the standard I O functions in your program for R8C Tiny Series you cannot use f E e g G for printf The standard I O functions contained in M8T NC30WA V 5 44 Release 00 don t support M16C 64 and M16C 65 3 4 6 Precautions about the search of an include file If you specify a file to include with a drive name in the include line and attempt to compile the file from a directory different from the one in which the file to compile is present instances may occur in which the file to include cannot be found Example include c user test sample h main C user gt nc30 userttest2 sample c silent user2 tm_test aa c Error cpp30 21 user2 test2 sample c line 1 include file not found c user test sample h 6 28 REJ10J1778 0100 3 4 7 Precautions to be taken when using 4pragma ASM ENDASM and asm0 Regarding debug information when using pragma ASM ENDASM and asm 0 outside functions if you write pragma ASM anywhere outside functions no C source line information will be output For this reason information regarding descriptions in pragma ASM to pragma ENDASM such as error message lines when assembling or linking and line information when debugging may not be output normally C compilers generate code of arguments to be passed via registers and of register variables by analyzing their scopes However if manipulations of register values are described using
12. Write enabled 5 Sets the processor mode register to single chip mode If modes need to be changed this expression must be altered 6 Sets the protect register to Write inhibited 7 Sets the U flag If you chose Use the user stack in the workspace creation wizard the user stack pointer is set 8 Initializes the user stack pointer if you chose Use the user stack in the workspace creation wizard 9 Sets the SB register to address 0x400 which sets the start address of RAM 10 Sets the variable vector address in the INTB register 11 Initializes each section by clearing them to 0 and transferring initial values 12 Initializes the stack pointer again after the initialization of sections 13 Initializes the heap area If memory management functions are used call to this function must be enabled 14 Initializes the standard input output library If standard input output functions are used call to this function must be enabled 15 Calls the main function initsct c essential The content of this file varies with the selected MCU M16C or R80 void initsct void d sclear bss_SE data align ssse m 1 sclear bss_SO data noalign sclear bss_NE data align sclear bss_NO data noalign ifndef__NEAR_ sclear_f bss_FE data align sees eceeetedeteteeeceeceeecececie 2 sclear_f bss_FO data noalign Hendif add new sec
13. ants exceeds the bit width of type int be sure to add a UL suffix to the integer constant void func void unsigned long l 1 256UL 256UL 3 4 13 Precaution on fuse MUL fUM When this option is specified although the result of an operation even for a 16 bits x 16 bits operation may be obtained in a 32 bitvalue without cast expression If in this case an operation is performed between constant values however the result will be produced in a 16 bit quantity Example long 1 int 1 12 1 i i2 The result is 32 bits in size l 1234 5678 The 16 high order bits of a 32 bit result are filled with 0 or Oxffff Inthe present case the high order bits are filled with 0 3 4 14 Precaution on Default Parameters If the default value of the second parameter to a function is specified using the first parameter to the function an internal error may occur Therefore do not use the first parameter to a function for the default value of the second parameter to the function Example void func int pl int p2 pl printf p1 d n pl1 printf p2 d n p2 The value of th second parameter to a function is specified using the first parameter to the function 9 28 REJ10J1778 0100 3 4 15 Calls to functions that return a structure result in a system error System Error occurs when a return value of a function which returns a
14. g workspace wizard 3 Varies according to the heap size that you entered in the creating workspace wizard 4 Set to 1 if you chose to Use the standard input output function in the creating workspace wizard 5 Should be set to 1 if the WATCHDOG feature needs to be enabled immediately after reset R8C Tiny only If you want to change the above again after you ve created a new workspace be sure to change this file directly 20 28 REJ10J1778 0100 initsct h essential Please do not alter the content of this file resetprg h essential If using On Chip Debugger please refer to the section 3 3 5 Section FirmRam_NE and the Value of the SB Register when the On Chip Debugger is Selected in this release note typedef h essential Please do not alter the content of this file 21 28 REJ10J1778 0100 6 3 How to Generate a C language Startup Selecting the project that uses a C language startup New Project Workspace Projects Workspace Name REY a Makefile Boas Library test Directory FAWorkSpace test Browse CPU family M16C v Tool chain Renesas M16C Standard Properties 1 Select C source startup Application in the left side window After selecting C source startup Application Application will be automatically selected if you change the default setting of CPU family Please select C source startup Application again Selecting the type of micr
15. gister is set to 400H If section FirmRam_NE starts from 400H as the result of linkage the initial value for the SB register should be changed to the value of the start address of the bss_SE section For the start address of the bss_SE section see the contents of the map file The values indicated below should be changed to the start address of the bss_SE section lt resetprg c gt void start void _sb_ 0x400 J 400H fixation Do not change lt resetprg h gt define DEF_SBREGISTER _asm glb B_ n SB equ 0400H MCU Concerned as of April 1 2008 M16C 26 M16C 26A M16C 28 M16C 29 M16C 30P M16C 62P M16C 6N4 M16C 6N5 M16C 6NK M16C 6NL M16C 6NM M16C 6NN MI16C 68 M16C 64 3 4 Precautions about NC30 3 4 1 About conditional operator When the comma operator is used in the conditional expression and the operator is followed by a constant expression all expressions following the expression are ignored Example func10 1 2 fune20 fune30 Workaround Please divide the expression without writing the comma at the left of the conditional operator 3 4 2 About ffar_pointer fFP If ffar_pointer is used be aware that when the amp operator that acquires the address of a near attribute variable is used it is handled in 16 bit address Make sure that it is cast with the far pointer prior to the amp operator Note also that if the pointer size i
16. hange to a macro name that is not a define p x y x y void func void int i p b b 7 28 REJ10J1778 0100 3 4 11 Precautions on if preprocessing directive If a constant expression of if directive is a shift whose left operand is a negative value and right operand is a value of unsigned type the result of the shift expression cannot be worked correctly Example void func void char a if 1 lt lt 1U gt 0 Determined to be tru a 1 1 lt lt 1U is 2 so that it correctly is false else a 2 endif Workaround Tf the left operand of a shift is a negative value change the right operand of that shift to a value of signed type void func void char a if 1 lt lt lt 1 gt 0 Disuse of the suffix U changes the right operand of a 1 a shift to signed type else a 2 endif 8 28 REJ10J1778 0100 3 4 12 Precaution on Arithmetic Operation between Integer Constants If an arithmetic operation performed on one integer constant and another resulted in exceeding the maximum value of type int the compiler will generate code that differs from those in V 5 40 Release 00 A and earlier Example void func void unsigned long I 256 2567 l 71 1 0 V 5 44 Release 00 1 65536 V 5 40 Release 00 Workaround Tf the result of an arithmetic operation performed between integer const
17. he target MCU and selected FoUSB E8 19 28 REJ10J1778 0100 ifdef _E8 _ II for E8 pragma section bss FirmArea ifndef _WORK_RAM define _WORK_RAM _ 0x80 endif _UBYTE _workram WORK RAM_ pragma section bss FirmArea _far _UBYTE _firmarea 0x800 dummy for monitor else I I for FOUSB pragma section bss FirmRam _UBYTE _workraml 0x80 for Firmware s workram pragma section bss FirmArea _far _UBYTE_firmarea 0x600 dummy for monitor Hendif 1 Enables E8 when it is to be used 2 Allocates the work ram area to be used by the E8 firmware in the FirmRam_NE section 3 Reserves the area of work ram for the size defined as___ WORK__RAM 4 Locates the firmware program of E8 in the FirmArea section 5 Specifies the size of the firmware program 6 Allocates the work ram area to be used by the FoUSB firmware in the FirmRam_NE section 7 Reserves 0x80 bytes of storage for the work ram area It depends on the corresponding microcomputer type 8 Locates the firmware program of FoUSB in the FirmArea section 9 Specifies the size of the firmware program cstartdef c essential define__ STACKSIZE__ _ define _ISTACKSIZE define__ HEAPSIZE_ define__ STANDARD IO _ Of tiie eee _ define__WATCH_DOG_ ee 1 Varies according to the stack size that you entered in the creating workspace wizard 2 Varies according to the interrupt stack size that you entered in the creatin
18. n data data2 the following must be added to initsct c scopy data2_NE data align scopy data2_NO data noalign 4 scopy_f Transfers initial values to the data section of the far area Tf an external variable with initial values is declared using the far qualifier this macro function must be enabled This option is invalid only when R8C option is specified heap c only when memory management functions such as malloc are used pragma SECTION bss heap em 1 _UBYTE heap_areal HEAPSIZE_J 2 1 Locates the heap area in the heap_NE section Tf the heap size consists of an odd number of bytes the heap_NO section is assumed by default 2 Reserves storage for the heap area by an amount equal to the size defined in__HEAPSIZE_ fvector c essential pragma sectaddress fvector ROMDATA Fvectaddr LLL pragma interrupt v_dummy_int Widie BRR SHestbexteestocsd 2 pragma interrupt v_dummy_int lover_flow pragma interrupt v _dummy_int forki pragma interrupt v _dummy_int laddress_match pragma interrupt v _dummy_int single_step pragma interrupt v _dummy_int hwdt pragma interrupt v _dummy_int Hdbe pragma interrupt v _dummy_int fomi pragmainterrupt v start nt ernnnennnnnnnnnnn 3 18 28 REJ10J1778 0100 1 Outputs the section and address of a fixed vector table This pragma is used exclusively for startup and cannot normally be used 2
19. o a 32 bit variable and then store this variable in a 16 bit variable Modification of the above example int i long 1 11 l 1 gt gt 15 Assign the result to a 32 bit variable i nob 11 28 REJ10J1778 0100 3 4 18 Precaution about utl30 3 5 3 6 C compiler user s manual Appendix G the SBDATA declaration amp SPECIAL page Function declaration utility utl30 on Page 357 has the statement that Includes during startup sect30 inc the SPECIAL Page vector definition file special inc as a file to be included But this is the explanation for the version older than V 5 40 The SPECIAL Page vector definition file is unnecessary in V 5 40 or later Therefore please do not use it Suggestions Concerning File Names The file names that can be specified are subject to the following restrictions Directory and file names that contain kanji cannot be used Only one period can be used in a file name Network path names cannot be used Assign the path to a drive name Shortcut cannot be used The symbol cannot be used as a means of specifying two or more directories A file name in length of 128 characters or more including path specification cannot be used Precautions about virus check programs Tf the virus detection program is memory resident in your computer M3T NC30WA may not start up normally In such a case remove the virus detection program from memory befo
20. ocomputer New Project 1 5 Select Target CPU Toolchain version IS Toolchain version Which CPU do you want to use for this pies 2 lt Back ne gt Finish Cancel 2 Select the type of microcomputer from CPU Series and CPU Group When a type of microcomputer is selected its corresponding sfr header file is copied to the workspace 22 28 Furthermore a variable vector table tprg c is registered REJ10J1778 0100 Although V 5 40 Release 00 A showed ROM sizes in parentheses in CPU Group selection note that beginning with this version ROM size selection is moved to the wizard that is displayed when you click the Next gt button Selecting the size of ROM New Project 2 5 Setting the Contents of Files to be Generated R What kind of initialization routine would you like to create Generate main Function None Ic source file v Use OnChip Debugging Emulator ha Firmware Address Size E Work RAM Address Size E lt Back n Finish Cancel 3 The ROM size that you select in 3 in addition to settings in V 5 40 Release 00 A where the on chip debugger is selected ensures that the ROM attribute sections are located appropriately when linked according to the ROM size 23 28 REJ10J1778 0100 Settings for the case where the standard function and memory management function libraries are used New Project 2 5 Setting the Contents of Files to be
21. re you start M3T NC30WA 12 28 REJ10J1778 0100 4 Contents of upgrade from V 5 43 Release 00 4 1 Contents of upgrade about C compiler 4 1 1 Function improvement Corresponded to R8C Tiny MCU series with large ROM such as 128 KB or more R8CE option is made valid for an extended address range of OH to FFFFFH RENESAS TOOL NEWS http tool support renesas com eng toolnews 070916 tn1 htm The maximum of the number of directories which can be specified by l option is expanded from 50 to 256 4 1 2 Fixed Problems The following known problems have been fixed With using OR OR_MAX ORM option RENESAS TOOL NEWS http tool support renesas com eng toolnews 070316 tn5 htm With using preprocessing directive pragma SECTION RENESAS TOOL NEWS http tool support renesas com eng toolnews 070716 tn3 htm With using options to optimize jump instructions at linking RENESAS TOOL NEWS http tool support renesas com eng toolnews 070716 tn2 htm With using R8C option RENESAS TOOL NEWS http tool support renesas com eng toolnews 080116 tn2 htm 4 2 Contents of upgrade about C language startup files 4 2 1 Addition of C language startup files The C language startup files of the following CPU group are added R8C 2E R8C 2F R8C 2G R8C 2H R8C 2J R8C 2K R8C 2L R8C 32A R8C 33A R8C 35A M16C 64 M16C 65 4 2 2 Fixed Problems The following known problems have been fixed With using C lang
22. ries with the selected MCU M16C or R80 Hpragma section program interrupt nn nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn D void start void rabies toe Siete Wes EE PIE IEN OIII OIA EEEIEE S OEE O A AIIE IIE LEE AEE TR 4 _isp_ amp istack_top set interrupt stack pointer se prer 0x02 change protect mode register e pmo 0x00 set processor mode register e prer 0x00 change protect mode register 100m i flg _ F value_ set flag register _ if__STACKSIZE_ 0 _sp_ amp stack_top set user stack pointer eee endif _sb_ 0x400 400H fixation Do not change mee O set variable vector s address _asm Ide topof vector gt gt 16 amp 0FFFFh INTBH 9 _asm Ide topof vector amp 0FFFFh INTBL initsct0 l initialize each sections etn _ if__STACKSIZE_ 0 _sp_ amp _stack_top II set user stack pointer pr _isp_ amp _istack_top set interrupt stack pointer Hendif _ if__HEAPSIZE__ 0 heap_init0 ll initialize heap 0 eee B endif _ if__STANDARD IO_ 0 _init0 ll initialize standard O 0 endif fb_ 0 initialize FB registe for debugger main0 call main routine EEEE EA exit call exit 16 28 REJ10J1778 0100 1 The startup function is located in the interrupt section 2 The function body of the CPU initialization function start is defined 3 Initializes the interrupt stack pointer 4 Sets the protect register to
23. s acquired with sizeof the return value is 2 If any function without prototype declaration is called only 2 bytes of address are stacked Always be sure to declare function prototypes 5 28 REJ10J1778 0100 3 4 3 On nesting inline functions When an inline function that takes one or more parameter is nested it may refer to an incorrect argument a variable not an argument Conditions This problem occurs if the following conditions are both satisfied 1 An inline function is nested in another inline function 2 Inline function A as a calling source and inline function B as the destination take the same parameter name Example inline Bint aaa char ccc Condition 2 inline A int c int aaa char ccc Condition 2 int i char C BG c Condition 1 Workaround This problem can be circumvented by one of the following ways 1 Change the name of the parameter taken by the destination function Gnline function B in the above example 2 Do not nest inline functions in other inline functions 3 Compile the program using the Oforward_function_to_inline OFFTD option 3 4 4 Precaution for Assembler start up files ncrt0 a30 sect30 inc nc_define inc The content of start up files may be customized depending on the target MCU or application Please refer to the hardware manual or the datasheet of the target MCU when undergoing such customizations 3 4 5 About the standard I O function
24. seseeeeseseseees 4 3 3 3 About specifying the interrupt Control register ccccscssscsssessscsesssescsscssecesesescssscssscscsescecacessescecssescacssaeacseacecseecseeees 4 3 3 4 Regarding M16C 62 4M extended mode c cccsscssscsssesssssesssescssscsscsesesesescsessscscscscscscssscsesssesesssesssessacseacacseacecseeeseeees 5 3 3 5 Section FirmRam_NE and the Value of the SB Register when the On Chip Debugger is Selected 5 3 4 Precautions about NC80 uo cscssssssssssssesscsssessssssssssssscsessesescsessssssssessscseseecuescsseseseseesesesssuescseeucseseesesessaeeseseseeeeessaeeneaeaseneseas 5 341 About conditional operator sisisissanisaniwsaaniaanmcaniaadndamacanisanuiaanacdauiia dimaanincaniaanma 5 8 4 2 About ffar_pointer FFP c ccsccccesccsscsssessessscssessessscssessscssessscsuessesscsscssecsassecsussssssssssessecssesssssesssssusssessuesseesteseessesees 5 BAB On NEST Ml MINCHONS A E A A E A 6 3 4 4 Precaution for Assembler start up files ncrt0 a30 sect30 inc ne_defineino ose eesesssessessessesesseessen 6 3 4 5 About the standard VO function ccecccsssessssssessssesesesscsesessssesesesscsesesssesesesssesesesseseseesssesesesssseeseseseseseseseseseseeeeseseanees 6 3 4 6 Precautions about the search of an include file cc ccscssssssssssssseesesescscsescscscsescecsescscseecseessessessseseacseseacseacecseecseeees 6 3 4 7 Precautions to be taken when using pragma ASM ENDASM and asm ccesccscssessess
25. sessesstsssessesstessesstsseesnens 7 3 4 8 Precautions about debugging of a program using _Bool type cccssscsssesssesesescescssscssscssscsescesscssessesssessscscscesseeees 7 3 4 9 Precautions regarding the preprocessing directive FdefINe ccecesesesesssseseeessesesseecsesessesescseeseseseseseseseeaeseeeeeseaees 7 3 4 10 Precautions On macro CefiNitION inang nienia a eira E E EEN E TE EN R E R 7 3 4 11 Precautions on if preprocessing ireCtiVe c cccsssessssessssssescssssescssssesesessssesssesscsesesseseseseeseseseeesescsneasseeseseseeseeseanens 8 3 4 12 Precaution on Arithmetic Operation between Integer Constants ccccesssssesesssssseseseesesesesecsesessseesesneneseseees 9 3 4 13 Precaution on fuse ILIA JIMA soc aocnnssicavapavchunsan i oben dd oso esdemecvnraviasan edb psa pues oebsatvsesdba pene aussie neat 9 3 4 14 Precaution on Default Parameters ccccccsscsssesssescsssessscssscscsssssssssscssscsssesesescssscscscsssescsesssseesscsescasscsescscecacecaeecseeees 9 3 4 15 Calls to functions that return a structure result in a system CYTOL ecesesesessesssesessesesesesseseseseseseseeseseeeseess 10 3 4 16 Precaution about Ostack_frame_align OSFA cccssssssssssssssssssssesssesssesssesssssssssssssenesssessscsssssescsssesssscssseessessse 10 3 4 17 Precaution about performing right shift operations cccccscsescssscssscssssssesescsssescscssscscseseecseecsescsnsesesessseaeeeaees 11 3 4 18 Precaution about uth30
26. sesssessseessnssenseeseeeseessensaes 13 5 Conformance with MISRAC Rule casee aaa an a ANS ASPA AnaS Aa AS ANS OS ESANS EAS Ona E ania AS Ea PAS aS ONEA 14 Oks Standard Function Library osineen niea a a a aa a a e aa ONES a a ia 14 SLL o Cause gi Rule Violations ins E T E TE A 14 5 1 2 Inspection No running counter to the rule cccccccccssesssesssescsescsssessscsssssssssssscsssesesesesescsesessscseecseesssssesssenesesesesesesees 14 SLZ Evaluation Ewy ronment si son dese de cles ee ella ee ing eee Mesias EA lees 14 5 2 Conformance with MISRA C Rule in HEW Generation Source Code cccscssssssssssesssecsssessssescscscesesessssseeaesseseseseesenes 14 Gal cCatise Of Rule Violano o N E E S senstets stalecanedewibaciswiueSsoseuentectde secon 14 5 2 2 Inspection No running counter to the rule ccccccscsssesssescssscsescsssessscsssssssesssesssesesesesesesesesescseecseesssesesesenescsescssscsees 14 6 2 3 Evaluation Environment ooreis E E S E auniiieainuin thin suas auniaeion 14 Gs Can gUase Star bups AE AA RAE AE AEE E A E E E SO EE Ahn Ades ech tet EEEN eta sae 15 Gil Generated FES iaoea a A EATE E a 15 6 2 Processing of Each Generated File ccccccecsssssssssssscssscssssssscsssscsescsesescsesesesessscsescsesssussesssesssssesesesescscscesscsceeseesensseesseseees 16 6 3 How to Generate a C language Startup c ccccccscsscsscsscssssssscssscssssesssescssscssscssscssesseessesssscsscssessscseacscsescsesessseesessessessaes 22 2
27. structure is used to initialize an auto structure variable Example typedef struct tag long abc st st func int void main st stl func 10 Workaround Make sure that structure variables of storage class auto are defined separately from the initialization of those variables void main st sti stl func 10 3 4 16 Precaution about Ostack_frame_align OSFA If compile option Ostack_frame_align OSFA is used incorrect values of stack size may be provided in inspector information and the stack size display file with extension stk As a result the values of stack size calculated by the STKViewer and CallWalker utilizing inspector information and the stk30 stack size calculate utility utilizing the stack size display file will be false Tool News http tool support renesas com eng toolnews 070701 tn5 htm Conditions This problem occurs if the following conditions are all satisfied 1 Compile option Ostack_frame_align OSFA is selected 2 Compile option genter is not selected 3 In the program exists a function that does not make any stack frame Tn order that no function can make the stack frame the following three conditions must be met The function does not take arguments passed via the stack In the function exist no auto variables except for the ones assigned to registers or auto variables have been deleted by the optimization of the compiler
28. the area for the debugger is avoided 7 Set Firmware Address and workRam Address Here you set the program area for Firmware and the RAM area for work to be used by FoUSB E8 You can alter the default values only when the debugger allows you to do so If you alter these addresses when using the debugger alter them to suit the setup of the debugger For details about the address and size to be altered for each consult the user s manual of your debugger 8 If you select OnChipDebugger while the standard input output function library is selected UART1 indicated here changes to UARTO This means that the standard input output device is changed to UARTO because the standard input output functions and OnChipDebugger both use UART1 25 28 REJ10J1778 0100 Selecting the stack size What are the stack settings U er Gta Printer Stack Si gt Jrt rrupt Stack Pointer Stack Size 0x30 11 lt Back ne gt Finish Cancel 9 Choose to use or not use the user stack Tf this check box is unselected settings are changed so that the user stack will not be used in the start function 10 Set the user stack size The define value in cstartdef h is changed 11 Set the interrupt stack size The define value in cstartdef h is changed To change the stack size or HEAP size after you created a project change the respective values that are set in cstartdef h as shown below define_ _
29. ting the contents of the interrupt control registers When using any of the products concerned ensure that no incorrect code is generated Example When O5 optimizing options is used in the program shown below a BTSTC instruction is generated at compilation which prevents an interrupt request bit from being processed correctly resulting in the assembled program performing improper operations pragma ADDRESS TAOIC 0055h M16C 62 MCU s Timer AO interrupt control register struct char ILVL 3 char IR 1 An interrupt request bit char dmy 4 3 28 REJ10J1778 0100 TAOIC void wait_until_ IR_is ON void while TAOIC IR 0 Waits for TAOIC IR to become TAOIC IR 0 Returns 0 to TAOIC IR when it becomes 1 Workaround 1 Suppress the generation of the BTSTC and BTSTS instructions resulting from using an optimizing option by selecting the ONA or Ono_asmopt option together with O5 optimizing option 2 Add an asm function to disable optimization locally as shown in the example below while TAOIC IR 0 asm Notes Make sure that no BTSTC and BTSTS instructions are generated after these side steppings 3 3 2 Precautions about access of SFR area You may need to use specific instructions when writing to or reading registers in the SFR area Because the specific instruction is different for each model see the User s Manual for the specific Machine These ins
30. tion x Address Section A FirmA am a Ox00000300 Ox00000400 bes SE Cancel data_SO bss_50 data _NE bss_NE data_NO bss_NO stack istack heap_NE Ox00002000 Firm rea Ox0O00C000 FirmArea gt OxOOO0E 000 rom_NE rom_NO data_SEl data_SOl data_NEl data _NOI switch_t nanam 2 3 lt If you added a new section with pragma SECTION click the Edit button in 1 to open the Section window While the Sectiondialog has the focus click the Add button in 2 Add section Section name x Cancel The Add section dialog will be launched so enter the name of the new section that you want The section you ve entered will be registered so move the section to the area in which you want it to be located by using the Up or Down arrow in 8 28 28
31. tions bss_clear new section name scopy deta SE dataalign Reese eee tee 3 scopy data_SO data noalign scopy data_NE data align scopy data_NO data noalign ifndef__NEAR scopy A data FE date alion t 7 4 scopy_f data_FO data noalign 1 sclear Clears the bss section of the near area to zero If the bss section name is altered or a new bss section name is added using the pragma SECTION bss feature NE and NO must be altered or added in pairs sclear section name NE data align sclear section name NO data noalign 17 28 REJ10J1778 0100 Example When a section is added by pragma section bss bss2 the following must be added to initsct c sclear bss2_NE data align sclear bss2_NO data noalign 2 sclear_f Clears the bss section of the far area to zero If an external variable without initial values is declared using the far qualifier this macro function must be enabled This option is invalid only when R8C option is specified 3 scopy Transfers initial values to the data section of the near area If the data section name is altered or a new dada section name is added using the oragma SECTION data feature NE and NO must be altered or added in pairs scopy section name NE data align scopy section name NO data noalign Example When a section is added by pragma sectio
32. tructions should be used in your program using the asm function 3 3 3 About specifying the interrupt control register M3T NC30WA supports the functions that set or change the value of an interrupt priority level to conform to MESC TECHNICAL NEWS No M16C 14 9805 case of setting the value Please use SetLevel function In this time please be sure to include intlevel h file SetLevel char ady char val adr Address of the interrupt control register val value case of changing the value Please use ChgLevel function In this time please be sure to include intlevel h file ChgLevel char adr char val adr Address of the interrupt control register val value Example include lt intlevel h gt pragma ADDRESS timerA 55H char timerA void func void SetLevel timerA 2 Specifying the value 2 to the interrupt priority level ChgLevel timerA 4 Changing the value 4 to the interrupt priority level 4 28 REJ10J1778 0100 3 3 4 Regarding M16C 62 4M extended mode Make sure the program is located in the internal ROM 3 3 5 Section FirmRam_NE and the Value of the SB Register when the On Chip Debugger is Selected If you select the debugger on the dialog box selecting OnChipDebegger when creating a new project workspace FirmRam_NE section may be allocated from 400H Then you can t access the correct area by using the SB relative addressing mode because the initial value for SB re
33. uage startup files RENESAS TOOL NEWS http tool support renesas com eng toolnews 070701 tn4 htm With creating projects for the MCUs with 48 KB ROM in the R8C 2D group RENESAS TOOL NEWS http tool support renesas com eng toolnews 071216 tn7 htm 4 3 Content of upgrade about Assembler startup files istack section has been added in order to support Emulator E100 13 28 REJ10J1778 0100 5 Conformance with MISRAC Rule 5 1 Standard Function Library In C Source code of standard function library M3T NC30WA it is found that some rules are against the MISRAC Rule but these violations do not constitute a drawback to any operation 5 1 1 Cause of Rule Violation In C Source code of standard function library M8T NC30WA the major causes for rule violation are as follows e C Compiler specifications near far modifier asm function and pragma J Declaration of function based on ANSI Standard o The evaluation sequence in the conditional statement is not described explicitly using a parenthesis J Implicit type conversion 5 1 2 Inspection No running counter to the rule The following are Inspection Nos that run counter to the Rule 1 12 13 14 18 21 22 28 34 35 36 37 38 39 43 44 45 46 48 49 50 54 55 56 57 58 59 60 61 62 65 69 70 71 72 76 77 82 83 85 99 101 103 104 105 110 111 115 118 119 121 124 5 1 3 Evaluation Environment Compiler M38T NC30WA V 5 30 Release 1 Compile Option O c as30 DOPTI 0

Download Pdf Manuals

image

Related Search

Related Contents

Fiche technique congés payés 2014  4.3 機械情報工学科    Spektrum der Wissenschaft 2009 10  取扱説明書  Oracle FS Data Protection Manager Guía del usuario  Whirlpool ACS082PP0 User's Manual  Samsung M192DN Bruksanvisning  Hikvision Digital Technology DS-7308HWI-SH digital video recorder  T'nB TB3525BK  

Copyright © All rights reserved.
Failed to retrieve file