硬汉嵌入式论坛

 找回密码
 立即注册
查看: 5102|回复: 5
收起左侧

[开发工具] 网友反馈MDK的AC6使用__attribute__((section("name")))没法调试,白天试试

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106692
QQ
发表于 2019-9-9 00:56:08 | 显示全部楼层 |阅读模式

使用方法此贴:

AC6使用 __attribute__((at(x)))需要改用__attribute__((section("name")))实现
http://www.armbbs.cn/forum.php?m ... id=93202&fromuid=58
(出处: 硬汉嵌入式论坛)


回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106692
QQ
 楼主| 发表于 2019-9-9 10:18:35 | 显示全部楼层
测试了,没问题
11.jpg
回复

使用道具 举报

7

主题

125

回帖

146

积分

初级会员

积分
146
发表于 2019-9-9 13:58:57 | 显示全部楼层
前几天我也用过,可以调试的,我是把变量固定在指定ROM地址
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106692
QQ
 楼主| 发表于 2019-9-10 08:17:53 | 显示全部楼层
狂野的庄稼汉 发表于 2019-9-9 13:58
前几天我也用过,可以调试的,我是把变量固定在指定ROM地址

网友那个不知道咋回事,就是不能调试,一调试就异常。
回复

使用道具 举报

73

主题

1193

回帖

1412

积分

至尊会员

积分
1412
发表于 2020-1-12 14:07:55 | 显示全部楼层
eric2013 发表于 2019-9-9 10:18
测试了,没问题

//uint8_t  plc_eu_backup[4] __attribute__((at(0x20002000)));    //编译仿真都ok
uint8_t plc_eu_backup[4] __attribute__((section(".ARM.__at_0x20002000")));

硬汉哥,我的ac6编译也是不行,报错:

Build started: Project: Demo
*** Using Compiler 'V6.13.1', folder: 'c:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'ac6'
compiling main.c...
linking...
.\Demo\Demo.axf: Error: L6971E: main.o(.ARM.__at_0x20002000) type RW incompatible with startup_stm32f103xe.o(STACK) type ZI in er RW_IRAM1.
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 1 error messages.
".\Demo\Demo.axf" - 1 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:01

ac5编译是可以的。
我还在sct里面定义了一个分区:
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08000000 0x00080000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00080000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  RW_IRAM1 0x20000000 0x00010000  {  ; RW data
   .ANY (+RW +ZI)
  }
  
  MYRAM 0x20002000 UNINIT 0x0000200  {
   .ANY (NO_INIT)
  }
}

回复

使用道具 举报

73

主题

1193

回帖

1412

积分

至尊会员

积分
1412
发表于 2020-1-12 14:15:55 | 显示全部楼层
eric2013 发表于 2019-9-9 10:18
测试了,没问题

1、//uint8_t  plc_eu_backup[4] __attribute__((at(0x20002000)));    //ac5.06   编译仿真都ok
2、//uint8_t plc_eu_backup[4] __attribute__((section(".ARM.__at_0x20002000")));    链接出错
3、uint8_t plc_eu_backup[4] __attribute__((section("no_init")));    //ac6.13.1 编译仿真都ok

硬汉哥,我的测试如上:
第三点需要在sct文件中定义一个段名:
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

LR_IROM1 0x08000000 0x00080000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00080000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  RW_IRAM1 0x20000000 0x00010000  {  ; RW data
   .ANY (+RW +ZI)
  }
  
  MYRAM 0x20002000 UNINIT 0x0000200  {
   *(no_init)
   .ANY (NO_INIT)
  }
}


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-4-30 06:20 , Processed in 0.474182 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表