Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Rework solution configuration and ST CMSIS/HAL integration #434

Open
wants to merge 157 commits into
base: dev
Choose a base branch
from

Conversation

josesimoes
Copy link
Contributor

This PR addresses the discussions in #405 and also #429.
A couple of warnings:

  • it's a work in progress
  • I'm aware that it's huge but couldn't find a better way to deal with all the changes because it touches a lot of stuff
  • I know it's not perfect, but it's a start

Having said that: it's a proposal open for review, discussion and criticism.

What's included (and in the works)

  1. Add PowerShell script to download and "install" ST CMSIS and HAL files (this addresses the question of not having third party code in the repository).
  2. The script is called when building a solution to make sure everything is available (this addresses the question of dealing with automated build processes).
  3. Reworked the way the hardware features are added to a solution to make developer's life easier and not requiring a deep knowledge of what is "under the hood".
    1. The device series/variant is moved from platform selector to solutions settings.
    2. TinyBooter and TinyCLR each have a settings file to allow granular selection of what features are to be added on each flavor. These settings files merge the solution settings and each is the one that goes into the respective proj file (instead of the global one as before).
    3. These settings files have a simple True/False selector to choose what should be added. These properties latter reflect what is compiled/linked in the final image. Having this selection here and as a property allows them to be visible and accessible in the projs, build system and code.
    4. The features property allow that (using #defines) the calls to the HAL init/deinit functions are added or not according to the feature selection.
    5. There is a readme file with the instructions on how to build a new solution.
    6. The TinyBooter and TinyCLR projs are organized in a way that they don't need to be (almost...) touched when building a new solution. Unless a very particular change is required, of course.
    7. There is a HAL project (one for CLR and another for loaders) that includes all the features.
    8. All the stubs are now implemented as 'weak' functions. This makes things easier because it allows that all the stubs can now be compiled and always added by default because the linker will replace the 'weak' ones with the 'strong' implementation (when it exists) and the optimizations will remove the 'dead' code when they are not used.
    9. All this makes it very easy to add new series and MCUs (at least for ST parts, right now there is only the HAL for the F4xx series but any other series can be added with minimal effort by using the ST Cube files and taking advantage on the new organization).
  4. The "new" HAL is total based in the CMSIS and HAL code supplied by ST.
  5. The individual projects for the HAL features are now based in the ST HAL and follow the ST guidelines and philosophy.
  6. The hardware configuration is now simpler because it uses the HAL naming and defines. This makes it easier to add new series/variants becuase the code knows what is available and what isn't and it adapts accordingly. E.g how many and which USARTS, SPI port, which pins belong where, etc.
    (GPIO, USART, SPI, I2C, power, flash and time are implemented; DA, ADC, PWM and USB are on the works)
  7. CRC calculations are selectable between the software implementation and hardware based.
  8. Most of the configurations and HAL options are now in the system_stm32f4xx.c in the solution folder, replacing what was in platform selector.
  9. USB support (using ST middleware libs) should be much easier for both device and host. We are close to have USB connection for MFDeploy. It currently enumerates the NETMF device and receives the debug packets. The last part (replying to MFDeploy) is in the works.
  10. The scatterfiles were reworked to use of the newlib nano and implement the stack/heap. The managed heap size is now automatic.
  11. The "simple heap" was removed because the modern compilers can provide that and we can free NETMF from doing it. (There is still a small remapping required for the crypto libs).

Final notes:

  • The changes are being included in both MCBSTM32F400 and STM32F4DISCOVERY. We only have available the STM32F4DISCOVERY board so we can't test the other hardware.
  • Right now only the TinyBooter is compiling and tested (except USB).

josesimoes and others added 30 commits February 16, 2016 18:38
- checked implementation of osXxxxDef objects
- need to add cpp define for __FPU_PRESENT because CMSIS code has
changed and the FP checks on previous versions that produced warning are
now errors
(this makes them ready to be uploaded with ST-Link app, DFU manager or similar)
- replace gcc with g++ fro CPP files
- add extra information to debug flavors and axfdump file
- add debug flavored configurations for arch (linked file)
- add PowerShell script to download and install SMT32F4 support pack from ST web site
(work in progress as the destination folders and final layout are still unknow)
- script is now generic to be able to handle all available STM32 series
- add code to copy source files to correct destination directories
- rename script
- add/reword comments
- move download code into if()
- now accepts series names and target version as parameters
- add validation for parameters
- add code to check if script is running from repository home or being called from a build project and adjusting working path accordingly
- add standard help to script
- correct pack target version validation
- correct documentation
- remove debug code
- replace several calls with PowerShell comandlets to improve eficiency
- source folder is now deleted after copy
- destination directories are now cleared before copying files
- remove references to SimpleHeap projects
- remove calls to SimpleHeap config and init
- remove Simple Heap declarations from TinyHal.h
- replace private_malloc and private_free with standard C malloc and free
- implement redirect functions for private_malloc and private_free because they were being referenced from the pre-compiled crypto libs
- rework scatter files to have a managed heap and standard heap that are managed from C standard code
- now looking for bit definition and not for the family
josesimoes and others added 14 commits April 13, 2016 12:47
- WinUSB classes are working
- USB debug and communication with MFDeploy completed
- Move USB config from solution\device code to solution settings file
- Add line to targets in order to set defines required for USB config compilation
- Rework TinyBooter and TinyCLR proj to include USB debug project/features
- Add FEATURE_USB_DEBUG to solutions features settings files and STM32F4 HAL projects
(only GCC, still missing RVD version)
 (weak declaration is now being correctly replaced with strong implementation by linker)
@josesimoes josesimoes mentioned this pull request Aug 3, 2016
@cw2 cw2 mentioned this pull request Aug 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants