AnsweredAssumed Answered

Placing C code in my own memory section

Question asked by Alexy on Oct 18, 2011
Latest reply on Nov 14, 2011 by kennie

HI!

I need to put my code in my own memory section, located in another (not block0) internal RAM bank of ADSP-21489, how can I do it?

 

On 21489 EZLITE, I develop uart_echo_back_c example, trying to create my memory segment and put there some code (VISA mode). The definition of segment and section I copy from “seg_int_code” and “seg_swco”.

 

LDF changes:

//replacing END of seg_pmda

  seg_pmda { TYPE(PM RAM) START(0x000c0000) END(0x000c4fff) WIDTH(32)       }

//placing my memory segment

seg_myco { TYPE(SW RAM) START(0x0018a000) END(0x0018ffff) WIDTH(16)            }

seg_myco PM

        {

            NO_FORCE_CONTIGUITY

                INPUT_SECTIONS(  $OBJECTS(seg_myco)  $LIBRARIES(seg_myco) )

        } > seg_myco

 

        seg_swmy SW

        {

            NO_FORCE_CONTIGUITY

            INPUT_SECTIONS("UART echo back_C.doj"(seg_swmy))

        } > seg_myco     

 

uart_echo_back_c.C changes:

#pragma section("seg_swmy")

void zero_mo()

{

            int i;

            for (i=0; i < 1500; i++)

                        interface_regs[i]=0;   

}…

Compilation and linking are done without errors. In map file I see _zero_mo at 0x18a002, size 0x23, but it does not work. When calling zero_mo(), in disassembly I see some debris.

Then I try to add another one function with the same body and put it after zero_mo():

#pragma section("seg_swmy")

void pust()

{

            int i;

            for (i=0; i < 1500; i++)

                        interface_regs[i]=0;   

}

In map file _pust placed at 0x18a025, size 0x23, and work right. Below, it is the dump of this functions memory space:

 

[0018A002] 0xFFFF

[0018A025] 0x1607

[0018A003] 0x0816

[0018A026] 0xFFFF

[0018A004] 0x017E

[0018A027] 0xFFFE

[0018A005] 0xDCC3

[0018A028] 0x9D08

[0018A006] 0x0000

[0018A029] 0x16FE

[0018A007] 0x1400

[0018A02A] 0x9C08

[0018A008] 0x9C08

[0018A02B] 0x017E

[0018A009] 0x0149

[0018A02C] 0x0F81

[0018A00A] 0x9C08

[0018A02D] 0x05DC

[0018A00B] 0x229D

[0018A02E] 0xC321

[0018A00C] 0x073E

[0018A02F] 0x0722

[0018A00D] 0xEB4D

[0018A030] 0x0000

[0018A00E] 0x083F

[0018A031] 0x0013

[0018A00F] 0x0100

[0018A032] 0x1014

[0018A010] 0xFFFF

[0018A033] 0x000B

[0018A011] 0x0816

[0018A034] 0x61EA

[0018A012] 0x017E

[0018A035] 0x9C08

[0018A013] 0xDCC3

[0018A036] 0x127E

[0018A014] 0x0000

[0018A037] 0x0001

[0018A015] 0x1400

[0018A038] 0x493E

[0018A016] 0x9C08

[0018A039] 0x96BF

[0018A017] 0x0149

[0018A03A] 0x9C08

[0018A018] 0x9C08

[0018A03B] 0x017E

[0018A019] 0x229D

[0018A03C] 0xC522

[0018A01A] 0x073E

[0018A03D] 0x9D08

[0018A01B] 0xEB4D

[0018A03E] 0x017E

[0018A01C] 0x083F

[0018A03F] 0x073E

[0018A01D] 0x0100

[0018A040] 0x00FF

[0018A01E] 0xFFEB

[0018A041] 0xFFEB

[0018A01F] 0x4DFE

[0018A042] 0x4DFE

[0018A020] 0x0E3F

[0018A043] 0x0E3F

[0018A021] 0x083F

[0018A044] 0x083F

[0018A022] 0x343F

[0018A045] 0x343F

[0018A023] 0x1901

[0018A046] 0x1901

[0018A024] 0x0001

[0018A047] 0x0001

 

What Am I do wrong?

Outcomes