c++ - How to write data at a specific address in the .text section using gcc
PHP中文网
PHP中文网 2017-06-10 09:48:37
0
1
1026

1. Now I need to insert some data into a certain address of .text (code segment). For example, {'a','b','c','d','e','f','g','g'}, the code used for
is char sgy_data2[32] __attribute__((section(".mysection1"))) = {'a','b','c','d','e','f','g','g'};
The starting address of my .text segment is 0XFFFE8000, and then I want to write data at 0XFFFE8400 (the total length of .text is greater than 1024). What should I do?
2. If you have used E2 successfully, can you tell me how to set it up?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
phpcn_u1582

For E2:In order to have your data populated into your sections, you should take some additional steps. After adding the section, right click on it and add the following two expressions:
.section-name
.section-name.*
(GNU official explanation)
If you do not add the keep option, no matter how you define the variable, you should "use" this variable, otherwise the compiler will ignore this variable and will not write what you want to the bin file. required data.
As for other situations, it is similar.

.text 0xFFE00000 : AT (0xFFE00000)
    {
        *(.text)
        *(.text.*)
        *(P)
        etext = .;
    } > ROM
    
    相对应的你的gsi文件应该是这么样的
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template