KF8 8位机数据类型 一个结构体的成员变量不能超过128字节[否则报错]
本帖最后由 lvben5d 于 2022-11-24 09:06 编辑typedef unsigned char u8;
typedef unsigned short int u16;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int u32; //注意 因为是8位机这里不是4个字节了!!
typedef unsigned long ul32; //这个才是4字节!!
u16 C={0,0,0,0,0};
u16 D={100000,65534,3,4,5}; //这里100000 大于65535溢出了,但是编译器不会报错~自己要注意数值范围
void f(u16 *p)
{
u8 i;
for(i=0; i<8; i++)C = *p++ ;
}
2. kF8 编译器支持的 结构体成员变量 占内存不能超过128字节,否则就报错!估计是硬件内存分页引起!
typedef struct{
u8 key; //Byte N of Secret; Secret Begins at Address 80h (see Figure 5)
u8 _PP; //Byte N of Memory Page; Memory Pages begin at 00h, 20h, 40h and 60h (see Figure 5)
u8 _SP; //Byte N of Scratchpad
u8 _MP; //MP = 00000b, MP = T
u8 _RN; //Byte N of Registration Number. The CRC byte of the registration number is not used.
}SHA1Para_t;
typedef struct
{
ul32_M;
ul32_H;
}SHA1Para2_t;
原本是这样
/* sha1参数 */
typedef struct
{
uint8_t _SS; //Byte N of Secret; Secret Begins at Address 80h (see Figure 5)
uint8_t _PP; //Byte N of Memory Page; Memory Pages begin at 00h, 20h, 40h and 60h (see Figure 5)
uint8_t _SP; //Byte N of Scratchpad
uint8_t _MP; //MP = 00000b, MP = T
uint8_t _RN; //Byte N of Registration Number. The CRC byte of the registration number is not used.
uint32_t _M;
uint32_t _H;
}SHA1Para_t; 这里超过了128字节编译就不过!!!!
受益匪浅
页:
[1]