hello,
I am using the TMS570LS3137 HDK with CCS Version: 6.0.1.00040 and HALCoGen 04.01.00. I want to run a Dhrystone within the 8MB SDRAM of the HDK.
everything works fine: correct entries in map-file, SDRAM contains same code as ROM after copy.
Then when calling the function by function name the program runs into prefetchentry. Following the call sequence in disassembly window, the trampoline is called and jumps to prefetchEntry instead of my function.
My project is based on the "example_emif_sdram" given by HalCoGen
•EMIF timings, clock and pinmux are OK
•MPU is enabled for SDRAM region, type : STRONGLYORDERED_SHAREABLE | Permission : PRIV_RW_USER_RW_EXEC
•Dhrystone OK when running normally
The guilty ASM :
123 DMIPS = dhrystone();
$C$L3:
0000829c: EB000260 BL $Tramp$AA$L$PI$$dhrystone
000082a0: EE10CA10 VMOV R12, S0
000082a4: E58DC560 STR R12, [R13, #1376]
...
$Tramp$AA$L$PI$$dhrystone():
00008c24: E300C000 MOVW R12, #0
00008c28: E348C000 MOVT R12, #32768
00008c2c: E12FFF1C BX R12 --> branch to 0x8000 0000 (First SDRAM address)
and then... stuck on prefetchEntry
here is the concerned code :
Linker
MEMORY
{
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASH0 (RX) : origin=0x00000020 length=0x0017FFE0
FLASH1 (RX) : origin=0x00180000 length=0x00180000
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0003EB00
/* USER CODE BEGIN (2) */
SDRAM (RWX) : origin=0x80000000 length=0x02000000
/* USER CODE END */
}
/* USER CODE BEGIN (3) */
/* USER CODE END */
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
.intvecs : {} > VECTORS
.text : {} > FLASH0 | FLASH1
.const : {} > FLASH0 | FLASH1
.cinit : {} > FLASH0 | FLASH1
.pinit : {} > FLASH0 | FLASH1
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM
/* USER CODE BEGIN (4) */
.dhrystone_section : RUN = SDRAM, LOAD = FLASH0 | FLASH1
LOAD_START(DhrystoneLoadStart), LOAD_END(DhrystoneLoadEnd), LOAD_SIZE(DhrystoneSize),
RUN_START(DhrystoneStartAddr ), RUN_END(DhrystoneEndAddr )
/* USER CODE END */
}
sys_main.c
#include "sys_common.h"
/* USER CODE BEGIN (1) */
#include <string.h>
#include <stdio.h>
#include "system.h"
#include "sci.h"
#include "rti.h"
#include "emif.h"
#include "sys_core.h"
#include "user_log.h"
#include "dhry.h"
#include "sys_pmu.h"
#include "sys_mpu.h"
extern float dhrystone();
extern uint32 DhrystoneLoadStart;
extern uint32 DhrystoneLoadEnd;
extern uint32 DhrystoneSize;
extern uint32 DhrystoneStartAddr;
extern uint32 DhrystoneEndAddr;
void main(void)
{
int i;
float DMIPS;
uint32 size=(uint32)&DhrystoneSize;
_disable_interrupt_(); /* Firstly disable all pending interrupts */
_esmCcmErrorsClear_(); /* Clear pending CCM ESM errors */
sciInit();
emif_SDRAMInit(); /* Initializes the emif Driver for SDRAM */
_pmuInit_();
_pmuEnableCountersGlobal_();
_pmuSetCountEvent_(pmuCYCLE_COUNTER, PMU_CYCLE_COUNT); // PMU_INST_ARCH_EXECUTED
_enable_interrupt_();/* enable IRQ and FIQ */
for(i=0;i<size;i++)
{
((char *)&DhrystoneStartAddr)[i] =((char *)&DhrystoneLoadStart)[i];
}
i = 0;
while(1)
{
DMIPS = dhrystone();
printf("DHRYSTONE %3d : %5.2f DMIPS",i,DMIPS);
i++;
}
/* USER CODE END */
}
Dhrystone.c
#pragma CODE_SECTION(dhrystone, ".dhrystone_section")
float dhrystone()
{
...
return DMIPS;
}
hope you can help me find out why I'm stuck on this instruction
(I edited the original post for esthetic purpose)