Skip to content

cpu: use shared Cortex-M base vector table#7535

Merged
haukepetersen merged 2 commits intoRIOT-OS:masterfrom
haukepetersen:opt_cortexm_vectordefs
Oct 1, 2017
Merged

cpu: use shared Cortex-M base vector table#7535
haukepetersen merged 2 commits intoRIOT-OS:masterfrom
haukepetersen:opt_cortexm_vectordefs

Conversation

@haukepetersen
Copy link
Copy Markdown
Contributor

@kaspar030 and me finally found a very nice solution for sharing the Cortex-M vector table between all the Cortex-M based CPUs in RIOT. We simply split the table into chunks and add them separately to the vector table linker section, adding a numeric value as sub-section name for making sure the correct order is used.

This approach does further enable CPUs to even split up their CPU specific ISR vector table, allowing for more re-use.

Also, this approach enables to define the CPU specific vectors 'out-of-order', so that reserved fields do not have to be defined explicitly. See cpu/stm32l4/vectors.c as example.

@haukepetersen haukepetersen added Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 29, 2017
@haukepetersen haukepetersen added this to the Release 2017.10 milestone Aug 29, 2017
@haukepetersen haukepetersen requested review from vincent-d and removed request for vincent-d August 29, 2017 20:39
@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Aug 30, 2017

I like this one !
See haukepetersen#40 where I tried to optimize the interrupts vector for stm23 l0 and l1.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

merged.

Copy link
Copy Markdown
Member

@jnohlgard jnohlgard left a comment

Choose a reason for hiding this comment

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

I like the idea, and it should reduce the risk of errors in the vectors by reducing the amount of code duplication.

&_estack,
{
/* entry point of the program */
[ 0] = reset_handler_default,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

weird indentation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ups :-)

@vincent-d
Copy link
Copy Markdown
Member

Nice one!

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Sep 1, 2017

See haukepetersen#41, haukepetersen#42 and and haukepetersen#43 for f2, f3 and f7.

I think f1 is already ok. f0 and f4 will be a pain.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

I think I have something better: why don't we just generate these tables from the CMSIS headers directly?! -> #7553

So I tend to take the cleanup changes out of this PR and have separate PRs for each CPU family (see #7554 as example)...

@aabadie: I hope this is not going against all the effort you already put in for cleaning up those definitions?! Would this approach work for you?

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Sep 1, 2017

I hope this is not going against all the effort you already put in for cleaning up those definitions?

No problem, I like the idea of the tool. It makes it simpler and probably more error proof than the manual update (see the STM32F4 case for example...).

@haukepetersen
Copy link
Copy Markdown
Contributor Author

rebased. Can we proceed with this PR?

Copy link
Copy Markdown
Member

@smlng smlng left a comment

Choose a reason for hiding this comment

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

tested with boards remote-revb, arduino-due, and pba-d-01-kw2x (aka PhyNode) and examples/default, all still work as expected. So (semi-)tested ACK, any others tests recommended?

@smlng
Copy link
Copy Markdown
Member

smlng commented Sep 19, 2017

@haukepetersen feel free to merge, if you (still) think this is ready to go, no objections from me.

@haukepetersen
Copy link
Copy Markdown
Contributor Author

let's go then!

@haukepetersen haukepetersen merged commit 938ba0b into RIOT-OS:master Oct 1, 2017
@haukepetersen haukepetersen deleted the opt_cortexm_vectordefs branch October 1, 2017 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants