Skip to content

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

Merged
merged 6 commits into from
Feb 22, 2017
Merged

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Feb 19, 2017

Bring all the changes made on the feature-flash-api branch main-line.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Feb 19, 2017

/morph test-nightly

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1652

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 20, 2017

retest uvisor

@c1728p9
Copy link
Contributor Author

c1728p9 commented Feb 20, 2017

Fixed the commit author

@c1728p9
Copy link
Contributor Author

c1728p9 commented Feb 20, 2017

/morph test-nightly

1 similar comment
@bridadan
Copy link
Contributor

/morph test-nightly

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1659

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 21, 2017

Thanks Russ !

Jenkins restarted

Please review

@0xc0170 0xc0170 removed the needs: CI label Feb 21, 2017
Copy link
Contributor

@adbridge adbridge left a 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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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;
Copy link
Contributor

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.

  1. because it doesn't actually work properly
  2. if a case fails then the overall test fails and should be reported as such (as per Marcus' recommendations)

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) ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (! is_aligned(..) )

Copy link
Contributor

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) )

break;
}
current_sector_size = flash_get_sector_size(&_flash, addr);
if (is_aligned_to_sector(addr, size) == false) {
Copy link
Contributor

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>
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the addr parameter

* @param number Number that should be aligned
* @param alignment Defined alignment for a number to be checked
* @return true on success, false on failure
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this header looks wrong


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;
Copy link
Contributor

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

Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No tools changes. ¯\_(ツ)_/¯

0xc0170 and others added 6 commits February 21, 2017 14:08
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.
@c1728p9
Copy link
Contributor Author

c1728p9 commented Feb 21, 2017

@adbridge I updated this PR to address your feedback

@c1728p9
Copy link
Contributor Author

c1728p9 commented Feb 21, 2017

/morph test-nightly

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1671

All builds and test passed!

Copy link
Contributor

@sg- sg- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@adbridge adbridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sg- sg- merged commit 355f69a into master Feb 22, 2017
@dadiliebian
Copy link

how to generate the flash_api.c ?

@0xc0170 0xc0170 deleted the feature-flash-api branch April 10, 2017 09:18
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 10, 2017

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants