This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Greetings,
I am using an F28335 and have moved my code to flash. For performance reasons, I started moving some of the code back to RAM using ramfuncs. This worked well at first. But as I added more routines to ramfuncs, the debugger stopped working. It seems to erase the flash and program it, but it never goes to the main function, and as a result never allows me to run it. I tried backing out the most recent changes, but I still can’t run it. To recover, I needed to go back to an archived version of the code. So far, I have tried to put less than 2K into ramfuncs.
Other than the size of memory, is there a limit on how much code can be in ramfuncs? Is there a way to continuing moving code into ramfuncs?
Thank you,
Ed
Hi Edward,
We are not aware of any such limit. There could be some other error in code which caused this issue. Also look for any warning during compile time.
Regards,
Vivek Singh
Edward Sanders said:But as I added more routines to ramfuncs, the debugger stopped working. It seems to erase the flash and program it, but it never goes to the main function, and as a result never allows me to run it
Ed,
inspect your linker command file, seems like some of the sections are over running. If it doesn't get to main (and I'm guessting that your memcpy for RAMFUNCs is inside main()) then most probably the CINIT initialization isn't completing which means some of the sections are not loaded properly. You can also find out by inspecting your map file.
Hope this helps.
Best Regards
Santosh Athuru
All,
The build shows no warnings. In the map file, I’ve looked at the results in the memory area associated with the ramfuncs. The only other thing in it is the stack. Currently ramfuncs is sized at 0x6e1, and the stack is sized at 0x300. The two are in RAML0. Everything in flash is in FLASHA in which I have consumed 0x23ea of 0x8000 words.
If the linker sections are overrunning, shouldn’t I get a link error? I’m currently receiving no errors and no warnings.
You are correct that the memcpy for ramfuncs is inside main.
There is no cinit routine in the code. Is this something I need to have? Or is it automatically added during the build?
In the map and cmd file, is there something specific I should look for?
Thank you,
Ed
Ed,
the cinit routine comes from the C runtime library. I'm not sure if there would be a warning if the runtime code overlaps with stack or other sections. It will if the LOADED code overlaps with other sections.
In the MAP file and CMD file, pick the sections where the runtime code will be copied and see if there is any other section using the same address range.
Best Regards
Santosh Athuru
All,
I have checked it and don’t see anything. The ramfuncs area is in RAML0, starts at 0x8000, and is 0x6e1 in length. The stack is also in RAML0, and begins at 0x86e2, and is 0x300 in length. So the two don’t overlap, and together are consuming a little over half of the available RAM. There is nothing else that I can see in that area. I have included the cmd file and the map file which I edited to reduce its size. There is still a lot though. Sorry.
F28335.cmd
// TI File $Revision: /main/10 $
// Checkin $Date: July 9, 2008 13:43:56 $
//###########################################################################
MEMORY
{
PAGE 0:
ZONE0 : origin = 0x004000, length = 0x001000
RAML0 : origin = 0x008000, length = 0x001000
RAML1 : origin = 0x009000, length = 0x001000
RAML2 : origin = 0x00A000, length = 0x001000
RAML3 : origin = 0x00B000, length = 0x001000
ZONE6 : origin = 0x0100000, length = 0x100000
ZONE7A : origin = 0x0200000, length = 0x00FC00
FLASHH : origin = 0x300000, length = 0x008000
FLASHG : origin = 0x308000, length = 0x008000
FLASHF : origin = 0x310000, length = 0x008000
FLASHE : origin = 0x318000, length = 0x008000
FLASHD : origin = 0x320000, length = 0x008000
FLASHC : origin = 0x328000, length = 0x008000
CRCMEM : origin = 0x338000, length = 0x000002
FLASHA : origin = 0x338002, length = 0x007F7E
CSM_RSVD : origin = 0x33FF80, length = 0x000076
BEGIN : origin = 0x33FFF6, length = 0x000002
CSM_PWL : origin = 0x33FFF8, length = 0x000008
OTP : origin = 0x380400, length = 0x000400
ADC_CAL : origin = 0x380080, length = 0x000009
IQTABLES : origin = 0x3FE000, length = 0x000b50
IQTABLES2 : origin = 0x3FEB50, length = 0x00008c
FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0
ROM : origin = 0x3FF27C, length = 0x000D44
RESET : origin = 0x3FFFC0, length = 0x000002
VECTORS : origin = 0x3FFFC2, length = 0x00003E
PAGE 1 :
BOOT_RSVD : origin = 0x000000, length = 0x000050
RAMM0 : origin = 0x000050, length = 0x0003B0
RAMM1 : origin = 0x000400, length = 0x000400
RAML4 : origin = 0x00C000, length = 0x001000
RAML56 : origin = 0x00D000, length = 0x002000
RAML7 : origin = 0x00F000, length = 0x001000
ZONE7B : origin = 0x20FC00, length = 0x000400
FLASHB : origin = 0x330000, length = 0x008000
}
SECTIONS
{
.CrcValue : > CRCMEM PAGE = 0
.cinit : > FLASHA PAGE = 0
.pinit : > FLASHA, PAGE = 0
.text : > FLASHA,
LOAD_START(_TextStart),
LOAD_END(_TextEnd),
PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHA,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0
csmpasswds : > CSM_PWL PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0
.stack : > RAML0 PAGE = 0
.ebss : > RAML1 PAGE = 0
.GlobalData : > RAML2 PAGE = 0
.esysmem : > RAMM1 PAGE = 1
.econst : > FLASHA
LOAD_START(_EconstStart),
LOAD_END(_EconstEnd),
PAGE = 0
.switch : > FLASHA PAGE = 0
IQmath : > FLASHC PAGE = 0
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD
.Buffers : > RAML4, PAGE = 1
.ProcessingBuffs : > RAML56, PAGE = 1
.Results : > RAML7, PAGE = 1
ZONE7DATA : > ZONE7B, PAGE = 1
.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD
}
map file
******************************************************************************
TMS320C2000 Linker PC v6.4.6
******************************************************************************
>> Linked Mon Mar 14 16:34:00 2016
OUTPUT FILE NAME: <Proj.out>
ENTRY POINT SYMBOL: "_c_int00" address: 00339c25
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
PAGE 0:
ZONE0 00004000 00001000 00000000 00001000 RWIX
RAML0 00008000 00001000 000009e1 0000061f RWIX
RAML1 00009000 00001000 00000188 00000e78 RWIX
RAML2 0000a000 00001000 0000000a 00000ff6 RWIX
RAML3 0000b000 00001000 00000000 00001000 RWIX
ZONE6 00100000 00100000 00000000 00100000 RWIX
ZONE7A 00200000 0000fc00 00000000 0000fc00 RWIX
FLASHH 00300000 00008000 00000000 00008000 RWIX
FLASHG 00308000 00008000 00000000 00008000 RWIX
FLASHF 00310000 00008000 00000000 00008000 RWIX
FLASHE 00318000 00008000 00000000 00008000 RWIX
FLASHD 00320000 00008000 00000000 00008000 RWIX
FLASHC 00328000 00008000 00000000 00008000 RWIX
CRCMEM 00338000 00000002 00000002 00000000 RWIX
FLASHA 00338002 00007f7e 000023e8 00005b96 RWIX
CSM_RSVD 0033ff80 00000076 00000000 00000076 RWIX
BEGIN 0033fff6 00000002 00000002 00000000 RWIX
CSM_PWL 0033fff8 00000008 00000000 00000008 RWIX
ADC_CAL 00380080 00000009 00000007 00000002 RWIX
OTP 00380400 00000400 00000000 00000400 RWIX
IQTABLES 003fe000 00000b50 00000000 00000b50 RWIX
IQTABLES2 003feb50 0000008c 00000000 0000008c RWIX
FPUTABLES 003febdc 000006a0 00000000 000006a0 RWIX
ROM 003ff27c 00000d44 00000000 00000d44 RWIX
RESET 003fffc0 00000002 00000000 00000002 RWIX
VECTORS 003fffc2 0000003e 00000000 0000003e RWIX
PAGE 1:
BOOT_RSVD 00000000 00000050 00000000 00000050 RWIX
RAMM0 00000050 000003b0 00000000 000003b0 RWIX
RAMM1 00000400 00000400 00000400 00000000 RWIX
DEV_EMU 00000880 00000180 000000d0 000000b0 RWIX
FLASH_REGS 00000a80 00000060 00000008 00000058 RWIX
CSM 00000ae0 00000010 00000010 00000000 RWIX
ADC_MIRROR 00000b00 00000010 00000010 00000000 RWIX
XINTF 00000b20 00000020 0000001e 00000002 RWIX
CPU_TIMER0 00000c00 00000008 00000008 00000000 RWIX
CPU_TIMER1 00000c08 00000008 00000008 00000000 RWIX
CPU_TIMER2 00000c10 00000008 00000008 00000000 RWIX
PIE_CTRL 00000ce0 00000020 0000001a 00000006 RWIX
PIE_VECT 00000d00 00000100 00000100 00000000 RWIX
DMA 00001000 00000200 000000e0 00000120 RWIX
MCBSPA 00005000 00000040 00000025 0000001b RWIX
MCBSPB 00005040 00000040 00000025 0000001b RWIX
ECANA 00006000 00000040 00000034 0000000c RWIX
ECANA_LAM 00006040 00000040 00000040 00000000 RWIX
ECANA_MOTS 00006080 00000040 00000040 00000000 RWIX
ECANA_MOTO 000060c0 00000040 00000040 00000000 RWIX
ECANA_MBOX 00006100 00000100 00000100 00000000 RWIX
ECANB 00006200 00000040 00000034 0000000c RWIX
ECANB_LAM 00006240 00000040 00000040 00000000 RWIX
ECANB_MOTS 00006280 00000040 00000040 00000000 RWIX
ECANB_MOTO 000062c0 00000040 00000040 00000000 RWIX
ECANB_MBOX 00006300 00000100 00000100 00000000 RWIX
EPWM1 00006800 00000022 00000022 00000000 RWIX
EPWM2 00006840 00000022 00000022 00000000 RWIX
EPWM3 00006880 00000022 00000022 00000000 RWIX
EPWM4 000068c0 00000022 00000022 00000000 RWIX
EPWM5 00006900 00000022 00000022 00000000 RWIX
EPWM6 00006940 00000022 00000022 00000000 RWIX
ECAP1 00006a00 00000020 00000020 00000000 RWIX
ECAP2 00006a20 00000020 00000020 00000000 RWIX
ECAP3 00006a40 00000020 00000020 00000000 RWIX
ECAP4 00006a60 00000020 00000020 00000000 RWIX
ECAP5 00006a80 00000020 00000020 00000000 RWIX
ECAP6 00006aa0 00000020 00000020 00000000 RWIX
EQEP1 00006b00 00000040 00000040 00000000 RWIX
EQEP2 00006b40 00000040 00000040 00000000 RWIX
GPIOCTRL 00006f80 00000040 0000002e 00000012 RWIX
GPIODAT 00006fc0 00000020 00000020 00000000 RWIX
GPIOINT 00006fe0 00000020 0000000a 00000016 RWIX
SYSTEM 00007010 00000020 00000020 00000000 RWIX
SPIA 00007040 00000010 00000010 00000000 RWIX
SCIA 00007050 00000010 00000010 00000000 RWIX
XINTRUPT 00007070 00000010 00000010 00000000 RWIX
ADC 00007100 00000020 0000001e 00000002 RWIX
SCIB 00007750 00000010 00000010 00000000 RWIX
SCIC 00007770 00000010 00000010 00000000 RWIX
I2CA 00007900 00000040 00000022 0000001e RWIX
RAML4 0000c000 00001000 00001000 00000000 RWIX
RAML56 0000d000 00002000 00001180 00000e80 RWIX
RAML7 0000f000 00001000 00001000 00000000 RWIX
ZONE7B 0020fc00 00000400 00000000 00000400 RWIX
FLASHB 00330000 00008000 00000000 00008000 RWIX
CSM_PWL 0033fff8 00000008 00000008 00000000 RWIX
PARTID 00380090 00000001 00000001 00000000 RWIX
SECTION ALLOCATION MAP
output attributes/
section page origin length input sections
-------- ---- ---------- ---------- ----------------
.stack 0 000086e2 00000300 UNINITIALIZED
000086e2 00000300 --HOLE--
.ebss 0 00009000 00000188 UNINITIALIZED
00009000 00000142
00009142 00000018
0000915a 00000008
00009162 00000006
00009168 00000005
0000916d 00000001
0000916e 00000004
00009172 00000004
00009176 00000004
0000917a 00000002
0000917c 00000002
0000917e 00000002
00009180 00000002
00009182 00000002
00009184 00000002
00009186 00000001
00009187 00000001
.GlobalData
* 0 0000a000 0000000a UNINITIALIZED
0000a000 0000000a
.CrcValue
* 0 00338000 00000002
00338000 00000002
ramfuncs 0 00338002 000006e1 RUN ADDR = 00008000
00338002 000000fe
00338100 000000ce
003381ce 000000ba
00338288 000000b9
00338341 000000a7
003383e8 000000a5
0033848d 0000009c
00338529 00000089
003385b2 0000006b
0033861d 00000032
0033864f 0000002b
0033867a 00000029
003386a3 00000021
003386c4 0000001b
003386df 00000004
.text 0 003386e4 00001970
003386e4 000003e9
00338acd 00000316
00338de3 00000203
00338fe6 000001e2
003391c8 000001bf
00339387 00000133
003394ba 000000f8
003395b2 0000009f
00339651 00000088
003396d9 00000086
0033975f 0000007c
003397db 00000076
00339851 00000073
003398c4 00000073
00339937 00000071
003399a8 00000068
00339a10 00000062
00339a72 00000061
00339ad3 0000005b
00339b2e 00000058
00339b86 00000050
00339bd6 0000004f
00339c25 00000046
00339c6b 00000045
00339cb0 00000036
00339ce6 00000034
00339d1a 00000033
00339d4d 0000002d
00339d7a 00000028
00339da2 00000028
00339dca 00000028
00339df2 00000024
00339e16 00000024
00339e3a 00000022
00339e5c 00000022
00339e7e 00000020
00339e9e 0000001e
00339ebc 0000001e
00339eda 0000001c
00339ef6 0000001a
00339f10 00000019
00339f29 00000019
00339f42 00000016
00339f58 00000016
00339f6e 00000016
00339f84 00000015
00339f99 00000014
00339fad 00000014
00339fc1 00000014
00339fd5 00000013
00339fe8 00000013
00339ffb 0000000e
0033a009 0000000c
0033a015 00000009
0033a01e 00000007
0033a025 00000007
0033a02c 00000006
0033a032 00000005
0033a037 00000005
0033a03c 00000004
0033a040 00000004
0033a044 00000003
0033a047 00000003
0033a04a 00000003
0033a04d 00000003
0033a050 00000001
0033a051 00000001
0033a052 00000001
0033a053 00000001
.econst 0 0033a054 00000360
0033a054 00000200
0033a254 00000100
0033a354 0000002a
0033a37e 0000002a
0033a3a8 00000004
0033a3ac 00000004
0033a3b0 00000004
.cinit 0 0033a3b4 00000031
0033a3b4 0000000a
0033a3be 00000005
0033a3c3 00000005
0033a3c8 00000005
0033a3cd 00000005
0033a3d2 00000005
0033a3d7 00000004
0033a3db 00000004
0033a3df 00000004
0033a3e3 00000002
.pinit 0 0033a3e6 00000006
0033a3e6 00000002
0033a3e8 00000002
0033a3ea 00000002
codestart
* 0 0033fff6 00000002
0033fff6 00000002
.adc_cal 0 00380080 00000007
00380080 00000007
.esysmem 1 00000400 00000400
00000400 00000001
00000401 000003ff
DevEmuRegsFile
* 1 00000880 000000d0
00000880 000000d0
FlashRegsFile
* 1 00000a80 00000008
00000a80 00000008
CsmRegsFile
* 1 00000ae0 00000010
00000ae0 00000010
AdcMirrorFile
* 1 00000b00 00000010
00000b00 00000010
XintfRegsFile
* 1 00000b20 0000001e
00000b20 0000001e
CpuTimer0RegsFile
* 1 00000c00 00000008
00000c00 00000008
CpuTimer1RegsFile
* 1 00000c08 00000008
00000c08 00000008
CpuTimer2RegsFile
* 1 00000c10 00000008
00000c10 00000008
PieCtrlRegsFile
* 1 00000ce0 0000001a
00000ce0 0000001a
PieVectTableFile
* 1 00000d00 00000100
00000d00 00000100
DmaRegsFile
* 1 00001000 000000e0
00001000 000000e0
McbspaRegsFile
* 1 00005000 00000025
00005000 00000025
McbspbRegsFile
* 1 00005040 00000025
00005040 00000025
ECanaRegsFile
* 1 00006000 00000034
00006000 00000034
ECanaLAMRegsFile
* 1 00006040 00000040
00006040 00000040
ECanaMOTSRegsFile
* 1 00006080 00000040
00006080 00000040
ECanaMOTORegsFile
* 1 000060c0 00000040
000060c0 00000040
ECanaMboxesFile
* 1 00006100 00000100
00006100 00000100
ECanbRegsFile
* 1 00006200 00000034
00006200 00000034
ECanbLAMRegsFile
* 1 00006240 00000040
00006240 00000040
ECanbMOTSRegsFile
* 1 00006280 00000040
00006280 00000040
ECanbMOTORegsFile
* 1 000062c0 00000040
000062c0 00000040
ECanbMboxesFile
* 1 00006300 00000100
00006300 00000100
EPwm1RegsFile
* 1 00006800 00000022
00006800 00000022
EPwm2RegsFile
* 1 00006840 00000022
00006840 00000022
EPwm3RegsFile
* 1 00006880 00000022
00006880 00000022
EPwm4RegsFile
* 1 000068c0 00000022
000068c0 00000022
EPwm5RegsFile
* 1 00006900 00000022
00006900 00000022
EPwm6RegsFile
* 1 00006940 00000022
00006940 00000022
ECap1RegsFile
* 1 00006a00 00000020
00006a00 00000020
ECap2RegsFile
* 1 00006a20 00000020
00006a20 00000020
ECap3RegsFile
* 1 00006a40 00000020
00006a40 00000020
ECap4RegsFile
* 1 00006a60 00000020
00006a60 00000020
ECap5RegsFile
* 1 00006a80 00000020
00006a80 00000020
ECap6RegsFile
* 1 00006aa0 00000020
00006aa0 00000020
EQep1RegsFile
* 1 00006b00 00000040
00006b00 00000040
EQep2RegsFile
* 1 00006b40 00000040
00006b40 00000040
GpioCtrlRegsFile
* 1 00006f80 0000002e
00006f80 0000002e
GpioDataRegsFile
* 1 00006fc0 00000020
00006fc0 00000020
GpioIntRegsFile
* 1 00006fe0 0000000a
00006fe0 0000000a
SysCtrlRegsFile
* 1 00007010 00000020
00007010 00000020
SpiaRegsFile
* 1 00007040 00000010
00007040 00000010
SciaRegsFile
* 1 00007050 00000010
00007050 00000010
XIntruptRegsFile
* 1 00007070 00000010
00007070 00000010
AdcRegsFile
* 1 00007100 0000001e
00007100 0000001e
ScibRegsFile
* 1 00007750 00000010
00007750 00000010
ScicRegsFile
* 1 00007770 00000010
00007770 00000010
I2caRegsFile
* 1 00007900 00000022
00007900 00000022
CsmPwlFile
* 1 0033fff8 00000008
0033fff8 00000008
PartIdRegsFile
* 1 00380090 00000001
00380090 00000001
.Buffers 1 0000c000 00001000
0000c000 00001000
.ProcessingBuffs
* 1 0000d000 00001180
0000d000 00001180
.DftResults
* 1 0000f000 00001000
0000f000 00001000
.reset 0 003fffc0 00000002
003fffc0 00000002
vectors 0 003fffc2 00000000
Thank you,
Ed
Hello Ed,
The files look ok. I don't see anything suspicious, but please make sure that symbol _c_int00 is listed in the parts you edited out from the map file.
One thing you could try: place a breakpoint at this instruction: LB _c_int00. This must be in something called xxxxxx_CodeStartBranch.asm. This is the instruction the ROM bootloader will jump to after finishing doing its thing. Watching what it does may give you a clue about what is happening.
BR,
Janos
Hi Janos,
The map file does contain a reference to _c_int00 as follows:
0 00339c25 _c_int00
I put a breakpoint in CodeStartBranch.asm and hit that. Single stepping, I found myself in boot28.inc. In the PROCESS PINIT SECTION (that’s what it says in the comment block directly above it), it gets to LOOP_PINIT:, and proceeds to the LCR instruction. There is no return from that, and the system restarts. I can’t even step into that without the reset. What does that mean?
Thanks,
Ed
Hi Ed,
Quote from the compiler docs:
All global C++ variables that have constructors must have their constructor called before main(). The
compiler builds a table in a section called .pinit of global constructor addresses that must be called, in
order, before main(). The linker combines the .pinit section form each input file to form a single table in the
.pinit section. The boot routine uses this table to execute the constructors.
I have never worked with C++ on C28 before so this is just a theory: I guess you have some C++ code you intended to run from the RAM and the pinit tries to run constructors from the RAM before your main had the chance to copy the code from flash to RAM.
We can check it by reading the .pinit section from the flash (6 words between 0x0033a3e6 and 0x0033a3ec).
Regards,
Janos
Hi Janos,
The six words at that address are all 0xFFFF.
But the part about the constructors makes sense because I had just tried to move a couple of constructors to the ramfuncs area. When I removed the attempt to move them, it started to work again. Do you know of a way that I can move the constructors to RAM?
Thank you,
Ed