annotate wiki/Detailed CPU1-Discovery Project.md @ 40:da86a7adc4fa

Aligned structure with CPU1 linker file
author Ideenmodellierer
date Sun, 29 Jul 2018 16:45:00 +0200
parents 5f11787b4f42
children a6580170de6f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 # How to Create From Scratch a Project for _CPU1-Discovery_ Code #
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 The OpenSTM32 wiki have a [page](http://www.openstm32.org/Getting%2Bstarted%2Bwith%2BSystem%2BWorkbench%2Bfor%2BSTM32) to start a project from scratch. With the latest version of every support libraries and sources from ST. But here I prefer to have a project with the support files validated (and compatible) with the _OSTC4_ code.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 ## Start with an Empty Project ##
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 **Special Notes**:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 - _Linux_ users should read about this **well known _Eclipse_ bug** : http://www.openstm32.org/faq1#q22
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 - We do have a _STM32F427IIT6_ chip as CPU1. But the support file provided by _ST_ lake for _LCD TFT Display Controller_ (aka LTDC), even in the latest available version 1.7.2 from 2017-11-06... So we use the STM32F429IITx support file instead, that seems to be similar enough.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 In the following description, I suppose you used _mercurial_ to clone the sources into a **D:\Dev\OSTC4** directory. Make the changes for your own settings...
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 0. Start the IDE. On most machine it will be the `eclipse` in the _Ac6_ folder you installed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 1. Create an empty project: `File` > `New` > `C Project`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 2. Choose `AC6 STM32 MCU Project` and `AC6 STM32 MCU GCC`. Click `Next`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 Note: **make sure NOT TO CLICK FINISH... as it will skip all the rest of the configuration wizard !**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 3. Keep `Debug` and `Release` configurations. Click `Next`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 4. Create a new board, that you can name **OSTC4-CPU1-F429**, by choosing:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 > Series: `STM32F4`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 > Mcu: `STM32F429IITx`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 > Debug: `JTAG`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 Click `Next`.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 5. Keep `No firmware` and select `Don't generate startup files`. Then click `Finish`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 ## Configure Various Settings ##
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 1. In the _C/C++ Projects_ explorer, select your project top-level folder
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 2. Right on it, select `Properties`, `Resource` and set `Text file encoding` to **UTF-8**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 3. Right on it, select `Properties`, `Resource` then `Linked Resources` and click on `New...` to define a new variable **OSTC4** that points to your source folder **D:\Dev\OSTC4** (or whatever path you used on your system).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 This should allow to change the project's origin with a single variable change.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 # Add Sources Folders #
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 1. In the _C/C++ Projects_ explorer, select your project top-level folder
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 2. Right-click to add a `New` > `Folder`. In `Advanced settings >` click `Link to alternate location` and then the `Variables...` button. Click on the **OSTC4** variable, then click `Extend...` and select the **Common\\** sub-directory. Click `Finish`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 3. Do the same to import the linked folder **OSTC4\Discovery**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 ## Make _Eclipse_ aware you just added sources, not junk ##
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 (_Note: this step is only useful on specific versions of Eclipse. And already done by default on others..._)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 1. In the _C/C++ Projects_ explorer, open your project top-level project.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 2. Right click on the `Common` folder, select `Resource Configurations...`, and `Exclude from build`. Make sure to UNCHECK both `Debug` and `Release` check-boxes.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 3. Do the same for the `Discovery` folder.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 ## Make _Eclipse_ aware not to compile templates ##
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 Some sources or directories in the _ST_ distribution contains source you shall not compile. So you should tell _OSE_.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 1. In the _Project Explorer_, open item `Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src`. Right click on `stm32f4xx_hal_msp_template.c`source file, select `Resource Configurations...`, and `Exclude from build`. Make sure both `Debug` and `Release` check-boxes are CHECKED.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 2. Do the same on the `Common/Drivers/STM32F4xx_v220/Source/Templates` directory.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 # Compile #
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 Ok, sources are there. You can read them. But you need a few more efforts to let the IDE find everything he requires to compile _CPU1 Discovery_ firmware.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 ## Add include paths ##
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 1. Select your top-level project, right-click to edit `properties`. In `C/C++ Build` choose `Settings`, then `MCU GCC Compiler` and `Includes`. **Make sure to select `Configuration: [All Configurations]` **. Click `Add...` choose `Workspace...` and select the `Common/Drivers/CMIS_v210` directory.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 2. Do the same for `Common/Drivers/STM32F4xx_v220/Include` directory.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 3. Do the same for `Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc` directory.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 4. Do the same for `Common/Inc` directory.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 5. Do the same for `Discovery/Inc` directory.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 6. Use the _Move Up_ icon to make sure `Discovery/Inc` is first.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 7. Use the `Configuration:` popup to check you have all the includes in both `Debug` and `Release` configuration.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 Once done, If you go to the _C/C++ Projects explorer_, open your top-level project, and open the `Includes` item, you should see:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 - a few lines added by the system `.../Ac6/Workbench/plugins/.../compiler/...` with include paths required by the GCC compiler.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 - then your 5 include directories (shown in alphabetic order, not priority order... too bad). Make sure to open each of them and to double-click on a .h file to check it opens correctly in the IDE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 ## Add Link Options ##
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 1. Select your top-level project, right-click to edit `properties`. In `C/C++ Build` choose `Settings`, then `MCU G++ Linker` and `General`.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 And select _linker Script_: `OSTC4/Common/CPU1-F429.ld`
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 ## Build ELF firmware ##
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 1. Click the `Build` button (hammer icon) on the top bar.