简体   繁体   English

Vectorcast 使用 IAR 编译器进行 RL78

[英]Vectorcast using IAR compiler for RL78

I'm just started to work with Vectorcast and IAR for RL78 compiler.我刚刚开始为 RL78 编译器使用 Vectorcast 和 IAR。 I want to build an environment in vectorcast using IAR Compiler for RL78 Microcontroller.我想使用 IAR Compiler for RL78 Microcontroller 在 vectorcast 中构建环境。

Code which is used for testing has been successfully compiled in IAR embedded workbench for RL78.用于测试的代码已在 RL78 的 IAR 嵌入式工作台中成功编译。

I am facing the below error while building an environment in vectorcast for a module.在 vectorcast 中为模块构建环境时,我面临以下错误。

Error:错误:

 40_MCAL\\Memory\\FDL\\fdl_types.h", line 133: error: division by zero enum { R_FDLT02_ASSERT_LINE_133 = 1/(! !(sizeof(fdl_u16)==2)) }; ^ 40_MCAL\\Memory\\FDL\\fdl_types.h", line 137: error: division by zero enum { R_FDLT02_ASSERT_LINE_137 = 1/(! !(sizeof(fdl_command_t)==1)) }; ^ 40_MCAL\\Memory\\FDL\\fdl_types.h", line 138: error: division by zero enum { R_FDLT02_ASSERT_LINE_138 = 1/(! !(sizeof(fdl_status_t)==1)) }; ^ 40_MCAL\\Memory\\FDL\\fdl_types.h", line 141: error: division by zero enum { R_FDLT02_ASSERT_LINE_141 = 1/(! !(sizeof(fdl_request_t)==8)) }; ^ 40_MCAL\\Memory\\FDL\\fdl_types.h", line 142: error: division by zero enum { R_FDLT02_ASSERT_LINE_142 = 1/(! !(sizeof(fdl_descriptor_t)==10)) }; ^ 5 errors detected in the compilation of "Flash.c".

And the source code is below:源代码如下:

# define R_FDLT02_ASSERT_CONCAT_(a, b) a##b        

#define R_FDLT02_ASSERT_CONCAT(a, b) R_FDLT02_ASSERT_CONCAT_(a, b)    

#define R_FDLT02_STATIC_ASSERT(e) enum { R_FDLT02_ASSERT_CONCAT    
(R_FDLT02_ASSERT_LINE_, __LINE__) = 1/(!!(e)) }    

/* assertion if unsigned data type size is not correct, please evaluate compiler settings for integer types */

R_FDLT02_STATIC_ASSERT(sizeof(fdl_u08)==1);    

R_FDLT02_STATIC_ASSERT(sizeof(fdl_u16)==2);    

R_FDLT02_STATIC_ASSERT(sizeof(fdl_u32)==4);    


/* assertion if enumeration type size is not correct, please evaluate compiler settings for enumeration types */    

R_FDLT02_STATIC_ASSERT(sizeof(fdl_command_t)==1);    

R_FDLT02_STATIC_ASSERT(sizeof(fdl_status_t)==1);    

/* assertion if structure type size is not correct, please evaluate compiler settings for structure types */    

R_FDLT02_STATIC_ASSERT(sizeof(fdl_request_t)==8);    

R_FDLT02_STATIC_ASSERT(sizeof(fdl_descriptor_t)==10);    

They are expressions intended to fail compilation if the size of the specified types is not as required by the library. 如果指定类型的大小与库要求不符,则它们是旨在使编译失败的表达式。

You need to check that the definitions for types such as fdl_u16 are appropriate for you target. 您需要检查诸如fdl_u16类的类型的定义是否适合您的目标。 For IAR's RL78 compiler the basic types have the following sizes: 对于IAR的RL78编译器,基本类型具有以下大小:

bool               8 bits
char               8 bits 
signed char        8 bits
unsigned char      8 bits
signed short       16 bits
unsigned short     16 bits 
signed int         16 bits 
unsigned int       16 bits
signed long        32 bits 
unsigned long      32 bits
signed long long   32 bits
unsigned long long 32 bits 

It is generally more portable however if specific sizes are required to define such types in terms of the types such as uint16_t for example. 但是,如果需要特定大小来根据诸如uint16_t之类的类型来定义此类,则通常更便于携带。

It is hard however to think of a plausible definition of fdl_u16 that would not have a size of 2, given that you have no error for fdl_u8 or fdl_u32 , but you have not provided that code. 但是,考虑到fdl_u8fdl_u32没有错误,但是您没有提供该代码,很难想到fdl_u16的合理定义,其大小不会为2。

The apparent expectation that the sizeof any specific enum is 1 is unsafe (see What is the size of an enum in C? for example), although in the IAR RL78 compiler manual it states that the smallest type that can accommodate all the enum constants will be used. 显然期望任何特定枚举的大小为1是不安全的(例如,请参见C中的枚举的大小是多少 ),尽管在IAR RL78编译器手册中指出,可以容纳所有枚举常量的最小类型将是不安全的。使用。

The failure of the structure types is quite likely a result of the failure if fdl_u16 , but again without the definitions of these types it is hard to tell. 如果使用fdl_u16 ,则结构类型的失败很可能是失败的结果,但是同样,如果没有这些类型的定义,就很难说了。

For testing tools like VectorCAST, it's always recommended to find whether the source of error is from our Source code or from the tool.对于像 VectorCAST 这样的测试工具,总是建议找出错误的来源是来自我们的源代码还是来自工具。 For example, VectorCAST uses a preprocessed file to parse through the code to identify if there is any syntax or semantic error or not by mimicking the compiler under use with its own parser.例如,VectorCAST 使用预处理文件来解析代码,通过模仿使用自己的解析器的编译器来识别是否存在任何语法或语义错误。

Usually, the tool's parser is configured for generic default settings and it may end up with an error if one uses a non-genric project.通常,该工具的解析器配置为通用默认设置,如果使用非通用项目,它可能会以错误告终。 Inside VectorCAST one can use the Test settings option to find the source of error is from compile stage or from the parse stage(test tool side).在 VectorCAST 中,可以使用测试设置选项来查找错误来源是来自编译阶段还是来自解析阶段(测试工具端)。 If it's a parser error(as indicated by user8270915) then contact the tool vendors support team for additional flags to resolve such issue.如果是解析器错误(如 user8270915 所示),请联系工具供应商支持团队获取其他标志以解决此类问题。 If an error is originating from compile stage of Test settings then in such a case one has to compare the settings used in the test environment with their actual project.如果错误源自测试设置的编译阶段,那么在这种情况下,必须将测试环境中使用的设置与其实际项目进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM