Dear all,
i'm writing flashing routines for TMS570LS10206. I included pf035a_api_eabi_vfp.lib and the headers succesfully. I get correct answer from return Fapi_getApiVersion32() but all the functions that interact with flash module doesn't return. I checked the Program Counter and I found it in a correct state, I checked Flash Module register and I enabled all banks and sectors, I'm still in privileged mode and all typedef are taken from original flash470.h.
Here's my code:
#define PLATFORM
#include ".\inc\f035.h"
#include ".\inc\flash470.h"
#include ".\inc\main.h"
#pragma INTERRUPT(_c_int00, RESET)
#pragma CODE_SECTION (main , ".main" )
int main(void);
void _c_int00()
{
main();
}
// Definitions for System Module registers used to affect HCLK/
#define PLLCTL1 (*(volatile unsigned int *) 0xffffff70)
#define PLLCTL2 (*(volatile unsigned int *) 0xffffff74)
#define GHVSRC (*(volatile unsigned int *) 0xffffff48)
#define CSVSTAT (*(volatile unsigned int *) 0xffffff54)
#define CLKCNTROL (*(volatile unsigned int *) 0xffffffd0)
#define SYSPC1 (*(volatile unsigned int *) 0xFFFFFF00)
#define ECPCNTL (*(volatile unsigned int *) 0xFFFFFFD4)
// Definitions for Flash Module
#define F035_FBPROT (*(volatile unsigned int *) 0xFFF87030)
#define F035_FMAC (*(volatile unsigned int *) 0xFFF87050)
#define F035_FBSE (*(volatile unsigned int *) 0xFFF87034)
#define F035_FRDCNTL (*(volatile unsigned int *) 0xFFF87000)
int main(void)
{
unsigned long instr_code;
unsigned long start_addr;
unsigned long size;
unsigned long data32_par;
unsigned short chksum;
unsigned short i;
unsigned long ret_val;
unsigned char *ptr_data;
UINT32 len = 0x10; //debug
UINT32 buff[128]; //debug
// Flash Protection settings
F035_FRDCNTL = 0x0;
F035_FBPROT = 0x1; // Disable protection
F035_FMAC = 0x0; // Select bank 0
F035_FBSE = 0x000003FF; // Enable flash operations on all sectors of bank 0
// DEBUG: DO THE SAME FOR FLASH 1
// Clock settings
// GHVSRC = 0x01010001; // Select PLL as clock source for HCLK and VCLK
SYSPC1 = 1; // Enable ECPCLK
// CLKCNTROL = 0x0; // SET VCLK2=VCLK=HCLK
CLKCNTROL = 0x00000100; // SET VCLK2=VCLK=HCLK/2
GHVSRC = 0; // Oscillator is the clock source for everything
ECPCNTL = 0x00800009; // Enable ECLK continue on suspend
// ECLK = VCLK/10
PSPWRDWNCLR0 = 0xFFFFFFFF; // Powers up clock to all peripherals
PSPWRDWNCLR1 = 0xFFFFFFFF;
PSPWRDWNCLR2 = 0xFFFFFFFF;
PSPWRDWNCLR3 = 0xFFFFFFFF;
for(;;)
{
Read(ptr_data, (unsigned char*)(&instr_code), WORD, NULL_PTR, NULL_PTR, NULL_PTR);
if(instr_code == MASS_ERASE_FLASH_INSTR_CODE)
{ Flash_Read_V((UINT32*)0x0, buff, len, 0, FLASH_CORE0, (FLASH_ARRAY_ST)0xfff87000); // <--- STUCK!
Write(ptr_data, (unsigned char*)&ret_val, WORD, CLOSE);
}
}
Here's my compiler options:
-mv7R4 --code_state=32 --float_support=VFPv3D16 --abi=eabi -O0 --opt_for_speed=0 -g --include_path="C:/ti/ccsv5/tools/compiler/tms470/include" --diag_warning=225 --display_error_number --enum_type=packed --asm_listing
Moreover, on TMS570 TRM i found that writing '111' on FMAC register allows user to read #banks - 1. According to device specifications I should have 2 banks, so I should read a value of '0x1', I read instead a value of '0x3'.
Thanks a lot, best regards,
Samuele Stefanoni