Skip to content

stm32: Update Makefile to allow external BOARD directory to be specified #4097

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

Closed

Conversation

andrewleech
Copy link
Contributor

I'm working towards a pattern of simplifying use of micropython with custom boards and/or custom libraries that aren't suitable for submission to mainline micropython.

Currently these things generally require modifying (and typically forking) micropython to add board definitions etc.

This PR makes it easy to add a custom board definition outside of the micropython tree, keeping the micropython submodule clean and official.

Example usage is loosely described here: https://github.com/andrewleech/micropython/wiki/Customised-Micropython-projects

Once I've got external c modules running as well (likely similar to #3871, it'll be a separate PR though) I'll publish a clean example project.

As background info, for our use of micropython in a medical product, it's mandated that we can describe and test a clean interface between:

  • code we wholly own (product business logic, custom hardware drivers)
  • SOUP (software of unknown providence) aka not our own software

For a good introduction to the definitions and requirements of open source SOUP from a medical perspective, see: https://blog.cm-dm.com/post/2013/05/16/Got-SOUP-Part-4-Open-Source-Software

This is great for me, because that means that for any changes that can/should live in the micropython codebase, I can and should submit them back to master. The alternative is me trying to manage a SOUP that's a mixture of external and internal code with no clear boundary between them - not good for certification.

As far as this PR is concerned, we have a custom PCB which is running micropython. While the individual drivers needed to run this generally make sense to push up (eg. sdram driver) the actual board definition does not belong in master micropython.
Hence the desire to keep it external to a micropython submodule, ideally without needing yet another fork of micropython :-)

@andrewleech
Copy link
Contributor Author

ps. please let me know it there's already a different way to achieve this goal already in the codebase!

@dpgeorge
Copy link
Member

dpgeorge commented Sep 5, 2018

This approach looks ok. For a custom board I usually just add a new board directory to "boards/", but it would be nicer to keep custom code completely outside this repo.

I don't know of any existing way to do it.

Note that Travis CI build fails, not sure why.

HAL_DIR=lib/stm32lib/STM32$(MCU_SERIES_UPPER)xx_HAL_Driver
USBDEV_DIR=usbdev
#USBHOST_DIR=usbhost
FATFS_DIR=lib/oofatfs
FATFS_DIR=$(TOP)/lib/oofatfs
Copy link
Member

Choose a reason for hiding this comment

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

Why is this changed? Is it necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as previous comment, already removed

MCU_SERIES_UPPER = $(shell echo $(MCU_SERIES) | tr '[:lower:]' '[:upper:]')
CMSIS_DIR=lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Include
Copy link
Member

Choose a reason for hiding this comment

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

Why this change? Note that CMSIS_MCU_HDR also depends on CMSIS_DIR and would need to be updated too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I've already removed this, mistakenly thought I needed this with an earlier superproject structure.

@andrewleech
Copy link
Contributor Author

Yep the goal is keeping custom board files in a separate git so not too need them in the boards folder in a fork.

When I say I've already removed those two commented bits above... I thought the cleaner commit had already been pushed (before I left the office) but clearly that didn't work. The travis fail has been resolved, new commit will be pushed by tomorrow morning.

@pi-anl pi-anl force-pushed the stm32_make_external_board branch from b160095 to c7bc721 Compare September 5, 2018 23:46
@dhylands
Copy link
Contributor

dhylands commented Sep 6, 2018

I keep a bunch of boards in separate git repositories and just clone them from inside the boards directory. They don't need to be submodules or anything like that.

For example, see the 4th paragraph of this page: https://github.com/dhylands/G30DEV

@andrewleech
Copy link
Contributor Author

Ah yeah, not a bad workaround to get it working!

The advantage of keeping the board definition in a super-project with micropython as a submodule is you then have controlled traceability of which git revision of each works together.
This is important for general repeatability and a strict requirement for medical software.

ps. I've removed the extra unnecessary (and broken) changes from the commit.

@dpgeorge
Copy link
Member

Thanks for updating, merged in 670a2a3

@dpgeorge dpgeorge closed this Sep 11, 2018
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.

4 participants