-
Notifications
You must be signed in to change notification settings - Fork 3k
Merge the feature-flash-api branch into master #3802
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
Conversation
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
retest uvisor |
c5092e2
to
aa65aaf
Compare
Fixed the commit author |
/morph test-nightly |
1 similar comment
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Thanks Russ ! Jenkins restarted Please review |
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.
Does the copyright date need updating for the new files ?
hal/flash_api.h
Outdated
* @param obj The flash object | ||
* @param address The sector starting address | ||
* @param data The data buffer to be programmed | ||
* @param size The number of in bytes |
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.
The number of in bytes ? Something missing there ?
hal/flash_api.h
Outdated
|
||
/** Get start address for the flash region | ||
* | ||
* @param obj The flash objects |
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 object singular ?
hal/flash_api.h
Outdated
|
||
/** Get the flash region size | ||
* | ||
* @param obj The flash objects |
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.
object singular ?
@@ -0,0 +1,249 @@ | |||
/* mbed Microcontroller Library | |||
* Copyright (c) 2016 ARM Limited |
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.
2017 ?
|
||
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
greentea_case_failure_abort_handler(source, reason); | ||
return STATUS_CONTINUE; |
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.
STATUS_CONTINUE shouldn't really be used for the failure handler.
- because it doesn't actually work properly
- if a case fails then the overall test fails and should be reported as such (as per Marcus' recommendations)
drivers/FlashIAP.cpp
Outdated
bool FlashIAP::is_aligned_to_sector(uint32_t addr, uint32_t size) | ||
{ | ||
uint32_t current_sector_size = flash_get_sector_size(&_flash, addr); | ||
if ((is_aligned(size, current_sector_size) == false) || |
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 (! is_aligned(..) )
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.
In fact can't this whole statement be re-written as
return (is_aligned(size, current_sector_size) && (is_aligned(addr, current_sector_size) )
drivers/FlashIAP.cpp
Outdated
break; | ||
} | ||
current_sector_size = flash_get_sector_size(&_flash, addr); | ||
if (is_aligned_to_sector(addr, size) == false) { |
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.
again should use '!' operator rather than checking directly to false
* | ||
* Sector size might differ at address ranges. | ||
* An example <0-0x1000, sector size=1024; 0x10000-0x20000, size=2048> | ||
* |
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.
Missing the addr parameter
drivers/FlashIAP.h
Outdated
* @param number Number that should be aligned | ||
* @param alignment Defined alignment for a number to be checked | ||
* @return true on success, false on failure | ||
*/ |
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.
this header looks wrong
TESTS/mbed_drivers/flashiap/main.cpp
Outdated
|
||
utest::v1::status_t greentea_failure_handler(const Case *const source, const failure_t reason) { | ||
greentea_case_failure_abort_handler(source, reason); | ||
return STATUS_CONTINUE; |
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.
Same comment about STATUS_CONTINUE
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.
No tools changes. ¯\_(ツ)_/¯
Add a flash api with functions to erase and program. The api also includes functions to query flash start, flash size, page size and sector size.
Add tests to verify the hal port of the flash_api.
If target supports flash algo, it can get common HAL implementation, providing feature "HAL_FLASH_CMSIS_ALGO". This simplifies target code, and having one implementation that can be shared by many targets. Be careful with flash cmsis algo, in some cases they execute code that can affect the system. For instance, it can disable cache, or affect some system clocks. Therefore this feature should be well tested.
Flash IAP that provides erase/read/program to an internal API. It invokes flash HAL functions. FlashIAP checks for alignments for erase and program. HAL functions do not, to avoid duplication per target implementation.
It currently tests functionality provided by flash IAP API like read/program/erase and getters.
Check in flash algos for the K64F, KL46Z, F429, F439 and Odin board and enable these features accordingly in targets.json. This implementation uses flash algo blob that are generated via scripts. The K64F and KL46Z were generated directly from packs, while the KL46Z, F429, F439 and odin were generated from code checked into the FlashAlgo repo.
aa65aaf
to
0712354
Compare
@adbridge I updated this PR to address your feedback |
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
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.
👍
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.
LGTM
how to generate the flash_api.c ? |
Please create an issue (a question) here. I can quickly provide an answer here: Look at tools/flash_algo/extract.py script that extracts information from arm packs to generate flash blobs (your device should support the packs). |
Bring all the changes made on the feature-flash-api branch main-line.