section代码什么意思
section代码什么意思
section指示把代码划分成若干个段(Section),程序 *** 作系统加载执行时,每个段被加载到不同的地址,操作系统对不同的页面设置不同的读、写、执行权限。section属于汇编程序代码,采用汇编语言编写程序虽不如高级程序设计语言简便、直观,但是汇编出的目标程序占用内存较少、运行效率较高,且能直接引用计算机的各种设备资源。section是什么意思中文翻译 section是啥意思
下面分享相关内容的知识扩展:
英语论文中的section翻译成“节”还是“部分”?论文不短(比国内的我见的长),有5页!哪个能准确一些?
翻译成 第几章,第几节,都是比较地道的。既然文章比较长就翻译成 章 吧。不过这个不影响文章翻译,意思对就可以了。你试想一下英语课文里Section1和考试卷里的Section1,课文里往往说 章,试卷中说 部分。PS 你的论文还没有翻译完啊~~这种小问题不用太纠结啦
Vol,Section,Chapter
这三个词语经常用来故事分段,,有什么区别,或者说怎么用?Vol = volume = 卷
Section = 节
Chapter = 章
“卷”更大,与“册”的意思差不多。
卷下分章,章下分节。
请问在英语考试中 section和 part 有什么区别呢?谢谢.
以前英语考试题干多用part one ,part two 什么的,现在都用section了,请问有什么区别呢?
可以这样说 :
part是组合出来的,几个part组合成一个;
section是分出来的,一个分成几个section 。
所以,你可以说i'm a part of the society, 而不是i'm a section of the society, 因为是人组成了社会,而不是一开始只有社会,分开了变成人。
不过,可以用section的地方,基本上也可以用part,因为分开了的可以组合起来(因为又不是说物理上分开了)。
this section of the book/this part of the book
把分开的几段和在一起,不还是那本书了吗?
亲,我用的是IAR嵌入式编译程序,现不明白section=""是什么意思?函数大体意思是复制ROM到RAM?
#include "common.h"#if (defined(IAR))
#pragma section = ".data"
#pragma section = ".data_init"
#pragma section = ".bss"
#pragma section = "CodeRelocate"
#pragma section = "CodeRelocateRam"
#endif
/********************************************************************/
void
common_startup(void)
{
/* Declare a counter we'll use in all of the copy loops */
uint32 n;
/* Declare pointers for various data sections. These pointers
* are initialized using values pulled in from the linker file
*/
uint8 * data_ram, * data_rom, * data_rom_end;
uint8 * bss_start, * bss_end;
/* Addresses for VECTOR_TABLE and VECTOR_RAM come from the linker file */
extern uint32 __VECTOR_TABLE[];
extern uint32 __VECTOR_RAM[];
/* Copy the vector table to RAM */
if (__VECTOR_RAM != __VECTOR_TABLE)
{
for (n = 0; n < 0x410; n++)
__VECTOR_RAM[n] = __VECTOR_TABLE[n];
}
/* Point the VTOR to the new copy of the vector table */
write_vtor((uint32)__VECTOR_RAM);
/* Get the addresses for the .data section (initialized data section) */
#if (defined(IAR))
data_ram = __section_begin(".data");
data_rom = __section_begin(".data_init");
data_rom_end = __section_end(".data_init");
n = data_rom_end - data_rom;
#endif
/* Copy initialized data from ROM to RAM */
while (n--)
*data_ram++ = *data_rom++;
bss_start = __section_begin(".bss");
bss_end = __section_end(".bss");
/* Clear the zero-initialized data section */
n = bss_end - bss_start;
while(n--)
*bss_start++ = 0;
/* Get addresses for any code sections that need to be copied from ROM to RAM.
* The IAR tools have a predefined keyword that can be used to mark individual
* functions for execution from RAM. Add "__ramfunc" before the return type in
* the function prototype for any routines you need to execute from RAM instead
* of ROM. ex: __ramfunc void foo(void);
*/
#if (defined(IAR))
uint8* code_relocate_ram = __section_begin("CodeRelocateRam");
uint8* code_relocate = __section_begin("CodeRelocate");
uint8* code_relocate_end = __section_end("CodeRelocate");
/* Copy functions from ROM to RAM */
n = code_relocate_end - code_relocate;
while (n--)
*code_relocate_ram++ = *code_relocate++;
#endif
}
#pragma section( "section-name" [, attributes] ) 作用是由程序指定创建一个段
一般默认段都是由编译器自动指定的 不过看你这样的写法 IAR的时候是没有默认段的 必须由编写者手动指定
比如#pragma section = ".data"就是创建一个名字为.data的段,
然后下面调用
data_ram = __section_begin(".data");
来获取这个段的首地址以备其操作
其他类似
关于pragma section的详细说明如下。 对于#pragma 预处理还有很多功能 感兴趣可以自行搜索
==================================================================================
#pragma section。创建一个段。
其格式为:#pragma section( "section-name" [, attributes] )
section-name是必选项,用于指定段的名字。该名字不能与标准段的名字想冲突。可用/SECTION查看标准段的名称列表。
attributes是可选项,用于指定段的属性。可用属性如下,多个属性间用逗号(,)隔开:
read:可读取的
write:可写的
execute:可执行的
shared:对于载入该段的镜像的所有进程是共享的
nopage:不可分页的,主要用于Win32的设备驱动程序中
nocache:不可缓存的,主要用于Win32的设备驱动程序中
discard:可废弃的,主要用于Win32的设备驱动程序中
remove:非内存常驻的,仅用于虚拟设备驱动(VxD)中
如果未指定属性,默认属性为read和write。
在创建了段之后,还要使用__declspec(allocate)将代码或数据放入段中。
例如:
//pragma_section.cpp
#pragma section("mysec",read,write)
int j = 0;
__declspec(allocate("mysec"))
int i = 0;
int main(){}
该例中, 创建了段"mysec",设置了read,write属性。但是j没有放入到该段中,而是放入了默认的数据段中,因为它没有使用__declspec(allocate)进
行声明;而i放入了该段中,因为使用__declspec(allocate)进行了声明。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。