-
Notifications
You must be signed in to change notification settings - Fork 3k
add ncs36510 fib and trim generation #6657
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
@theotherjimmy we are still awaiting your review on this PR, could you please do so asap. Thanks |
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 is a bit unusual, but it works for me
@tsailer Would it be significantly more difficult to make the same changes to the post-build script? Would it be worth it? |
@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... |
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 |
/morph build |
Build : SUCCESSBuild number : 1901 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1548 |
Test : SUCCESSBuild number : 1719 |
# 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']: |
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.
Just noting that this line looks interesting.
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