Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE, UNIFLASH
Tool/software: Code Composer Studio
Hi,
I have done the EEPROM Emulation of Flash Sector B .I can able to write /read now but code runs on Debug mode . When i am reset /power off the launch pad its not works..
Done blinky code for confirm the data retention on memory ... In Debug mode works fine ... RESET, POWER OFF /ON , RUN->LOAD methods its not works ...
Run---->Load not works ..
Debug-->Debug as Works
My Debug Configuration setting
Flash Setting
CODE:
//###########################################################################
//
// Included Files
//
#include "F28x_Project.h"
#include <string.h>
#include "flash_programming_c28.h" // Flash API example header file
#include "F021_F2837xD_C28x.h"
#include"EEPROM.h"
#include"MemCopy.h"
#include"stdio.h"
//
// Defines
//
#define WORDS_IN_FLASH_BUFFER 0xFF // Programming data buffer, words
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
#define ramFuncSection ".TI.ramfunc"
#else
#define ramFuncSection "ramfuncs"
#endif
#endif
//
// Pragma
//
#pragma CODE_SECTION(EEPROM_Erase,"ramfuncs");
#pragma CODE_SECTION(EEPROM_Write,"ramfuncs");
#pragma CODE_SECTION(EEPROM_UpdateBankStatus,"ramfuncs");
#pragma CODE_SECTION(EEPROM_UpdatePageStatus,"ramfuncs");
#pragma CODE_SECTION(EEPROM_ProgramSingleByte,"ramfuncs");
#pragma DATA_SECTION(Read_Buffer,"BufferDataSection");
//
// LED
//
#define BLINKY_LED_GPIO 31
//
// Globals
//
uint16_t data;
bool flag;
int Read_Buffer[64]={0};
//
// Function Prototype
//
void Example_Error(Fapi_StatusType status);
void Example_Done(void);
//
// Main
//
void main(void)
{
InitSysCtrl();
InitGpio(); // Skipped for this example
GPIO_SetupPinMux(BLINKY_LED_GPIO, GPIO_MUX_CPU1, 0);
GPIO_SetupPinOptions(BLINKY_LED_GPIO, GPIO_OUTPUT, GPIO_PUSHPULL);
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
//memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
initeeprom();
// Step 5. User specific code:
// Copy the Flash API functions to SARAM
MemCopy(&Flash28_API_LoadStart, &Flash28_API_LoadEnd, &Flash28_API_RunStart);
SeizeFlashPump();
//
// Jump to RAM and call the Flash API functions
//
int j=0;
// EEPROM_GetSinglePointer(1);
data = 1;
RESET_BANK_POINTER; // Reset Bank Pointer to enable search for current Bank
RESET_PAGE_POINTER; // Reset Page Pointer to enable search for current Page
// EEPROM_ProgramSingleByte(data);
flag=1;
while(1)
{
if(flag==1&& (*Bank_Pointer)==0xFFFF) // after power up set flag=1
{
EEPROM_Write(7);
for(j=0;j<10;j++);
}
if(flag==1)
{
Read_Buffer[0]=EEPROM_Read(); // reading flash
flag=0;
ReleaseFlashPump();
}
if(Read_Buffer[0]==7)
{
GPIO_WritePin(BLINKY_LED_GPIO, 0);
DELAY_US(1000*500);
GPIO_WritePin(BLINKY_LED_GPIO, 1);
DELAY_US(1000*500);
}
}
}
//
// Example_Done - For this example, once we are done just stop here
//
#pragma CODE_SECTION(Example_Done,ramFuncSection);
void Example_Done(void)
{
__asm(" ESTOP0");
}
//
// End of file
//
COMMAND file Has Flash as boot mode:
MEMORY
{
PAGE 0: /* Program Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
/* Locally shared memory -- can be used by the local CPU and its CLA */
/* BEGIN is used for the "boot to SARAM" bootloader mode */
BEGIN : origin = 0x080000, length = 0x000002
RAMM0 : origin = 0x000080, length = 0x000380
RAMD0 : origin = 0x00B000, length = 0x000800
RAMLS03 : origin = 0x008000, length = 0x002000
/* RAMLS1 : origin = 0x008800, length = 0x000800
RAMLS2 : origin = 0x009000, length = 0x000800
RAMLS3 : origin = 0x009800, length = 0x000800 */
RAMLS4 : origin = 0x00A000, length = 0x000800
RAMGS14 : origin = 0x01A000, length = 0x001000 /* Only Available on F28379D/_, F28377D/F28377S, F28375D/F28375S devices. Remove line on other devices. */
RAMGS15 : origin = 0x01B000, length = 0x000FF8 /* Only Available on F28379D/_, F28377D/F28377S, F28375D/F28375S devices. Remove line on other devices. */
// RAMGS15_RSVD : origin = 0x01BFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
RESET : origin = 0x3FFFC0, length = 0x000002
/* Flash sectors */
FLASHA : origin = 0x080002, length = 0x001FFE /* on-chip Flash */
FLASHB : origin = 0x082000, length = 0x002000 /* on-chip Flash */
FLASHC : origin = 0x084000, length = 0x002000 /* on-chip Flash */
FLASHD : origin = 0x086000, length = 0x002000 /* on-chip Flash */
FLASHE : origin = 0x088000, length = 0x008000 /* on-chip Flash */
FLASHF : origin = 0x090000, length = 0x008000 /* on-chip Flash */
FLASHG : origin = 0x098000, length = 0x008000 /* on-chip Flash */
FLASHH : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
FLASHI : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
FLASHJ : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
FLASHK : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
FLASHL : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
FLASHM : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
FLASHN : origin = 0x0BE000, length = 0x001FF0 /* on-chip Flash */
// FLASHN_RSVD : origin = 0x0BFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
PAGE 1 :
BOOT_RSVD : origin = 0x000002, length = 0x00007E /* Part of M0, BOOT rom will use this for stack */
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
RAMD1 : origin = 0x00B800, length = 0x000800
RAMLS5 : origin = 0x00A800, length = 0x000800
RAMGS0 : origin = 0x00C000, length = 0x001000
RAMGS1 : origin = 0x00D000, length = 0x001000
CPU2TOCPU1RAM : origin = 0x03F800, length = 0x000400
CPU1TOCPU2RAM : origin = 0x03FC00, length = 0x000400
}
SECTIONS
{
/* Allocate program areas: */
.cinit : > FLASHD PAGE = 0
.pinit : > FLASHD, PAGE = 0
.text : >> FLASHD | FLASHE PAGE = 0
codestart : > BEGIN PAGE = 0
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
GROUP
{
.TI.ramfunc
{
-l F021_API_F2837xD_FPU32.lib}
}
LOAD = FLASHD,
RUN = RAMLS03,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0
Flash28_API:
LOAD = FLASHD,
RUN = RAMLS03,
LOAD_START(_Flash28_API_LoadStart),
LOAD_END(_Flash28_API_LoadEnd),
RUN_START(_Flash28_API_RunStart),
PAGE = 0
#else
GROUP
{
ramfuncs
{ -l F021_API_F2837xD_FPU32.lib}
} LOAD = FLASHD,
RUN = RAMLS03,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
RUN_SIZE(_RamfuncsRunSize),
RUN_END(_RamfuncsRunEnd),
PAGE = 0
Flash28_API:
LOAD = FLASHD,
RUN = RAMLS03,
LOAD_START(_Flash28_API_LoadStart),
LOAD_END(_Flash28_API_LoadEnd),
RUN_START(_Flash28_API_RunStart),
PAGE = 0
#endif
#endif
/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.ebss : > RAMLS5 PAGE = 1
.esysmem : > RAMLS5 PAGE = 1
/* Initalized sections go in Flash */
.econst : >> FLASHF | FLASHG PAGE = 0
.switch : > FLASHD PAGE = 0
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
SHARERAMGS0 : > RAMGS0, PAGE = 1
SHARERAMGS1 : > RAMGS1, PAGE = 1
/* Flash Programming Buffer */
BufferDataSection : > RAMD1, PAGE = 1, ALIGN(8)
/* The following section definitions are required when using the IPC API Drivers */
GROUP : > CPU2TOCPU1RAM, PAGE = 1
{
PUTBUFFER
PUTWRITEIDX
GETREADIDX
}
GROUP : > CPU1TOCPU2RAM, PAGE = 1
{
GETBUFFER : TYPE = DSECT
GETWRITEIDX : TYPE = DSECT
PUTREADIDX : TYPE = DSECT
}
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/
Done the steps to work standalone:
Disabled the watchdog timer in .asm file
Added code_start as entry point in symbol management
Help me to find the solution , why code doesnt works on reset/ power off/ run modes and all...
After RESET/power cycle/Run-->Load blue LED on Launchpad glows always.
Thanks ®ards,
Rani
































