-
Notifications
You must be signed in to change notification settings - Fork 3k
LPC1768 IAP Fix #4993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LPC1768 IAP Fix #4993
Conversation
GCC also passes.
|
*/ | ||
|
||
unsigned long GetSecNum (unsigned long address) { | ||
unsigned long n; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
on t he new line, please leave one line space between functions (line 70)
uint8_t *data; | ||
unsigned long n; | ||
|
||
if ((unsigned long)datain%4==0)//word boundary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.mbed.com/docs/mbed-os-handbook/en/latest/cont/code_style/
2 spaces instead of 4? Please read the above coding style and align this code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style alingment
Thanks for fixing the previous bug in the implementation ! |
@chrissnow bump |
Code tidied but I still have a warning to sort out
I also want to understand SET_VALID_CODE and what we want it to be set to. |
@0xc0170 This should now be complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you align if else code aligment , as shared previously to the mbed coding style please?
Apologies, I think that matches now. |
free(alignedData); | ||
} | ||
|
||
if (IAP.stat) return (1);// Command Failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
if (IAP.stat) {
return (1);
}
|
||
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address) | ||
{ | ||
if(address < flash_get_start_address(obj) || address >= flash_get_start_address(obj) +flash_get_size(obj)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (address.....)
(space after if)
* Return Value: Sector Number | ||
*/ | ||
|
||
unsigned long GetSecNum (unsigned long address) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
new line
I think I now have eclipse set up to format to mbed style. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will squash this as it comes as one fix (12 commits are mostly devel commits in here)
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@chrissnow we are looking at this again, seems like IAR fails from time to time for the flashiap test. Have you noticed any sporadic failures with program() ? |
@0xc0170 I'm wondering if malloc isn't always assigning an aligned location like I expected.
I didn't spend much time with IAR other than to get the test results a couple of times. I haven't had any issues with ARM with my project though. Do you know if its hard faulting? that's what will happen if it isn't aligned and I guess timeout the test. |
I've attached debugger, it's hard faulting, I am investigating where it writes and how to get into the hardfault. Or maybe not hardfault at al,, will provide an update |
I may have figured it out,
I think that needs to be 0x10007FE0 see
|
Looks correct that RAM end is not defined as it should, I am however also running test with this fix (RAM end should be 0x10007EF8). It fails sporadically. As it is, it gets to hardfault. With the fixed RAM end, debugging crashes under IAR (can't do anything just wait until I receive an error a target cant be stopped). Some logs
|
@chrissnow Besides that RAM end that I'll fix, it seems that systick is ongoing (hardfault points to systick handler causing undefinstr error). If I suspend kernel (not needed for the test), all is running OK. I've run it at least 10x so far , all OK with my own test case. Hints? I'll rebuild everything, clean, and retest changes for RAM end again, to be certain that does not fix. |
Having done a bit of reading I think IAP blocks flash access during operations, which isn't going to end well with interrupts. Perhaps disable interrupts during IAP operations? https://os.mbed.com/questions/54146/LPC824-RTOS-and-IAP/
|
And from the LPC1768 user manual
|
Run from new branch, all seems fine , sent a fix - #5189 |
@chrissnow Thanks, that is what I suspected. We shall add critical section then, lets take it to the fix, I can add one more |
Description
Reinstatates LPC1768 IAP by using HAL routines rather than CMSIS Algo.
Status
READY