Skip to content

Fix crashes on boot on some Kinetis devices #4939

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
Sep 4, 2017

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Aug 18, 2017

Fix a crash on boot due to incorrectly size vector count. This patch also reduces the ram vector size for devices which reserved too much space.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 18, 2017

@maclobdell can you verify this patch on the KL27Z, KL43Z, KL82Z and KL41Z?

@maclobdell
Copy link
Contributor

@c1728p9 yes - will test asap.

cc @mmahadevan108 - this seems like the fix for the issues we have been having with KL27

@mmahadevan108
Copy link
Contributor

@c1728p9 Thank you.
Could you also help fix ram vector table size in K66F, KW24D, K22F, K64F

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 21, 2017

Hi @mmahadevan108, my intent here was only to track down the reason some devices were crashing. I light of this bug I would recommend NXP does a review of all Kinetis devices to ensure the vector table and vector count are sized accordingly.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Aug 21, 2017

/morph test

@mmahadevan108
Copy link
Contributor

0xc0170. Please let me know if this change was made as an error?

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 1071

Test failed!

@@ -51,7 +51,7 @@
#define __ram_vector_table__ 1

#if (defined(__ram_vector_table__))
#define __ram_vector_table_size__ 0x00000200
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 change required? The issue seems to be the large value for the number of NVIC_VECTORS

Copy link
Contributor

Choose a reason for hiding this comment

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

It used tobe large, 0x200, with this patch it would be now 0xc0?

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, that change is not required. It just saves space. The commit "Update ram vector size to save space" just saves space and could be removed entirely. Let me know if you want me to.

Copy link
Contributor

Choose a reason for hiding this comment

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

It has been reduced to match the number of NVIC_VECTORS, we had reserved a fixed space as this varies by platform. My request was to go back to the original value as it helps minimize changes in this file. I can check with the internal SDK team if this space can be adjusted per platform.

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 23, 2017

/morph test

1 similar comment
@studavekar
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: FAILURE

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

/morph test

Output

mbed Build Number: 1104

Build failed!

@mmahadevan108
Copy link
Contributor

@maclobdell @c1728p9 Can this fix be integrated into the mainline.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 1, 2017

@maclobdell @c1728p9 Can this fix be integrated into the mainline.

Waiting for CI to complete, then shall go in

If NVIC_NUM_VECTORS is larger than the space allocated by the vector
table in ram (__ram_vector_table_size__) then the call to mbed_cpy_nvic
during boot will corrupt valid data, which can lead to a crash. This
patch fixes the declared number of vectors on the KL27Z, KL43Z and
KL82Z to fix this crash.
@c1728p9
Copy link
Contributor Author

c1728p9 commented Sep 1, 2017

Rebased to master so testing can be re-triggered. Also removed the space saving patch at the request of @mmahadevan108.

@c1728p9
Copy link
Contributor Author

c1728p9 commented Sep 1, 2017

/morph test

@mbed-bot
Copy link

mbed-bot commented Sep 2, 2017

Result: SUCCESS

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

/morph test

Output

mbed Build Number: 1160

All builds and test passed!

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