Skip to content

Check in algo generation code #3996

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 2 commits into from
Mar 27, 2017
Merged

Check in algo generation code #3996

merged 2 commits into from
Mar 27, 2017

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Mar 22, 2017

Check in scripts which are able to generate flash algos for supported
targets.

To initially download all packs the following command should be run:

>> python extract.py --rebuild_all

After that all supported targets can be rebuilt by running:

>> python extracts.py

Finally, to rebuild an individual target you can used its pack name:

>> python extract.py --target STM32F302R8

@c1728p9 c1728p9 requested a review from theotherjimmy March 22, 2017 20:34
@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 22, 2017

CC: @0xc0170

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.

Looks good. Do we have a plan to get this regression tested some how?

@@ -0,0 +1,80 @@
#!/usr/bin/env python
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we name this file something that better matches what it does? like extract_flash_algos.py or just extract.py (it's in the flash_algo dir after all)

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe extract_all.py?

@@ -0,0 +1,359 @@
#!/usr/bin/env python
Copy link
Contributor

@theotherjimmy theotherjimmy Mar 22, 2017

Choose a reason for hiding this comment

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

This name is redundant. Should this be __init__.py instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed in person. Summary - long term this file should be moved into arm-pack-manager or another common repo. Right now the master copy lives in the FlashAlgo repository and this is a copy of it.

)

ro_rw_zi = _find_sections(self.elf, sections_to_find)
ro_rw_zi = _algo_fill_zi_if_missing(ro_rw_zi)
Copy link
Contributor

Choose a reason for hiding this comment

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

immediately re-assigning a variable can be confusing. maybe

ro_rw_zi = _algo_fill_zi_if_missing(_find_sections(self.elf, sections_to_find))

This?

@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 22, 2017

/morph test

@mbed-bot
Copy link

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1721

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 23, 2017

I tested this PR. I rebuilt all devices, and run:

python extract.py --target STM32F302R8
python extract.py --target NUCLEO_F401RE
python extract.py --target K64F

The last two failed with (same error):

tools\arm_pack_manager\__init__.py", line 263, in get_flash_algorthim_binary
    device = self.index[device_name]
KeyError: 'NUCLEO_F401RE'

As I understand, this script accepts the name that comes from the pack. I thought it would translate it targets.json target name to the cmsis pack name (as targets contain device_name), if there's none, its not supported. if there is, use that name to find it in the packs.

STM32F302R8 worked, but generates two files, whats the difference? I looked at both, the flash start address is different (some numbers differ), but I don't know which one I should use? two devices with various sectors.

 ls output\
STM32F302R8_0.c  STM32F302R8_1.c

Check in scripts which are able to generate flash algos for supported
targets.

To initially download all packs the following command should be run:
"python extract.py --rebuild_all"

After that all supported targets can be rebuilt by running:
"python extract.py"

Finally, to rebuild an individual target you can used its pack name:
"python extract.py --target STM32F302R8"
@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 23, 2017

The name of the pack target should be used with --target, not the name of the mbed device. The easy way to run this script is to run python extract.py which will build all supported mbed targets.

The multiple flash algos for the same target are for different regions. The flash_start and flash_size will be different for each of these. Typically one algo will be flash and the others will be regions for configurable settings.

To simplify this I updated the script to only create an algo for the flash region if it can determine this. I also added the option --all which will cause all flash algos for a device to be created like before.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 23, 2017

/morph test

@mbed-bot
Copy link

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1734

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 24, 2017

Thanks for the explanation. I pulled the latest update, works for me

LGTM

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 26, 2017

I fixed the template plus implementations - to protect with DEVICE_FLASH

/morph test

@c1728p9
Copy link
Contributor Author

c1728p9 commented Mar 26, 2017

Thanks for the update @0xc0170, the changes look good to me.

@mbed-bot
Copy link

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1744

All builds and test passed!

@sg- sg- merged commit cd7abc0 into ARMmbed:master Mar 27, 2017
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.

5 participants