Skip to content
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

CMSIS Builder #81

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

frankleonrose
Copy link

As part of issue #80, the builder here works with CMSIS framework enhancements here https://github.com/frankleonrose/framework-cmsis and successfully builds executables.

I updated the board definitions of FeatherM0 and MoteinoZero to include the 'cmsis' framework because I've actually run the executables on these boards.

@valeros
Copy link
Member

valeros commented Oct 22, 2019

Hi @frankleonrose ! Thanks a lot for this PR! Do other boards in this repo also support cmsis framework? Also could you please add several examples with edge cases so we can safely refactor the build script?

@frankleonrose
Copy link
Author

Yes, @valeros, most of the other boards support CMSIS. Perhaps all but the "Digistump DigiX" (hmm, looking at the data sheet, maybe that is just another sam3x.).

I'm happy to add examples - do you mean a project file ./examples/project/platformio.ini with envs for a few different boards and a main()?

@valeros
Copy link
Member

valeros commented Oct 22, 2019

I'm happy to add examples - do you mean a project file ./examples/project/platformio.ini with envs for a few different boards and a main()?

Yes, a couple of typical examples (blink, uart or something else worth adding to CI) will be enough.

@frankleonrose
Copy link
Author

All Atmelsam boards build cleanly with framework = cmsis.

@frankleonrose
Copy link
Author

@valeros Anything else you'd like to see here?

@valeros
Copy link
Member

valeros commented Nov 1, 2019

Hi @frankleonrose ! Looks great! Could we get rid of the commented code here and here ?
I took a look at your package repository and noticed there are plenty of files for peripherals. Are they part of another framework? Also, it might be a good idea to split the CMSIS package so each platform can have a separate package with a specific version and structure. WDYT?
Thanks!

Put `check_variants()` in https://github.com/frankleonrose/framework-cmsis/blob/master/scripts/package.py . We will print a warning that `MCU_FAMILY_SELECTORS` needs to be updated if mapping fails.
@frankleonrose
Copy link
Author

frankleonrose commented Nov 2, 2019

@valeros No, the entire CMSIS directory is from a single repo - https://github.com/ARM-software/CMSIS_5 - all the driver code is part of the framework. (Actually, I started with the CMSIS framework source files included in PlatformIO package framework-cmsis version 2.50400.181126.) The CMSIS framework should continue to include everything supplied there. In my most recent use case, Minimal-FreeRTOS using CMSIS-FreeRTOS, I rely on CMSIS framework including the RTOS2 headers.

Are you proposing that the complete PlatformIO framework-cmsis should be built by a process like the following?

  1. Start with https://github.com/ARM-software/CMSIS_5
  2. Layer in STM32 platformio/ldscripts/ststm32 and variants/ststm32 from a cmsis-stm32 repo.
  3. Layer in Atmelsam platformio/ldscripts/atmelsam and variants/atmelsam from an cmsis-atmelsam repo.
  4. Layer in other ARM platforms...

Personally, I wouldn't make it more complicated until I had a specific case that wasn't working without breaking it up.

@valeros
Copy link
Member

valeros commented Nov 4, 2019

@frankleonrose

all the driver code is part of the framework

I meant files in the variant folder, for example these.

Are you proposing that the complete PlatformIO framework-cmsis should be built by a process like the following?

What I'm suggesting is to create two new independent repositories framework-cmsis-ststm32 and framework-cmsis-atmelsam and each will contain a copy https://github.com/ARM-software/CMSIS_5 with the platform-specific variant layer. Then these repositories will be automatically archived as tar packages and specified in the platform.json file in each platform. This way these packages can be managed independently, and that's probably a good idea because users who want to program atmelsam board with CMSIS framework are not forced to download a mixed package that includes files for totally different platforms.

@frankleonrose
Copy link
Author

The STM32 variants have single ~5000 line files per processor whereas Atmel breaks them up by peripheral (~50-300 lines). They contain equivalent content: #defines for control registers.

@frankleonrose
Copy link
Author

Per-platform repos: I see what you mean now. And users will still be able to use framework = cmsis because the platform.json file will map that to the appropriate one. Great!

Will you make the repos under the https://github.com/platformio account?

@valeros
Copy link
Member

valeros commented Nov 5, 2019

So it would be great if you could tidy up (and probably rename) https://github.com/frankleonrose/framework-cmsis so there are no files related to ststm32 MCUs. After that we can transfer that repository to our account and then merge your PR.

Thanks!

@frankleonrose
Copy link
Author

Done.

@RudolphRiedel
Copy link

I just updated the Atmel SAM platform package again and it still does not allow bare metall CMSIS programming.
And I really do wonder why with this pull request open since 2019-10.

@chepo92
Copy link

chepo92 commented Nov 13, 2020

@frankleonrose great work! while I can compile with the examples provided with the framework-cmsis in your repo, I can't get a SAM4 to compile, have you tried it ?

@kroppt
Copy link

kroppt commented May 10, 2021

An upstream commit adds the CMSIS packages: abbfb1b
So I think this PR needs updating.

@glingy
Copy link

glingy commented Aug 6, 2021

I couldn't find if this was actually merged or still being actively worked on elsewhere, so I fixed the merge conflicts in a new fork: https://github.com/glingy/platform-atmelsam/tree/feat-cmsis-build-2 I am currently using this (with samc21 board) with no issues and as far as I can tell, all debugging features still work as intended. I can't test it much to be sure with other boards, but it seems to be working and I would love to have this integrated as a default option.

@glingy
Copy link

glingy commented Aug 6, 2021

Also @kroppt, Those cmsis packages are within the Arduino framework if I'm not mistaken. Someone else correct me if I'm wrong, but from what I can understand, the Arduino Framework uses the cmsis libraries and so it includes them. However, this is for "bare" programming using just the cmsis header files without the Arduino framework as well.

@RudolphRiedel
Copy link

Very nice, I did now what I should have been doing a while ago.
I replaced the AtmelSAM with this new branch, configured a new board file and now my Atmel Studio project builds in platformio.
There are a few kinks left and open questions but the important part is that it builds.

board_same51j19a.zip

@kroppt
Copy link

kroppt commented Aug 6, 2021

@glingy framework-cmsis is very generic. It's something you'd have to download yourself if you were doing this manually: https://github.com/ARM-software/CMSIS_5. I think we're on the same page about that.

One problem I see with both the old and updated solutions is that the framework-cmsis from @frankleonrose includes the platformio and variants folders, which PIO's current framework-cmsis does not have. For generic STM32 devices, the linker scripts are provided through tool-ldscripts-stm32, so I think we need an equivalent: tool-ldscripts-atmelsam.

In my own hack, I created a local package tool-ldscripts-atmelsam with the linker script for my board, and modified the platform to use those.

Ultimately, if this gets merged, it will have to jive with the existing frameworks. We will be in a better place if we use the latest framework-cmsis with a new repository for tool-ldscripts-atmelsam. Then, when it gets merged, the PIO team would take over distribution of tool-ldscripts-atmelsam, removing the need for the custom repository. At least that's how I think it will work.

@glingy
Copy link

glingy commented Aug 9, 2021

That sounds like a much better plan, and I hadn’t seen the ldscripts tool before. I’ll take a look at that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants