Jun 16, 2020
01:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 16, 2020
01:03 AM
Hi
I have two different Programms in Program memory. One begins with the adress 0x8000000 and other one begins with the adress 0xA0080000.
the execution of the code begins with the adress 0x8000000 and the first program runs correctly.
After that i try to jump with a function pointer to the adress 0xA008000 to run the second program. But as expected the program has crashed.
the code seems like that:
void *ptr = (void *)0xA0080000;
goto *ptr;
(assemble code does the same)
Are there any idea how can solve this problem?
I have two different Programms in Program memory. One begins with the adress 0x8000000 and other one begins with the adress 0xA0080000.
the execution of the code begins with the adress 0x8000000 and the first program runs correctly.
After that i try to jump with a function pointer to the adress 0xA008000 to run the second program. But as expected the program has crashed.
the code seems like that:
void *ptr = (void *)0xA0080000;
goto *ptr;
(assemble code does the same)
Are there any idea how can solve this problem?
- Tags:
- IFX
8 Replies
Jun 16, 2020
01:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 16, 2020
01:56 AM
Segment 8 and A are the same memory - segment 8 is cached, segment A is non-cached. You have located both programs within PFlash0 (are we talking about Aurix2G here, or another family?).
My first question would be how large is your program image? As these programs are in the same memory, could one be over-writing part of the other?
Depending on what device you are on, you could try locating the second program higher in flash, making it less likely to be overwritten by the first.
My first question would be how large is your program image? As these programs are in the same memory, could one be over-writing part of the other?
Depending on what device you are on, you could try locating the second program higher in flash, making it less likely to be overwritten by the first.
Jun 16, 2020
02:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 16, 2020
02:56 AM
TC3x7 is my hardware...
The placement is done with the LDF Model Editor from Hightec and there is no overwriting issue, because the the Model Editor makes the check for you.
With presence of the both code in memory(ROM ) you can run the program individually without a problem.
The Problem occurs when i try to make a switch from runnng Program to another.
The placement is done with the LDF Model Editor from Hightec and there is no overwriting issue, because the the Model Editor makes the check for you.
With presence of the both code in memory(ROM ) you can run the program individually without a problem.
The Problem occurs when i try to make a switch from runnng Program to another.
Jun 16, 2020
06:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 16, 2020
06:45 AM
ok 🙂 The addresses are both in PFlash0 rather than ROM.
When you say the program crashed, how did it crash? Was there are trap from the processor, if so, what one?
When you say the program crashed, how did it crash? Was there are trap from the processor, if so, what one?
Jun 17, 2020
01:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 17, 2020
01:23 AM
can you tell me how can i read trap messages?
Jun 17, 2020
04:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 17, 2020
04:47 AM
Please have a look to the iLLD example in the files IfxCpu_Trap.h and IfxCpu_Trap.c. It would be easiest to have code in the trap table to get the information.
Example for a bus error (class 4)
/** \brief Structure to contain the trap information. **/
typedef struct
{
unsigned int tAddr;
unsigned int tId : 8;
unsigned int tClass : 8;
unsigned int tCpu : 3;
} IfxCpu_Trap;
IFX_INLINE IfxCpu_Trap IfxCpu_Trap_extractTrapInfo(uint8 trapClass, uint32 tin)
{
IfxCpu_Trap trapInfo;
trapInfo.tAddr = (unsigned int)__getA11();
trapInfo.tClass = trapClass;
trapInfo.tId = tin;
trapInfo.tCpu = IfxCpu_getCoreId();
return trapInfo;
}
Example for a bus error (class 4)
void IfxCpu_Trap_busError(uint32 tin){
volatile IfxCpu_Trap trapWatch;
trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin);
IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch);
IFX_CFG_CPU_TRAP_DEBUG;
__asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */
__asm("rfe");
}
Jun 17, 2020
07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 17, 2020
07:25 AM
So the trap does not deliver any messages. But i tried to jump to the address program address back. What i mean is that the first program adress strarts from 0x8000 0000 . I tried to jump again to the adress 0x8000 0000.
The code is running but stays alwas in a while loop. It should behave like software reset ...Am i wrong?
the part for the jump function is below:
////////
void *ptr = (void *)0x80000000;
/////////////
if(test ==1 ){
test = 0;
unlock_wdtcon();
SYSTEM_DisableInterrupts();
goto *ptr;
}
To summarize, i tri to make a jump function, which jumps to another adress where anohter program is in presence and the this program should then run ...
i l be appreciated for any further helps....
the code can be found in the example code of hightec
LCDDemo_ApplicationKitTC387A-Step
The code is running but stays alwas in a while loop. It should behave like software reset ...Am i wrong?
the part for the jump function is below:
////////
void *ptr = (void *)0x80000000;
/////////////
if(test ==1 ){
test = 0;
unlock_wdtcon();
SYSTEM_DisableInterrupts();
goto *ptr;
}
To summarize, i tri to make a jump function, which jumps to another adress where anohter program is in presence and the this program should then run ...
i l be appreciated for any further helps....
the code can be found in the example code of hightec
LCDDemo_ApplicationKitTC387A-Step
Jun 17, 2020
07:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 17, 2020
07:06 PM
You are not providing enough information to know what the problem could be that you are experiencing (at least for me)?
Here is a bifaces code snippet for the TC38x A-Step device. One case is to jump to address 0x80000000 and the other is to perform a software reset. Both work on my TriBoard.
Here is a bifaces code snippet for the TC38x A-Step device. One case is to jump to address 0x80000000 and the other is to perform a software reset. Both work on my TriBoard.
void (*ptr)(void);
volatile uint32 test;
volatile uint32 cnt;
IFX_ALIGN(4) IfxCpu_syncEvent cpuSyncEvent= 0;
void core0_main (void)
{
ptr = (void (*)(void))0x80000000;
IfxCpu_enableInterrupts();
/*
* !!WATCHDOG0 AND SAFETY WATCHDOG ARE DISABLED HERE!!
* Enable the watchdog in the demo if it is required and also service the watchdog periodically
* */
IfxScuWdt_disableCpuWatchdog (IfxScuWdt_getCpuWatchdogPassword ());
IfxScuWdt_disableSafetyWatchdog (IfxScuWdt_getSafetyWatchdogPassword ());
/* Cpu sync event wait*/
IfxCpu_emitEvent(&cpuSyncEvent);
IfxCpu_waitEvent(&cpuSyncEvent, 1);
while (1)
{
/* jump to address pointed to by ptr */
if(1==test)
{
test = 0;
ptr();
}
/* perform a Software reset */
if(2==test)
{
test = 0;
IfxScuWdt_clearCpuEndinit(IfxScuWdt_getCpuWatchdogPassword ());
SCU_SWRSTCON.B.SWRSTREQ = 1;
IfxScuWdt_setCpuEndinit(IfxScuWdt_getCpuWatchdogPassword ());
}
cnt++;
}
}
Jun 21, 2020
11:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2020
11:04 PM
Hi Again
After i changed the location of Program through linker script, the program was able to run. I located the program through LDF Editor. I saw also differents in .hex of Program in two cases.
And through replacement the code through LDF Editor and run directly; the code is working; but if you jump to this code from a running code, then the program is crashing.
But now i have another Problem, but i will do open new Thread for those.
Thank you all for your helps.
After i changed the location of Program through linker script, the program was able to run. I located the program through LDF Editor. I saw also differents in .hex of Program in two cases.
And through replacement the code through LDF Editor and run directly; the code is working; but if you jump to this code from a running code, then the program is crashing.
But now i have another Problem, but i will do open new Thread for those.
Thank you all for your helps.