Skip to content

Commit

Permalink
Edit: new docs and typo in build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonyang-ee committed Dec 25, 2023
1 parent 738ab37 commit beb2c7d
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 128 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ docker run jasonyangee/stm32-builder:ubuntu-latest --help
>```

## Commands:

```
docker run -v {HostPath}:/home {IMAGE:VERSION} -r {Git_Repo_URL} -t {Build_Type}
```
```
docker run -v {HostPath}:{ContainerPath} {IMAGE:VERSION} -r {Git_Repo_URL} -t {Build_Type} -v {ContainerPath}
```


## Public Registry:

> ghcr.io/jasonyang-ee/stm32-builder:ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cmake --build $VOLUME/build/ -j$CORES
if [[ $? -eq 0 ]]; then
echo ' ^'
echo 'Build Completed |'
echo 'Target Binaery in __________________________|'
echo 'Target Binary in ___________________________|'
else
exit $?
fi
63 changes: 45 additions & 18 deletions docs_src/page/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,44 @@ For CMake setup, refer to the below STM32 project template.
<https://github.com/jasonyang-ee/STM32-CMAKE-TEMPLATE.git>


## Public Registry:
## Help Menu

> ghcr.io/jasonyang-ee/stm32-builder:ubuntu-latest
```
docker run jasonyangee/stm32-builder:ubuntu-latest --help
```
>```bash
>Usage: build.sh [OPTIONS]
>Options:
> -h, --help Print this help message
> -t, --type <build type> Set CMake build type
> Default: Release
> -v, --volume <volume mount path> Path to mount project inside of container and cmake will build in this path
> Default: /home
> -r, --repo <repository url> Clone repository from url into volume path and build
>```
> ghcr.io/jasonyang-ee/stm32-builder:debian-latest

> ghcr.io/jasonyang-ee/stm32-builder:alpine-latest
## Commands:

> ghcr.io/jasonyang-ee/stm32-builder:arch-latest
```
docker run -v {HostPath}:/home {IMAGE:VERSION} -r {Git_Repo_URL} -t {Build_Type}
```
```
docker run -v {HostPath}:{ContainerPath} {IMAGE:VERSION} -r {Git_Repo_URL} -t {Build_Type} -v {ContainerPath}
```

> jasonyangee/stm32-builder:ubuntu-latest

> jasonyangee/stm32-builder:debian-latest
## Basics of This Image

> jasonyangee/stm32-builder:alpine-latest
This image is intended for building STM32 Microcontroller C/C++ Project Configured with CMake and Ninja.

The entrypoint bash script executes basically those commands in default:
```bash
git clone $REPO $VOLUME
cmake -DCMAKE_BUILD_TYPE=$TYPE -S $VOLUME -B $VOLUME/build/ -G Ninja
cmake --build $VOLUME/build/ -j$CORES
```

> jasonyangee/stm32-builder:arch-latest


## Docker Image Compiler Environment
Expand All @@ -49,16 +70,22 @@ For CMake setup, refer to the below STM32 project template.
- [stlink-tools](https://github.com/stlink-org/stlink)


## Basics of This Image

This image is intended for building STM32 Microcontroller C/C++ Project Configured with CMake and Ninja.

The entrypoint bash script executes basically two commands in default:
```bash
cmake -DCMAKE_BUILD_TYPE=Release -S /home -B /home/build/ -G Ninja
cmake --build /home/build -j$(nproc)
```
## Public Registry:

- `CMAKE_TOOLCHAIN_FILE` must be defined in your project CMakeList.txt file.
- Default build type is `Release`.
> ghcr.io/jasonyang-ee/stm32-builder:ubuntu-latest
> ghcr.io/jasonyang-ee/stm32-builder:debian-latest
> ghcr.io/jasonyang-ee/stm32-builder:alpine-latest
> ghcr.io/jasonyang-ee/stm32-builder:arch-latest
> jasonyangee/stm32-builder:ubuntu-latest
> jasonyangee/stm32-builder:debian-latest
> jasonyangee/stm32-builder:alpine-latest
> jasonyangee/stm32-builder:arch-latest
27 changes: 0 additions & 27 deletions docs_src/page/Menu_Hybrid.md

This file was deleted.

33 changes: 0 additions & 33 deletions docs_src/page/Menu_Local.md

This file was deleted.

32 changes: 0 additions & 32 deletions docs_src/page/Menu_Mounted.md

This file was deleted.

13 changes: 6 additions & 7 deletions docs_src/page/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

# User Guide

- [How To](Menu.md)
- [Use Git Repo Link](Menu_Local.md)
- [Use Mount Volume](Menu_Mounted.md)
- [Use Hybrid](Menu_Hybrid.md)
- [Use Online With Github Action](Menu_Github_Action.md)
- [Use As Dev Container](Menu_Dev_Container.md)
- [Use Manually](Menu_Manual.md)
- [How To](Use.md)
- [Use Git Repo Link](Use_Repo.md)
- [Use Mount Volume](Use_Mounted.md)
- [Use Online With Github Action](Use_Github_Action.md)
- [Use As Dev Container](Use_Dev_Container.md)
- [Use Manually](Use_Manual.md)


- [WSL](WSL.md)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Once `reopend in container`, you will be operating in this container OS and be a

3. `Ctrl` + `Shift` + `p` select `Dev Containers: Reopen in Container`.

4. Build using VS Code Extension or using bash script `build.sh .`.
4. Build using bash script `build.sh -v $PWD` or using VS Code Extension.

5. Flash the device as described in section [WSL ST-LINK](WSL_STLINK.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

## Mechanism

Using Github Action to load this docker image as base environment. Then run the build script.
Using Github Action to load this docker image as base environment. Then run the `build.sh` script.

Docker image entrypoint 1st argument will define CMake build_type.
`build.sh` accpets the the same arguments: `-r` `-t` `-v`.

Default `HostPath` is `/github/workspace` and `ContainerPath` is `/home`.

Only `-t` is recommended to be used with Github Action.

## How To Use

Expand All @@ -15,12 +19,7 @@ In the source root, create file `.github\workflows\build.yml` with the following
```yml
- uses: actions/checkout@v3
- name: BUILD
run: build.sh
```
```yml
- uses: actions/checkout@v3
- name: BUILD
run: build.sh -t Debug
run: build.sh -t MinSizeRel
```

- Full Script:
Expand All @@ -40,7 +39,7 @@ In the source root, create file `.github\workflows\build.yml` with the following
steps:
- uses: actions/checkout@v3
- name: BUILD
run: build.sh
run: build.sh -t MinSizeRel

- name: Upload Binary .elf
uses: actions/upload-artifact@v2
Expand Down
5 changes: 5 additions & 0 deletions docs_src/page/Menu_Manual.md → docs_src/page/Use_Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
- Run build script to invoke auto compiling process.
```bash
build.sh
```

- `build.sh` accpets the the same arguments: `-r` `-t` `-v`.
```bash
build.sh -t MinSizeRel
```
31 changes: 31 additions & 0 deletions docs_src/page/Use_Mounted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use With Mount Volume

## Mechanism

Container will mount your existing project folder into `/home` and compile it in `/home/build`.

- `HostPath` is the existing project folder path on your local host machine. **This folder must contain your source code.**

- `ContainerPath` is the folder in docker container. Default is `/home`.


## Command

- Format:
```bash
docker run -v "{HostPath}":"/home" {IMAGE:VERSION}
docker run -v "{HostPath}":"/home" {IMAGE:VERSION} -t {Build_Type}
docker run -v "{HostPath}":"/custom" {IMAGE:VERSION} -v /custom
```

- Example:
```bash
docker run -v "F:\Project\STM32-CMAKE-TEMPLATE":"/home" jasonyangee/stm32-builder:ubuntu-latest
docker run -v "F:\Project\STM32-CMAKE-TEMPLATE":"/home" jasonyangee/stm32-builder:ubuntu-latest -t Debug
docker run -v "F:\Project\STM32-CMAKE-TEMPLATE":"/custom" jasonyangee/stm32-builder:ubuntu-latest -v /custom
```


## Output

Binary Output `.bin` `.elf` `.hex` `.map` are located in `HostPath/build`.
29 changes: 29 additions & 0 deletions docs_src/page/Use_Repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use With Git Link

## Mechanism

Container will mount to local folder as working directory. Then it will clone the supplied git repo source file into `/home` and compile it in `/home/build`.

- `HostPath` is any empty folder path on local host machine. If no folder existed, one will be created.

- `ContainerPath` is the path inside of container. Default is `/home`.

## Command

- Format:
```bash
docker run -v "{HostPath}":"/home" {IMAGE:VERSION} -r {Git_Repo_URL}
docker run -v "{HostPath}":"/home" {IMAGE:VERSION} -r {Git_Repo_URL} -t {Build_Type}
docker run -v "{HostPath}":"{ContainerPath}" {IMAGE:VERSION} -r {Git_Repo_URL} -t {Build_Type} -v {ContainerPath}
```

- Example:
```bash
docker run -v "F:\test_compile":"/home" jasonyangee/stm32-builder:ubuntu-latest -r https://github.com/jasonyang-ee/STM32-CMAKE-TEMPLATE.git
docker run -v "F:\test_compile":"/home" jasonyangee/stm32-builder:ubuntu-latest -r https://github.com/jasonyang-ee/STM32-CMAKE-TEMPLATE.git -t MinSizeRel
docker run -v "F:\test_compile":"/custom" jasonyangee/stm32-builder:ubuntu-latest -r https://github.com/jasonyang-ee/STM32-CMAKE-TEMPLATE.git -t Debug -v /custom
```

## Output

Binary Output `.bin` `.elf` `.hex` `.map` are located in `HostPath/build`.

0 comments on commit beb2c7d

Please sign in to comment.