ADSP-BF700 : Trying to move a function into L@ RAM - Working?

I am trying to prove that I can move a function from regular L1 memory to L2 RAM on the BF700.  I looked at the following .PDF manual to see what to do. I am putting a "#pragma section ("L2_sram")" before a function.

Am I doing this correctly?  Why can't I readily see that the function HAS moved into L2 RAM?

========================================

Page 3-9 of "CCES 2.8.0 Linker and Utilities Manual"

Input Sections

Input sections are used in .SECTION directives in assembly as well as section specifiers and pragmas in C/C++. They appear in the section header listing when running elfdump on a .doj file.

For historical reasons, the names of many of these start with prefix seg where one might expect sec.

==================================

code snippet from uart.c

/********************************************************************************
* Text commands *
********************************************************************************/
#pragma section ("L2_sram")
int txt_BAUD(char *pCommandLine)
{
char string[40];
char *rem;
int baud;
u8 chan;

if (*pCommandLine != NULL) {

. . . << A lot of code skipped to placate my boss >>

return CMD_DONE;
}

=================================

Section headers from "elfdump uart.doj" (on ubuntu)


/* Section Header #0 '' 0x1F88 */
/* Section Header #1 '.strtab' 0x1FB0 */
/* Section Header #2 '.symtab' 0x1FD8 */
/* Section Header #3 'program' 0x2000 */
/* Section Header #4 'data1' 0x2028 */
/* Section Header #5 'constdata' 0x2050 */
/* Section Header #6 'bsz' 0x2078 */
/* Section Header #7 '.rela.program' 0x20A0 */
/* Section Header #8 '.rela.constdata' 0x20C8 */
/* Section Header #9 '.align.program' 0x20F0 */
/* Section Header #10 '.align.data1' 0x2118 */
/* Section Header #11 '.align.constdata' 0x2140 */
/* Section Header #12 '.align.bsz' 0x2168 */
/* Section Header #13 '.commandLine' 0x2190 */
/* Section Header #14 '.attributes' 0x21B8 */
/* Section Header #15 '.adi.attributes' 0x21E0 */

Parents
  • Hi,

    Your understanding is correct and the code you've provided does use the correct section. I wonder if the issue is related to the elfdump you are using; I don't see a version of elfdump available for Ubuntu. Can you try the elfdump.exe provided in the root directory of CrossCore Embedded Studio for Windows?

    With the code you provided I get the following output from the CrossCore elfdump:

    ---- ELF Section Header Table ----
    
     Section Header Table
    index     type   flags    addr    offset  size:Bytes  link info align ensz name
    
    0000      null 00000000 00000000 00000000 00000000:B    0    0    0    0   ''
    0001    strtab 00000000 00000000 00000034 000000c4:B    0    0    1    0   '.strtab'
    0002    symtab 00000000 00000000 000000f8 000000c0:B    1   11    0   16   '.symtab'
    0003  progbits 00000006 00000000 000001b8 0000000e:B    0    0    2    1   'L2_sram'
    0004  progbits 00000003 00000000 000001c6 00000000:B    0    0    1    1   'program'
    0005     align 00000000 00000000 000001c6 00000018:B    2    3    1   12   '.align.L2_sram'
    0006     align 00000000 00000000 000001de 0000000c:B    2    4    1   12   '.align.program'
    0007    strtab 00000000 00000000 000001ea 000000eb:B    0    0    1    0   '.commandLine'
    0008    strtab 00000000 00000000 000002d5 00000021:B    0    0    1    0   '.attributes'
    0009  adi_attr 00000000 00000000 000002f6 00000039:B    0    0    1    0   '.adi.attributes'
    

    Using the readelf from the arm toolchain (gcc) I can also see the l2_sram section:

    Symbol table '.symtab' contains 12 entries:
       Num:    Value  Size Type    Bind   Vis      Ndx Name
         0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
         1: 00000000     0 FILE    LOCAL  DEFAULT  ABS uart.c
         2: 0000000e     0 FUNC    LOCAL  DEFAULT    3 .LN._txt_BAUD.end
         3: 00000000     0 FUNC    LOCAL  DEFAULT    3 .LN_txt_BAUD
         4: 0000000e     0 FUNC    LOCAL  DEFAULT    3 ._txt_BAUD.end
         5: 00000000     0 SECTION LOCAL  DEFAULT    5 .align.L2_sram
         6: 00000000     0 SECTION LOCAL  DEFAULT    6 .align.program
         7: 00000000     0 FUNC    LOCAL  DEFAULT    3 .epctext
         8: 00000000     0 FUNC    LOCAL  DEFAULT    4 .epctext.end
         9: 00000000     0 SECTION LOCAL  DEFAULT    3 L2_sram
        10: 00000000     0 SECTION LOCAL  DEFAULT    4 program
        11: 00000000     0 FUNC    GLOBAL DEFAULT    3 _txt_BAUD

    If you're not seeing it being emitted in the elf that would suggest that it's not being built as you expected somehow.

    Another option to identifying which section and memory address the function has gone to is to look up the symbol in the memory map.
    You can do this by enabling 'Generate symbol map (-map)' in the project options, under Linker > General.

    Regards,
    Murray

Reply Children
No Data