HOWTO: Execute a library function from RAM memory using GNU build tools

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

HOWTO: Execute a library function from RAM memory using GNU build tools

HOWTO: Execute a library function from RAM memory using GNU build tools

The document describes the steps that need to be done in order to place and execute a library function from a custom memory section - typically RAM using GNU Build tools. The instructions are applicable to any GNU tool-chain. It is demonstrated on a New S32DS Project created in S32 Design Studio for ARM.

Lets assume that we'd like to execute memcpy() function from the standard library (NewLib).

1) The first step is to exclude specific library object file(s) from the input section (using EXCLUDE_FILE) so they will not be linked into the standard .text* flash section. 

The input section associated with EXCLUDE_FILE shall not interfere with the same input section used later in section list (e.g. with *(.text*) input section deleted from the list below). EXCLUDE_FILE in behaves the same was as *.(text*) rule - it only exclude selected file(s) but places all the remaining (non-excluded) input data.

/* The program code and other data goes into internal flash */
  .text :
  {
    . = ALIGN(4);
    *(.text)                 /* .text sections (code) */

     /* Exclude file(s) from NewLib libc.a from .text.* section  */     
     *(EXCLUDE_FILE (*libc.a:lib_a-memcpy-stub.o) .text*)   
 
    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
    *(.glue_7)               /* glue arm to thumb code */
    *(.glue_7t)              /* glue thumb to arm code */
    *(.eh_frame)
    KEEP (*(.init))
    KEEP (*(.fini))
    . = ALIGN(4);
  } > m_text

2) Now let's place the memcpy object into a code_ram section which is already defined in the project .ld file. This section is dedicated to a code that shall be executed from RAM (startup routine initializes this section). For more details see HOWTO: Run a routine from RAM in S32 Design Studio  .

The following line places the code (.text* section) from the object file (lib_a-memcpy-stub.o) from the standard NewLib (libc.a) 

*libc.a:lib_a-memcpy-stub.o (.text*)

into .code section:

.code : AT(__CODE_ROM)
  {
    . = ALIGN(4);
    __CODE_RAM = .;
    __code_start__ = .;      /* Create a global symbol at code start. */
    __code_ram_start__ = .;

    *(.code_ram)             /* Custom section for storing code in RAM */

    *libc.a:lib_a-memcpy-stub.o (.text*)   /* add memcpy from the NewLib library here*/ 
  
    . = ALIGN(4);
    __code_end__ = .;        /* Define a global symbol at code end. */
    __code_ram_end__ = .;
  } > m_data

After building the project you can check the map file to confirm memcpy is indeed placed into .code section in RAM memory:

.code           0x1fff881c       0x18 load address 0x00000d90
                0x1fff881c                . = ALIGN (0x4)
                0x1fff881c                __CODE_RAM = .
                0x1fff881c                __code_start__ = .
                0x1fff881c                __code_ram_start__ = .
 *(.code_ram)
 *libc.a:lib_a-memcpy-stub.o(.text*)
 .text.memcpy   0x1fff881c       0x16 C:/NXP/S32DS_ARM_v2018.R1/Cross_Tools/gcc-6.3-arm32-eabi/arm-none-eabi/newlib/lib/thumb/v7e-m\libc.a(lib_a-memcpy-stub.o)
                0x1fff881c                memcpy
                0x1fff8834                . = ALIGN (0x4)
 *fill*         0x1fff8832        0x2 
                0x1fff8834                __code_end__ = .
                0x1fff8834                __code_ram_end__ = .
                0x00000da8                __CODE_END = (__CODE_ROM + (__code_end__ - __code_start__))
                0x00000da8                __CUSTOM_ROM = __CODE_END

Note

If you are placing a function into RAM always consider to add sub-functions called by that function (typically located in a different object file).

