打印
[KungFu8位 MCU]

KF8 8位机数据类型 一个结构体的成员变量不能超过128字节[否则报错]

[复制链接]
1448|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
lvben5d|  楼主 | 2022-10-17 14:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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[8]={0,0,0,0,0};
u16 D[8]={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[8];       //Byte N of Secret; Secret Begins at Address 80h (see Figure 5)
        u8 _PP[32];      //Byte N of Memory Page; Memory Pages begin at 00h, 20h, 40h and 60h (see Figure 5)
        u8 _SP[8];       //Byte N of Scratchpad
        u8 _MP;          //MP[7:3] = 00000b, MP[2:0] = T[7:5]
        u8 _RN[8];       //Byte N of Registration Number. The CRC byte of the registration number is not used.
}SHA1Para_t;

typedef struct
{
        ul32  _M[17];
        ul32  _H[5];
}SHA1Para2_t;

     原本是这样
/* sha1参数 */
typedef struct
{
  uint8_t _SS[8];       //Byte N of Secret; Secret Begins at Address 80h (see Figure 5)
  uint8_t _PP[32];      //Byte N of Memory Page; Memory Pages begin at 00h, 20h, 40h and 60h (see Figure 5)
  uint8_t _SP[8];       //Byte N of Scratchpad
  uint8_t _MP;          //MP[7:3] = 00000b, MP[2:0] = T[7:5]
  uint8_t _RN[8];       //Byte N of Registration Number. The CRC byte of the registration number is not used.

  uint32_t _M[17];
  uint32_t _H[5];
}SHA1Para_t;         这里超过了128字节  编译就不过!!!!



使用特权

评论回复
沙发
gggggggggx| | 2022-10-18 16:13 | 只看该作者
受益匪浅

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

95

主题

746

帖子

12

粉丝