Hi PE Group,
I moved this from the DSC Community to the PE Community to see if someone here my have a better idea on how to fix this PE Driver problem or work around it better.
I made a Support Request and they put in a Ticket to PE Dev Team to maybe fix it some day. Not sure how long that might take. I added the info from the support request to the end of the exchange.
I am using a 56F82746 and set up the flash driver IntFLASH from the Components Library and having problems with the required running mode.
It needs to be set for the 'Wait In RAM' mode since the device only has one Flash area.
The problem is that when it calculates the location for the Wait In RAM code it uses the pRAM word start address but then the offset is calculated as a Byte offset which puts it in the wrong location, beyond memory and processor restarts at beginning.
I can see what is happening but cannot see how it is happening or why.
Let me know if there is a setting I am missing or if this is a bug in the driver.
Here is some information and I also attached a test project that it relates to. Just Added Attachment, 9/26/2017.
Fig 1. Driver is set to Wait In RAM. Also shows simple program being run to test it.
Fig 2. Heap size is set to a small value to show problem but code still works. Stack ends at 0xF838 in pRAM.
Fig 3. Heap size is small but "Safe Routine" is beyond the Stack, 0xF8D2 vs 0xF838. Code still runs since it is in RAM yet.
Fig 4. Heap size set to a large value to show problem and code fails. Stack ends at 0xFC38 in pRAM.
Fig 5. Heap size is larger and "Safe Routine" is beyond the Memory, 0x100D2 vs 0xFFFF for end of memory vs 0xFC38 for end of stack. Code fails and restarts at beginning.
Original Attachment has been moved to: Test82746FlashSave.zip
Just wanted to update anyone that is interested that I made a workaround for this issue a while back that I have not had problems with.
Change the code as shown below in IntFlashLdd1.c (or whatever your driver IntFlashLdd... is named).
static void SafeRoutineCaller(void)
SafeRoutineInDataPtr = (LDD_FLASH_TSafeRoutinePtr)&SaveRoutineStackSpace;
//NOTE: Fix for Bad Flash Driver - Divide by 2 to get word address so does not get put past stack/RAM, pjb014.
SafeRoutineInDataPtr = (LDD_FLASH_TSafeRoutinePtr)((UInt16)((LDD_FLASH_TSafeRoutinePtr)(&SaveRoutineStackSpace)) / 2);
After making the change just do a "Build Project" not a "Build All" or the code change will be overwritten..
"Don't Write" does not seem to work right, it still rewrites the driver file. - - After building it, set the Flash Bean to not generate code to keep the changes.
Anyone know how to keep the bean from rewriting a driver file?
It seems taht the address is okay. i have tried to use the TWR-8200 board, the variable is written to the correct location.
Hope it can help you
Hi Xiangjun Rong,
- Thanks for doing some testing but as I outlined in Fig 2 and Fig 3 it does work to program the flash location but the location of the Safe 'Wait in RAM' function is still beyond the Stack area where it is supposed to be copied to.
- Fig 4 and Fig 5 show that when the Heap is increased in size (to simulate my larger .bss area) then it does not work since the Safe 'Wait in RAM' function is trying to be copied beyond the RAM area.
- Please try changing the Heap size to 600 as in Fig 4 and running it. I am sure it will not work. If it does you may have to bump up the Heap a little.
- When if fails you can see what is happening by placing a breakpoint at the locaiton shown in the following code snippet and then check the location of either SafeRoutineInDataPtr for an xRAM location beyond 0x0FFF or SafeRoutineInCodePtr for a pRAM location beyond 0xFFFF.
File is: IntFlashLdd1.c
static void SafeRoutineCaller(void)
SafeRoutineInCodePtr(); /* Run the Safe routine */ PLACE BREAKPOINT HERE
Here is the info from the Service Request.
Dear Peter Becher,
Thank you for the bug report, I will report it to PE team and suggest they pop up a warning or error message when the 'Wait in RAM' function is written beyond the end of RAM.
Please do not suggest that they have a pop up warning!
That is not good enough.
Have them fix the bug so I can use the driver.
There is enough information in my posts to let them know what the problem is and fix it.
Please let me know when I can expect a bug fix.
I am sorry, what I can do is to report bug to PE team, it is upon PE team to fix the bug, launch new release. Because of lack of resource, we can not guarantee when we can fix it.
I hope you can understand.