标记 (4)
%3CLINGO-SUB%20id%3D%22lingo-sub-1106568%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20GNU%20%E6%9E%84%E5%BB%BA%E5%B7%A5%E5%85%B7%E4%BB%8E%20RAM%20%E5%86%85%E5%AD%98%E4%B8%AD%E6%89%A7%E8%A1%8C%E5%BA%93%E5%87%BD%E6%95%B0%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1106568%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3Dutf-8%22%20%2F%26gt%3B%0A%3CP%3E%E8%AF%A5%E6%96%87%E6%A1%A3%E9%98%90%E8%BF%B0%E4%BA%86%E4%BD%BF%E7%94%A8%20GNU%20%E6%9E%84%E5%BB%BA%E5%B7%A5%E5%85%B7%E4%BB%8E%E8%87%AA%E5%AE%9A%E4%B9%89%E5%86%85%E5%AD%98%E5%8C%BA%E5%9F%9F%EF%BC%88%E9%80%9A%E5%B8%B8%E4%B8%BA%20RAM%EF%BC%89%E4%B8%AD%E6%94%BE%E7%BD%AE%E5%B9%B6%E6%89%A7%E8%A1%8C%E5%BA%93%E5%87%BD%E6%95%B0%E6%89%80%E9%9C%80%E7%9A%84%E6%AD%A5%E9%AA%A4%E3%80%82%E8%BF%99%E4%BA%9B%E8%AF%B4%E6%98%8E%E9%80%82%E7%94%A8%E4%BA%8E%E4%BB%BB%E4%BD%95%20GNU%20%E5%B7%A5%E5%85%B7%E9%93%BE%E3%80%82%E8%AF%A5%E5%8A%9F%E8%83%BD%E5%B7%B2%E5%9C%A8%20S32%20Design%20Studio%20for%20ARM%20%E4%B8%AD%E5%88%9B%E5%BB%BA%E7%9A%84%E6%96%B0%20S32DS%20%E9%A1%B9%E7%9B%AE%E4%B8%AD%E5%BE%97%E5%88%B0%E9%AA%8C%E8%AF%81%E3%80%82%3C%2FP%3E%3CP%3E%E5%81%87%E8%AE%BE%E6%88%91%E4%BB%AC%E5%B8%8C%E6%9C%9B%E6%89%A7%E8%A1%8C%E6%A0%87%E5%87%86%E5%BA%93%20(NewLib)%20%E4%B8%AD%E7%9A%84%20%3CEM%3Ememcpy()%3C%2FEM%3E%20%E5%87%BD%E6%95%B0%E3%80%82%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E1%3C%2FSTRONG%3E%EF%BC%89%20%E7%AC%AC%E4%B8%80%E6%AD%A5%E6%98%AF%E4%BB%8E%E8%BE%93%E5%85%A5%E9%83%A8%E5%88%86%EF%BC%88%E4%BD%BF%E7%94%A8%20%3CSTRONG%3EEXCLUDE_FILE%3C%2FSTRONG%3E%20%EF%BC%89%E4%B8%AD%E6%8E%92%E9%99%A4%E7%89%B9%E5%AE%9A%E7%9A%84%E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P%3E%3C%2FP%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%20translate%3D%22no%22%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20The%20program%20code%20and%20other%20data%20goes%20into%20internal%20flash%20*%2F%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etext%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EALIGN%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etext%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20.text%20sections%20(code)%20*%2F%3C%2FSPAN%3E%0A%0A%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Exclude%20file(s)%20from%20NewLib%20libc.a%20from%20.text.*%20section%20%20*%2F%3C%2FSPAN%3E%20%20%20%20%20%0A%20%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EEXCLUDE_FILE%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3Elibc%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ea%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3Elib_a%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Ememcpy%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Estub%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Eo%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etext%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%0A%20%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Erodata%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20.rodata%20sections%20(constants%2C%20strings%2C%20etc.)%20*%2F%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Erodata%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20.rodata*%20sections%20(constants%2C%20strings%2C%20etc.)%20*%2F%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Eglue_7%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20glue%20arm%20to%20thumb%20code%20*%2F%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Eglue_7t%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20glue%20thumb%20to%20arm%20code%20*%2F%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Eeh_frame%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20KEEP%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Einit%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20KEEP%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Efini%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EALIGN%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26gt%3B%3C%2FSPAN%3E%20m_text%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSP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%20target%3D%22_blank%22%3EHOWTO%EF%BC%9A%E5%9C%A8%20S32%20Design%20Studio%20%E4%B8%AD%E4%BB%8E%20RAM%20%E8%BF%90%E8%A1%8C%E4%BE%8B%E7%A8%8B%3C%2FA%3E%E3%80%82%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%E4%BB%A5%E4%B8%8B%E4%BB%A3%E7%A0%81%E8%A1%8C%E5%B0%86%E5%AF%B9%E8%B1%A1%E6%96%87%E4%BB%B6%EF%BC%88lib_a-memcpy-stub.o%20%EF%BC%89%E4%B8%AD%E7%9A%84%E4%BB%A3%E7%A0%81%EF%BC%88.text*%20%E6%AE%B5%EF%BC%89%E4%BB%8E%E6%A0%87%E5%87%86%20NewLib%20(libc.a)%20%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%20translate%3D%22no%22%3E%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3Elibc%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ea%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3Elib_a%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Ememcpy%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Estub%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Eo%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etext%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3C%2FP%3E%3CP%3E%E6%94%BE%E7%BD%AE%E5%88%B0%E7%9B%AE%E6%A0%87%E7%A8%8B%E5%BA%8F%E7%9A%84%20.code%20%E6%AE%B5%EF%BC%9A%3C%2FP%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%20translate%3D%22no%22%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ecode%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EAT%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E__CODE_ROM%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EALIGN%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20__CODE_RAM%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20__code_start__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Create%20a%20global%20symbol%20at%20code%20start.%20*%2F%3C%2FSPAN%3E%0A%20%20%20%20__code_ram_start__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ecode_ram%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Custom%20section%20for%20storing%20code%20in%20RAM%20*%2F%3C%2FSPAN%3E%0A%0A%20%20%20%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3Elibc%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ea%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3Elib_a%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Ememcpy%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Estub%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Eo%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etext%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20add%20memcpy%20from%20the%20NewLib%20library%20here*%2F%3C%2FSPAN%3E%20%0A%20%20%0A%20%20%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EALIGN%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%20%20%20__code_end__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Define%20a%20global%20symbol%20at%20code%20end.%20*%2F%3C%2FSPAN%3E%0A%20%20%20%20__code_ram_end__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%0A%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26gt%3B%3C%2FSPAN%3E%20m_data%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3C%2FP%3E%3CP%3E%E9%A1%B9%E7%9B%AE%E6%9E%84%E5%BB%BA%E5%AE%8C%E6%88%90%E5%90%8E%EF%BC%8C%E6%82%A8%E5%8F%AF%E4%BB%A5%E6%A3%80%E6%9F%A5%E5%9C%B0%E5%9B%BE%E6%96%87%E4%BB%B6%EF%BC%8C%E4%BB%A5%E7%A1%AE%E8%AE%A4%20memcpy%20%E7%A1%AE%E5%AE%9E%E5%B7%B2%E6%94%BE%E7%BD%AE%E5%88%B0RAM%20%E5%86%85%E5%AD%98%E4%B8%AD%E7%9A%84%20.code%20%E9%83%A8%E5%88%86%EF%BC%9A%3C%2FP%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%20translate%3D%22no%22%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ecode%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff881c%3C%2FSPAN%3E%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x18%3C%2FSPAN%3E%20load%20address%20%3CSPAN%20class%3D%22number%20token%22%3E0x00000d90%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff881c%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20ALIGN%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0x4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff881c%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__CODE_RAM%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff881c%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__code_start__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff881c%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__code_ram_start__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ecode_ram%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3Elibc%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ea%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3Elib_a%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Ememcpy%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Estub%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3Eo%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etext%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Etext%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Ememcpy%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff881c%3C%2FSPAN%3E%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x16%3C%2FSPAN%3E%20C%3CSPAN%20class%3D%22punctuation%20token%22%3E%3A%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3ENXP%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3ES32DS_ARM_v2018%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3ER1%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3ECross_Tools%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3Egcc%3CSPAN%20class%3D%22number%20token%22%3E-6.3%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Earm32%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Eeabi%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3Earm%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Enone%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Eeabi%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3Enewlib%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3Elib%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3Ethumb%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3Ev7e%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Em%5Clibc%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3Ea%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Elib_a%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Ememcpy%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3Estub%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3Eo%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff881c%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20memcpy%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff8834%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20ALIGN%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0x4%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3Efill%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff8832%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x2%3C%2FSPAN%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff8834%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__code_end__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x1fff8834%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__code_ram_end__%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E.%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x00000da8%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__CODE_END%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E__CODE_ROM%20%3CSPAN%20class%3D%22operator%20token%22%3E%2B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E__code_end__%20%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3E%20__code_start__%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22number%20token%22%3E0x00000da8%3C%2FSPAN%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20__CUSTOM_ROM%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20__CODE_END%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3C%2FP%3E%3CH5%20id%3D%22toc-hId-1782797876%22%20id%3D%22toc-hId-1782797876%22%20id%3D%22toc-hId--1595084397%22%3E%E6%B3%A8%3C%2FH5%3E%3CP%3E%E5%A6%82%E6%9E%9C%E6%82%A8%E5%B0%86%E6%9F%90%E4%B8%AA%E5%87%BD%E6%95%B0%E6%94%BE%E5%85%A5%20RAM%EF%BC%8C%E8%AF%B7%E5%A7%8B%E7%BB%88%E8%80%83%E8%99%91%E6%B7%BB%E5%8A%A0%E8%AF%A5%E5%87%BD%E6%95%B0%E8%B0%83%E7%94%A8%E7%9A%84%E5%AD%90%E5%87%BD%E6%95%B0%EF%BC%88%E8%BF%99%E4%BA%9B%E5%AD%90%E5%87%BD%E6%95%B0%E9%80%9A%E5%B8%B8%E4%BD%8D%E4%BA%8E%E4%B8%8D%E5%90%8C%E7%9A%84%E7%9B%AE%E6%A0%87%E6%96%87%E4%BB%B6%E4%B8%AD%EF%BC%89%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1106568%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3ECC%2B%2B%20%E5%BA%93%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E7%BC%96%E8%AF%91%E5%99%A8%EF%BC%8D%E6%B1%87%E7%BC%96%E5%99%A8%EF%BC%8D%E9%93%BE%E6%8E%A5%E5%99%A8%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
100% 有帮助 (1/1)
版本历史
最后更新:
‎09-10-2020 01:59 AM
更新人: