Skip to content

Enable boot-loader builds #3733

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
Feb 23, 2017
Merged

Conversation

theotherjimmy
Copy link
Contributor

To enable a boot-loader style application, overrides
"targets.bootloader_exec" or "targets.restrict_size" on a particular
target. These parameters are a bin or hex file and an integer, in bytes,
respectively. If either override is present, then an application region
is created after the boot-loader region, when "targets.bootloader_exec"
is present, and before post-application, when "targets.restric_size" is
present. The size of the boot-loader region is read from the file
provided in the configuration.

Status

READY

Todos

  • Tests - standard stuff

@theotherjimmy
Copy link
Contributor Author

/morph test

@theotherjimmy theotherjimmy force-pushed the feature-bootloader branch 8 times, most recently from 2887a7d to 956d9b9 Compare February 9, 2017 21:26
@mbed-bot
Copy link

mbed-bot commented Feb 9, 2017

Result: FAILURE

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

/morph test

Output

mbed Build Number: 1550

Test Prep failed!

@theotherjimmy
Copy link
Contributor Author

test prep failed !? :/

ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

Looks like my rebasing killed it.

/morph test

part = IntelHex()
_, inteltype = splitext(region.filename)
part.fromfile(region.filename, inteltype[1:])
if part.maxaddr() > region.size:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be ">=" rather than ">"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

pad_size = region.size - (part.maxaddr() + 1)
if pad_size > 0 and region != region_list[-1]:
print(" Padding region %s with %d bytes" % (region.name, pad_size))
merged.puts(region.start + part.maxaddr(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this going to clobber the last byte of region?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. The size should be calculated correctly as pad_size above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, yes.


if not exists(dirname(destination)):
makedirs(dirname(destination))
print("Space used after regions merged: %d" % merged.maxaddr())
Copy link
Contributor

Choose a reason for hiding this comment

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

Should one be added here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

tools/config.py Outdated
_, inteltype = splitext(filename)
ih = IntelHex()
ih.fromfile(filename, format=inteltype[1:])
if ih.minaddr() != 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized that the STMF429 has flash starting at address 0x08000000 so non-zero flash address support will be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. Thanks.

@mbed-bot
Copy link

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1552

All builds and test passed!

@theotherjimmy
Copy link
Contributor Author

Just rebased to address @c1728p9's comments. It's good to run testing again.

/morph test

tools/config.py Outdated
_, inteltype = splitext(filename)
ih = IntelHex()
ih.fromfile(filename, format=inteltype[1:])
if ih.minaddr() != 0 and ih.minaddr() != rom_start:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this still checked against address 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the case of .bin files, there is no specified start address, so it defaults to zero.

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

@theotherjimmy theotherjimmy force-pushed the feature-bootloader branch 4 times, most recently from 0033855 to 3025fd3 Compare February 10, 2017 19:42
@theotherjimmy
Copy link
Contributor Author

Rebased master so that travis will pass.

/morph test


if not exists(dirname(destination)):
makedirs(dirname(destination))
print("Space used after regions merged: 0x%x" % (merged.maxaddr() + 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is printing the max address rather than size

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is.

(region.name.upper() + "_SIZE", region.size)]:
profile["common"].append("-D%s=0x%x" % define)
active_region = [r for r in regions if r.active][0]
for define in [("MBED_APP_OFFSET", active_region.start),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is an absolute address it might make more sense as "MBED_APP_START"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right.

tools/config.py Outdated
part = intelhex_offset(filename, offset=rom_start)
if part.minaddr() != rom_start:
raise ConfigException("bootloader executable does not "
"start at 0")
Copy link
Contributor

Choose a reason for hiding this comment

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

This message should be updated to use the new address

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it should.

tools/utils.py Outdated
if inteltype == ".bin":
ih.loadbin(filename, offset=offset)
elif inteltype == ".hex":
ih.loadhex(filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

Might want to raise an exception here indicating that the filetype is unsupported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It now does that.

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 1560

Test Prep failed!

@theotherjimmy
Copy link
Contributor Author

looks like another rebase killed the bot.

/morph test

@mbed-bot
Copy link

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1561

All builds and test passed!

@theotherjimmy
Copy link
Contributor Author

/morph test

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.

Can you add a second commit that adds a flag bootload-supportto the target class which represents that the linker scripts have been modified to support multiple execution regions in a flat memory space

bootloader_exec can this be binary or hex or both? If only one maybe bootloader_bin or bootloader_hex otherwise just bootloader_img if can handle both

@mbed-bot
Copy link

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1628

All builds and test passed!

@bridadan
Copy link
Contributor

retest uvisor

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 20, 2017

@theotherjimmy Can you please review the @sg- comment above?

@theotherjimmy
Copy link
Contributor Author

@sg- This has been updated to reflect your comment.

@theotherjimmy
Copy link
Contributor Author

theotherjimmy commented Feb 21, 2017

@sg- What do you want from the bootloader_support flag? are you expecting it to be a flag it targets.json? Would it be top level or part of device_has?

To enable a boot-loader style application, override
"targets.bootloader_exec" or "targets.restrict_size" on a particular
target. These parameters are a bin or hex file, and an integer, in bytes,
respectively. If either override is present, then an application region
is created after the boot-loader region, when "targets.bootloader_exec"
is present, and before post-application, when "targets.restric_size" is
present. The size of the boot-loader region is read from the file
provided in the configuration.
This patch will prevent building bootloader builds on targets that have
not yet had their linker scripts/scatter files changed to allow for the
ROM space shrinking expected by bootloader builds. At the point of this
patch, bootloader linker script modifications are only supported by the
NUCLEO_F429ZI, K64F, KL46Z, and Odin.
@theotherjimmy
Copy link
Contributor Author

Lolwut? did not mean to do that. Might have been a stray return

/morph test

@sg- sg- added needs: CI and removed needs: work labels Feb 23, 2017
@mbed-bot
Copy link

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1683

All builds and test passed!

@sg- sg- merged commit ba21763 into ARMmbed:master Feb 23, 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.

6 participants