You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,13 @@ Support for devices varies. Currently some targets have a startup file that can
10
10
11
11
## Starting your first project
12
12
13
-
:warning: This project needs the header file generated from the `.svd` of the manufacturer. Header file should be placed in in the targets/target folder with the same name as the target folder and should be generated by the CMSIS `svdconv` utility. (the `.svd` files for klib can be found [here](https://github.com/itzandroidtab/klib-svd))
13
+
The easiest way to start a your first project is using Github codespaces. Github codespaces will download all the required programs and will generate the required [header files](https://github.com/itzandroidtab/klib-svd) for all supported microcontrollers. If you want to create a project on your own machine the header files need to be generated manually (this can be done using the CMSIS 'svdconv' utility). The header files should be placed in the targets/chip/target folder with the same name as the target folder. Another way to get the header files is to start a github codespace and download the required headers when it is done converting all the svd files to headers.
14
+
15
+
For example the svd files for the LPC1756 can be generated using:
16
+
```bash
17
+
svdconv.exe lpc1756.svd --generate=header
18
+
```
19
+
The output of the svdconv utility needs to be moved to: `targets/chip/lpc1756/lpc1756.h`
14
20
15
21
### Selecting target cpu
16
22
To select a target cpu the target cpu needs to be added to the commandline when configuring cmake.
@@ -45,6 +51,9 @@ int main() {
45
51
}
46
52
```
47
53
54
+
### Constructors before running main
55
+
C++ supports global constructors for objects. These objects will be constructed before main is executed. This is supported by klib. If you want to initialize hardware before these global constructors are called you need to add the attribute `__attribute__((__constructor__(x)))` to your function definition where x is a number above 101 (the first 100 are reserved by gcc and 101 is reserved for startup code by klib). This will make sure your function will be executed before any constructor is called.
0 commit comments