diff --git a/IAR/IAR.md b/IAR/IAR.md index 65d46ec..089206a 100644 --- a/IAR/IAR.md +++ b/IAR/IAR.md @@ -94,6 +94,36 @@ ![image-20250709095718033](./pictures/image-20250709095718033.png) +**IAR ICF 文件(.icf)的了解及变量如何分配内存区域** + +ICF(**IAR Linker Configuration File**)用于定义程序的内存布局,包括代码、数据、堆栈等在内存中的分布。 + +**变量分配到特定内存区域的方法**: + +你可以通过修改 `.icf` 文件中的 `define block` 和 `place in` 语句来控制变量在内存中的分布。 + +**示例(将某段变量放到特定内存区域):** + +``` +icf复制编辑define region MY_RAM = mem:[from 0x20010000 to 0x20010FFF]; +define block my_section with alignment = 8 { section .mydata }; +place in MY_RAM { block my_section }; +``` + +然后在代码中定义变量时,使用 `__attribute__((section(".mydata")))` 或 IAR 的 `__section`: + +``` +c + + +复制编辑 +__no_init uint8_t my_buffer[1024] @ ".mydata"; // IAR语法 +``` + +------ + +## + ### 文件路径配置 ![image-20250709095759245](./pictures/image-20250709095759245.png) diff --git a/Library/Library.md b/Library/Library.md index 928cd87..2307652 100644 --- a/Library/Library.md +++ b/Library/Library.md @@ -101,6 +101,7 @@ 将`dll`文件复制到`dbug`下面,使用以下程序指令动态加载 ``` +#include HINSTANCE Dll = LoadLibrary(L"test.dll"); if (Dll == NULL) { std::cerr << "无法加载DLL! 错误码: " << GetLastError() << std::endl; diff --git a/Markdown/pictures/image-20250708133150206.png b/Markdown/pictures/image-20250708133150206.png deleted file mode 100644 index 09f6a57..0000000 Binary files a/Markdown/pictures/image-20250708133150206.png and /dev/null differ