跳转至内容
  • 版块
  • 最新
  • 标签
  • 热门
折叠
品牌标识

YunTu Forum

YTMicro.com
  1. 主页
  2. Discussion & Question
  3. YTM32B1M系列
  4. B1MD MCAL DIO例程生成的hex文件为什么有0x1FFF8400地址的信息?

B1MD MCAL DIO例程生成的hex文件为什么有0x1FFF8400地址的信息?

已定时 已固定 已锁定 已移动 已解决 YTM32B1M系列
4 帖子 3 发布者 4.7k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • piterP 离线
    piterP 离线
    piter
    写于 最后由 编辑
    #1

    Dio_Demo.hex

    c54c19da-ab65-4d71-803f-d5d44ed82e7c-image.png

    1 条回复 最后回复
    0
    • jiankang_wangJ 离线
      jiankang_wangJ 离线
      jiankang_wang YunTu
      写于 最后由 编辑
      #3

      您好,多出来的区域是 .bss 段的内容。多出这部分的原因如下:

      ARM® Compiler armclang Reference Guide

      __attribute__((section("name"))) variable attribute
      The section attribute specifies that a variable must be placed in a particular data section.

      Normally, the ARM compiler places the data it generates in sections like .data and .bss. However, you
      might require additional data sections or you might want a variable to appear in a special section, for
      example, to map to special hardware.

      If you use the section attribute, read-only variables are placed in RO data sections, writable variables
      are placed in RW data sections.

      If the section name starts with .bss., the variable is placed in a ZI section.

      ref:Arm document

      根据 armclang 的要求,自定义的 .bss 段名称需要以 .bss 开头。否则会认为该段是 .data 段,而其他的编译器中没有对应的限制。

      MCAL的代码中,定义的段名称类似于.mcal_data,.mcal_bss,不能满足KEIL中的限制,所以都会识别为 data 段。而在对应的 scf 文件中,是通过类似如下代码固定其位置的:

      LR_RAM_0 0x1fff8400
      {
      ...
              mcal_bss_region_start +0  EMPTY 0
              {
              }
              mcal_bss_region +0 NOCOMPRESS
              {
                      *(.mcal_bss)
              }
              mcal_bss_region_end +0  EMPTY 0
              {
              }
      ...
      }
      ScatterAssert(ImageLength(LR_RAM_0) <= 0xF800)
      

      所以这一段 .bss 会被识别成 .data 段的数据,并存放到 load addr 0x1fff8400。


      实际上这部分区域并不会影响程序的实际运行,因为 .bss 段 symbol 的地址是正确的。如果您不想要这部分代码的区域,您可以这样操作:

      1. 替换工程下的 .bss 段名称:
        • .mcal_bss -> .bss.mcal_bss
        • .mcal_bss_no_cacheable -> .bss.mcal_bss_no_cacheable
      2. 在配置工具中 Lock 住 Platform。

      经过上述操作后,生成的代码段中就没有多余的区域了。

      1 条回复 最后回复
      0
      • piterP 离线
        piterP 离线
        piter
        写于 最后由 编辑
        #2

        ram区域的东西怎么跑到rom里去了

        1 条回复 最后回复
        0
        • jiankang_wangJ 离线
          jiankang_wangJ 离线
          jiankang_wang YunTu
          写于 最后由 编辑
          #3

          您好,多出来的区域是 .bss 段的内容。多出这部分的原因如下:

          ARM® Compiler armclang Reference Guide

          __attribute__((section("name"))) variable attribute
          The section attribute specifies that a variable must be placed in a particular data section.

          Normally, the ARM compiler places the data it generates in sections like .data and .bss. However, you
          might require additional data sections or you might want a variable to appear in a special section, for
          example, to map to special hardware.

          If you use the section attribute, read-only variables are placed in RO data sections, writable variables
          are placed in RW data sections.

          If the section name starts with .bss., the variable is placed in a ZI section.

          ref:Arm document

          根据 armclang 的要求,自定义的 .bss 段名称需要以 .bss 开头。否则会认为该段是 .data 段,而其他的编译器中没有对应的限制。

          MCAL的代码中,定义的段名称类似于.mcal_data,.mcal_bss,不能满足KEIL中的限制,所以都会识别为 data 段。而在对应的 scf 文件中,是通过类似如下代码固定其位置的:

          LR_RAM_0 0x1fff8400
          {
          ...
                  mcal_bss_region_start +0  EMPTY 0
                  {
                  }
                  mcal_bss_region +0 NOCOMPRESS
                  {
                          *(.mcal_bss)
                  }
                  mcal_bss_region_end +0  EMPTY 0
                  {
                  }
          ...
          }
          ScatterAssert(ImageLength(LR_RAM_0) <= 0xF800)
          

          所以这一段 .bss 会被识别成 .data 段的数据,并存放到 load addr 0x1fff8400。


          实际上这部分区域并不会影响程序的实际运行,因为 .bss 段 symbol 的地址是正确的。如果您不想要这部分代码的区域,您可以这样操作:

          1. 替换工程下的 .bss 段名称:
            • .mcal_bss -> .bss.mcal_bss
            • .mcal_bss_no_cacheable -> .bss.mcal_bss_no_cacheable
          2. 在配置工具中 Lock 住 Platform。

          经过上述操作后,生成的代码段中就没有多余的区域了。

          1 条回复 最后回复
          0
          • jiankang_wangJ jiankang_wang 在 中 引用了 这个主题
          • D Derrick 在 中 引用了 这个主题
          • YQHY YQH 在 中 引用了 这个主题
          • limanjiangL 离线
            limanjiangL 离线
            limanjiang YunTu
            写于 最后由 编辑
            #4

            我这边有客户也遇到这个问题,做了一个demo,其他人用的话更直观一些。

            KEIL_DEL_RAMDATA_Demo.zip

            1 条回复 最后回复
            0
            • limanjiangL limanjiang 在 中 引用了 这个主题
            • yangkeY yangke 在 中 引用了 这个主题
            • limanjiangL limanjiang 在 中 引用了 这个主题
            • ,FrankieF Frankie 将这个主题转为问答主题
            • ,FrankieF Frankie 将这个主题标记为已解决

          • 云途开发生态介绍

            快速上手云途开发生态

          • 云途论坛规则/Yuntu Forum Rules

            发帖前请查看

          • YT CONFIG TOOL调查问卷

            帮助改进和优化YT CONFIG TOOL,有机会抽取YTM32B1ME0 EVB哦...

          • can
            25
            demo
            22
            lin stack
            13
            uds
            13
            md14
            6
            yt-link
            6
            fbl
            5
            adc模块
            4
            Online Users
            • 登录

            • 登录或注册以进行搜索。
            • 第一个帖子
              最后一个帖子
            0
            • 版块
            • 最新
            • 标签
            • 热门