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

add ncs36510 fib and trim generation #6657

Merged
merged 1 commit into from May 7, 2018

Conversation

Projects
None yet
6 participants
@tsailer
Contributor

tsailer commented Apr 17, 2018

Description

This pull request adds the NCS36510 specific bits to the codeblocks exporter.

NCS36510 needs a trim block and a fib block containing a CRC over the binary. In the mbed build system, the ELF object file is first linked, then converted to hex, and then a python function NCS36510TargetCode.ncs36510_addfib (in NCS36510TargetCode.ncs36510_addfib) adds the necessary trim and fib blocks to the hex file only.

For an IDE, this is confusing. One would have to start gdb with the ELF file, to get the symbol table, but then write the HEX file to the FLASH, because the ELF file wouldn't contain the fib and trim blocks.

So the codeblocks exporter strategy is somewhat different. If the target is NCS36510 (detected by the post_binary_hook), then two additional files ncs36510fib.c and ncs36510trim.c, created by the exporter, are linked to the ELF file. These two files put the necessary data (a dummy CRC only) into sections named .fib and .trim, the linker script puts them at the correct addresses. An external program then computes the proper CRC and updates it using a mechanism similar to objcopy --update-section. That way, the ELF file contains all information and no hex file is needed.

Pull request type

[ ] Fix
[X] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

@cmonr cmonr requested a review from theotherjimmy Apr 17, 2018

@cmonr cmonr added the needs: review label Apr 17, 2018

@adbridge

This comment has been minimized.

Contributor

adbridge commented Apr 30, 2018

@theotherjimmy we are still awaiting your review on this PR, could you please do so asap. Thanks

@theotherjimmy

This is a bit unusual, but it works for me

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Apr 30, 2018

@tsailer Would it be significantly more difficult to make the same changes to the post-build script? Would it be worth it?

@tsailer

This comment has been minimized.

Contributor

tsailer commented May 2, 2018

@theotherjimmy I thought about it, but then decided, because it would either mean another tool dependency (the ncs36510updatefib), or forking objdump/objcopy multiple times. Furthermore, as far as I see, the whole mbed infrastructure is geared very much at using the hex file and not the elf file, so I thought it wouldn't be worth it...

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented May 2, 2018

Thanks for the detailed explanation. We need to add the external tool dependency to https://github.com/ARMmbed/Handbook/blob/new_engine/docs/tools/toolchains/export_to_third_party.md

@0xc0170

This comment has been minimized.

Member

0xc0170 commented May 3, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented May 3, 2018

Build : SUCCESS

Build number : 1901
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6657/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@0xc0170 0xc0170 added needs: CI and removed needs: review labels May 3, 2018

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels May 4, 2018

# finally, generate the project file
super(CodeBlocks, self).generate()

@staticmethod
def clean(project_name):
for ext in ['cbp', 'depend', 'layout']:
remove("%s.%s" % (project_name, ext))
for f in ['openocd.log']:
for f in ['openocd.log', 'ncs36510fib.c', 'ncs36510trim.c']:

This comment has been minimized.

@cmonr

cmonr May 7, 2018

Contributor

Just noting that this line looks interesting.

@cmonr cmonr merged commit ab81b61 into ARMmbed:master May 7, 2018

12 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 8991 cycles (-559 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/littlefs Passed, code size is 10092B (+0.00%)
Details
travis-ci/tools Local tools testing has passed
Details

@cmonr cmonr removed the ready for merge label May 7, 2018

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