Skip to content

nxp: fix vector redefinition from CMSIS #13064

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 1 commit into from
Jun 4, 2020

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Jun 4, 2020

Summary of changes

Since 5.7 CMSIS update to Mbed OS, __VECTOR_TABLE is defined in cmsis_gcc header
file. Many MCU in NXP uses this symbol as linker definition, therefore we should
check if already defined and undefined it.

Fixes #13062

Impact of changes

Migration actions required

Documentation


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[X] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


@0xc0170
Copy link
Contributor Author

0xc0170 commented Jun 4, 2020

@kjbracey-arm Can you review if you have better suggestion to fix this ? We could probably to this for all, just dont see how this is used within CMSIS (only found there is in toolchain headers).

From CMSIS doc for this macro:

The given name is used for defining the static (compiler time) interrupt vector table. The name must comply with any compiler/linker conventions, e.g. if used for vector table relocation or debugger awareness. CMSIS specifies common default for supported compilers.

common default, but how to change it without defining the symbol itself?

@kjbracey
Copy link
Contributor

kjbracey commented Jun 4, 2020

It's not used by CMSIS code itself, but it seems to be a convention to allow you to specify to the target's startup what you want it to call the vector table.

This is tied in with CMSIS attempting to switch to more C-based startup code. Not sure it's viable with assembler startup.

In the interim, just #undef __VECTOR_TABLE will suffice. You don't need an #ifdef for that - #undef is fine if it's not defined.

Or just define __VECTOR_TABLE before including the header, and then it will defer to you. I guess they think this should be defined by device.h?

@mergify mergify bot added the needs: work label Jun 4, 2020
Since 5.7 CMSIS update to Mbed OS, __VECTOR_TABLE is defined in cmsis_gcc header
file. Many MCU in NXP uses this symbol as linker definition, therefore we should
check if already defined and undefined it.

Fixes ARMmbed#13062
@0xc0170
Copy link
Contributor Author

0xc0170 commented Jun 4, 2020

This fixes the issue, Confirmed

mbed compile -t GCC_ARM -m KW41Z --app-config ./configs/mesh_6lowpan.json
[mbed] Working path "C:\Code\mbed-os-examples\mbed-os-example-mesh-minimal" (program)
Building project mbed-os-example-mesh-minimal (KW41Z, GCC_ARM)
Scan: mbed-os-example-mesh-minimal
Compile [100.0%]: fsl_common.c
Link: mbed-os-example-mesh-minimal
Elf2Bin: mbed-os-example-mesh-minimal

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jun 4, 2020

In the interim, just #undef __VECTOR_TABLE will suffice. You don't need an #ifdef for that - #undef is fine if it's not defined.

+1, updated

@ciarmcom ciarmcom requested review from maclobdell and a team June 4, 2020 09:00
@ciarmcom
Copy link
Member

ciarmcom commented Jun 4, 2020

@0xc0170, thank you for your changes.
@maclobdell @ARMmbed/mbed-os-maintainers please review.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jun 4, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Jun 4, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 1
Build artifacts

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jun 4, 2020

@artokin Once this merged, can we run a new tests to confirm this not only fixes the issue but has no unknown consequences (should be good).

@0xc0170 0xc0170 added ready for merge release-type: patch Indentifies a PR as containing just a patch and removed needs: review labels Jun 4, 2020
@0xc0170
Copy link
Contributor Author

0xc0170 commented Jun 4, 2020

cc @ARMmbed/team-nxp (to make sure this is known)

@0xc0170 0xc0170 merged commit 0988e5d into ARMmbed:master Jun 4, 2020
@0xc0170 0xc0170 deleted the fix_nxp_vector branch June 4, 2020 13:10
@mergify mergify bot removed the ready for merge label Jun 4, 2020
@mergify
Copy link

mergify bot commented Jun 4, 2020

This PR does not contain release version label after merging.

@mergify mergify bot added the release version missing When PR does not contain release version, bot should label it and we fix it afterwards label Jun 4, 2020
@0xc0170 0xc0170 removed the release version missing When PR does not contain release version, bot should label it and we fix it afterwards label Jun 22, 2020
@adbridge adbridge added Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Jun 24, 2020
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.

mbed-os-example-mesh-minimal build fails with KW41Z and GCC_ARM
5 participants