openMMC icon indicating copy to clipboard operation
openMMC copied to clipboard

Add stm32 support

Open MichaelStubbings opened this issue 2 years ago • 1 comments

Following the initial STM32 support provided by CERN, this PR captures the work Diamond has done to integrate this into the upstream.

MichaelStubbings avatar May 09 '23 13:05 MichaelStubbings

Hi Michael,

We are still reviewing your PR before merging, but so far we have the following observations:

  • The STM32 hardware abstraction library comes with a license that is not compatible with GPL, nor does it qualify as an Open Source license due to its restrictive nature in using it on microcontrollers not manufactured by ST Microelectronics. We have the same problem with the hardware abstraction library used by the LPC176x port, but we are taking steps to fix it. I believe you can generate BSD or Apache v2 licensed versions of the STM32 HAL using STM32Cube, I did it few years ago, though I don't remember how exactly;
  • I doesn't feel right having target specific code under the sensors/ directory. I couldn't come with a good alternative yet;
  • Do no use -fcommon gcc flag, global variables should not be instantiated on header files, instantiate them on a .c file and use the extern attribute on headers. We already force -fno-common here: https://github.com/lnls-dig/openMMC/blob/a6317247d426273bdd6f4ea31b7c5de92ee57a34/toolchain/toolchain-arm-none-eabi.cmake#L29 so to make the compiler behaviour consistent between different versions.

As we discussed previously, we will merge this on the stm32-support branch for now, then we need to harmonise this with the devel branch (that has diverged substantially). Also, please keep in mind that there will be substantial changes to the openMMC in the near future to fulfil our desire to fix some design issues and fix some long standing issues: https://github.com/lnls-dig/openMMC/issues/110.

@gustavosr8 is our new intern that will start working on the openMMC project shortly, so now we will have someone dedicated to help on this.

augustofg avatar May 10 '23 13:05 augustofg