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.

f28069 Loading initialized memory from Flash to RAM.

Hello, 

I am currently trying to use the CLA on the F28069 control card. I wish to have the initialized sections of memory loaded to flash and then copied over to ram for execution. I have successfully done this using a modified linker file and adding the copy section routine to my source code. As long as I do not use the CLA, everything copies over and works fine.

Using the CLA while programming and running from RAM seems to work fine as well. Its combining the two things that gives rise to problems.  

When I try to use the CLA  (with the copy sections routine). it behaves unpredictably. Sometimes the code will run (minus the CLA working) and other times my code will mange to fall into the illegal interrupt service routine. I have even seen the code not follow itself properly. (jump into the wrong function while stepping through the code). I added to the copysections routine to have it take care of the CLA program space. I also tried using memcpy in the CLA initialization and still have had no luck.

Here is the code I added to the Copy Sections routine. 

I noticed that the debugger gives me this error when I try to read any variables that are stored in CLA memory space. 

I think it might be my linker file. I dont get any errors when I compile my code however various linker files seem to give me different results. I also looked at the memory .GEL file and everything looks as it should. 

I have attached the Linker file I am using. It is modified from the one included in control suite (for CLA with FLASH). 

F28069_CLA_FLASH_.txt
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
//###########################################################################
//
// FILE: 28069_RAM_CLA_C_lnk.cmd
//
// TITLE: Linker Command File For F28069 examples that run out of RAM
//
// This ONLY includes all SARAM blocks on the F28069 device.
// This does not include flash or OTP.
//
// Keep in mind that L0,L1,L2,L3 and L4 are protected by the code
// security module.
//
// What this means is in most cases you will want to move to
// another memory map file which has more memory defined.
//
//###########################################################################
// $TI Release: F2806x C/C++ Header Files and Peripheral Examples V150 $
// $Release Date: June 16, 2015 $
// $Copyright: Copyright (C) 2011-2015 Texas Instruments Incorporated -
// http://www.ti.com/ ALL RIGHTS RESERVED $
//###########################################################################
*/
/* ======================================================
// For Code Composer Studio V2.2 and later
// ---------------------------------------
// In addition to this memory linker command file,
// add the header linker command file directly to the project.
// The header linker command file is required to link the
// peripheral structures to the proper locations within
// the memory map.
//
// The header linker files are found in <base>\F2806x_headers\cmd
//
// For BIOS applications add: F2806x_Headers_BIOS.cmd
// For nonBIOS applications add: F2806x_Headers_nonBIOS.cmd
========================================================= */
/* ======================================================
// For Code Composer Studio prior to V2.2
// --------------------------------------
// 1) Use one of the following -l statements to include the
// header linker command file in the project. The header linker
// file is required to link the peripheral structures to the proper
// locations within the memory map */
/* Uncomment this line to include file only for non-BIOS applications */
/* -l F2806x_Headers_nonBIOS.cmd */
/* Uncomment this line to include file only for BIOS applications */
/* -l F2806x_Headers_BIOS.cmd */
/* 2) In your project add the path to <base>\F2806x_headers\cmd to the
library search path under project->build options, linker tab,
library search path (-i).
/*========================================================= */
/* Define the memory block start/length for the F2806x
PAGE 0 will be used to organize program sections
PAGE 1 will be used to organize data sections
Notes:
Memory blocks on F28069 are uniform (ie same
physical memory) in both PAGE 0 and PAGE 1.
That is the same memory region should not be
defined for both PAGE 0 and PAGE 1.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks for you time and help, 

Matt

  • HI,

    On the 28069, the CLA code only runs out of RAML3, phyiscal memory at 0x9000. You cannot load it to any arbitrary RAM. What i'd suggest is allocate Cla1Prog to a RUN mem of RAMLS3 and then memcpy() the section at runtime just to ensure your code works. Once its does you can proceed to use the assembly copy code you are using.
  • Thanks for the advice! Completely overlooked that. Now however when I press the debug button the play, pause and pretty much all of the other debug functions do not work. I have since modified the code and have been working out of ram in the mean time so the code is different than when it was kind of working.
  • I found the error. In the Linker file provided for CLA FLASH programming the begin section is in RAM and not flash. FLASH A is not truncated to fit the Begin_flash section of code like in the linker files that have all code in FLASH and not just CLA code. I truncated the FLASH A size from 0x7F80 to 0x3F80 and everything worked great. Thank you for your advice.

    Regards,

    Matt