Skip to content

Fix build tool with ARMC6/ARMv8M #6644

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 3 commits into from
Apr 27, 2018

Conversation

ccli8
Copy link
Contributor

@ccli8 ccli8 commented Apr 16, 2018

Description

This PR tries to fix build tool issues with ARMC6/ARMv8M:

  1. Add linking time preprocessor macro __DOMAIN_NS for non-secure build
  2. For output .hex format, combine multiple .hex files (for multiple load regions) into one. This can help for Greentea test.
  3. Fix None build_dir error with cmse_lib.o on Greentea test. None build_dir is passed to ARMC6 > __init__ and causes error from:
    mbed-os/tools/test_api.py:
     def find_tests(base_dir, target_name, toolchain_name, app_config=None):
     ......
         # Temporary structure: tests referenced by (name, base, group, case) tuple
         tests = {}
         # List of common folders: (predicate function, path) tuple
         commons = []
    
         # Prepare the toolchain
         toolchain = prepare_toolchain([base_dir], None, target_name,
     
    I move cmse_lib.o from ARMC6 > __init__ to ARM > link.

Pull request type

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

1. Add linking time preprocessor macro __DOMAIN_NS for non-secure build
2. For output .hex format, combine multiple .hex files (for multiple load regions) into one
   This can help for Greentea test.
3. Fix 'None' build_dir with cmse_lib.o on Greentea test
@@ -233,6 +233,11 @@ def link(self, output, objects, libraries, lib_dirs, scatter_file):
cmd_pre = self.ld + args
cmd = self.hook.get_cmdline_linker(cmd_pre)

# Create Secure library
if self.target.core == "Cortex-M23" or self.target.core == "Cortex-M33":
Copy link
Contributor

Choose a reason for hiding this comment

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

Moving this here breaks exporters: The exporters have to know to append these options somehow, and this location prevents them from being able to.

@@ -252,7 +257,8 @@ def archive(self, objects, lib_path):
@hook_tool
def binary(self, resources, elf, bin):
_, fmt = splitext(bin)
bin_arg = {".bin": "--bin", ".hex": "--i32"}[fmt]
# On .hex format, combine multiple .hex files (for multiple load regions) into one
bin_arg = {".bin": "--bin", ".hex": "--i32combined"}[fmt]
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch. This was always the indented behavior. I guess nobody combined multiple load regions with hex output before.

@theotherjimmy
Copy link
Contributor

@ccli8 I'm familiar with the interaction between the toolchains and the exporters and the toolchains and the test builder. Let me know if you would like me to correct the "no build dir" bug.

@ccli8
Copy link
Contributor Author

ccli8 commented Apr 17, 2018

@theotherjimmy Yes. Please correct the "no build dir" bug and I can check Grrentea flow on NUMAKER_PFM_M2351 with the corrected version. NUMAKER_PFM_M2351 is Cortex-M23 based and its port is on-going.

@theotherjimmy theotherjimmy force-pushed the nuvoton_fix_armc6_armv8m branch 5 times, most recently from 4d1e335 to 5e83ae9 Compare April 17, 2018 17:01
@theotherjimmy theotherjimmy force-pushed the nuvoton_fix_armc6_armv8m branch 2 times, most recently from fef7297 to bc8b983 Compare April 17, 2018 17:02
theotherjimmy
theotherjimmy previously approved these changes Apr 17, 2018
@theotherjimmy
Copy link
Contributor

@ccli8 I changed the implementation on your branch. Good news: it reduced the diff by quite a bit.

Copy link

@deepikabhavnani deepikabhavnani 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 to me 👍

@ccli8
Copy link
Contributor Author

ccli8 commented Apr 18, 2018

@theotherjimmy With your update, I run Greentea test on NUMAKER_PFM_M2351 with ARMC6 and it works.

0xc0170
0xc0170 previously approved these changes Apr 18, 2018
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 18, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Apr 18, 2018

Build : SUCCESS

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

Triggering tests

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

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 18, 2018

/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Apr 18, 2018

@mbed-ci
Copy link

mbed-ci commented Apr 18, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 19, 2018

/morph test
/morph uvisor-test

@mbed-ci
Copy link

mbed-ci commented Apr 19, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 19, 2018

@kegilbert @theotherjimmy Can you review the logs from the test failures?

I could find 02:46:31 mbedgt: no platform/target matching tests were found! , but why does it fail? Is it related to this change? No tests run.

@cmonr
Copy link
Contributor

cmonr commented Apr 23, 2018

Did some link hopping,

  1. http://mbed-ci-master-2.austin.arm.com:8081/job/test_matrix_raas/1602/target=K64F,toolchain=GCC_ARM/console

  2. http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6644/PASS/K64F/GCC_ARM

  3. http://mbed-os.s3-eu-west-1.amazonaws.com/builds/6644/PASS/K64F/GCC_ARM/bc8b98358d5ee1e5c986d263ed8874fa5a1e2aa4_example_build_log_K64F_GCC_ARM.txt

  4. http://mbed-os.s3-eu-west-1.amazonaws.com/builds/6644/PASS/K64F/GCC_ARM/bc8b98358d5ee1e5c986d263ed8874fa5a1e2aa4_build_log_K64F_GCC_ARM.txt

and noticed a couple of things:

  • The build log (3) has it's mem table filled out, whereas compilation for the test (4) looks like this:
Memory map breakdown for built projects (values in Bytes):
+------+--------+-----------+------------+-------------+
| name | target | toolchain | static_ram | total_flash |
+------+--------+-----------+------------+-------------+
+------+--------+-----------+------------+-------------+
  • This is the command used to compile the test:
mbed test --compile -m K64F -t GCC_ARM -DMBED_HEAP_STATS_ENABLED=1 -DMBED_STACK_STATS_ENABLED=1 -DMBED_TRAP_ERRORS_ENABLED=1 -DMBED_TEST_BLOCKDEVICE=SPIFBlockDevice -DMBED_TEST_BLOCKDEVICE_DECL=SPIFBlockDevice bd(D11,D12,D13,D10)

MBED_TEST_BLOCKDEVICE_DECL should not have a space...

@ccli8
Copy link
Contributor Author

ccli8 commented Apr 24, 2018

@theotherjimmy I find something wrong with the commit bc8b983. Test items are not listed with the command:

mbed test -m NUMAKER_PFM_NUC472 -t ARM --compile-list

If I roll back, it is OK.

Scan resources ignores the build dir so we can't set it to something
dumb like the directory we want to scan
@theotherjimmy
Copy link
Contributor

Crap. I forgot that the resource scan ignores the assigned build directory. Sorry about that. Fixing now.

@theotherjimmy theotherjimmy dismissed stale reviews from 0xc0170, deepikabhavnani, and themself via da69f01 April 24, 2018 15:08
@cmonr
Copy link
Contributor

cmonr commented Apr 24, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Apr 24, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Apr 24, 2018

@mbed-ci
Copy link

mbed-ci commented Apr 25, 2018

@ccli8
Copy link
Contributor Author

ccli8 commented Apr 26, 2018

@theotherjimmy The issue gets fixed with your update da69f01.

mbed test -m NUMAKER_PFM_NUC472 -t ARM --compile-list

@cmonr cmonr merged commit 1f259a4 into ARMmbed:master Apr 27, 2018
@ccli8 ccli8 deleted the nuvoton_fix_armc6_armv8m branch April 27, 2018 02:26
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