Skip to content

Commit e2d68a5

Browse files
nicka101shymega
authored andcommitted
WIP CMakeLists for utils, platform, rtos
Main work by @nicka101. Also, by @shymega: - Add another `target_link_libraries` to util_sha256 This links to CMSIS and HAL libs. - Fixup Dockerfile for GCC ARM download, and tidy - Had to run `dos2unix` on some files. - Remove `*.cmake` from .gitignore This allows us to keep future CMake modules, for example, Corrosion. - Update devcontainer.json name - Move `.devcontainer/devcontainer.json` to root of repo Signed-off-by: Dom Rodriguez <[email protected]>
1 parent a81dfa7 commit e2d68a5

39 files changed

+355
-63
lines changed
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"name": "Open PineBuds Pro - VS Code Development Environment",
2+
"name": "OpenPineBuds - Dev Environment",
33
"build": {
44
"dockerfile": "../Dockerfile",
55
"context": ".."
66
},
7-
"extensions": [
8-
"ms-vscode.cmake-tools",
9-
"ms-vscode.cpptools"
10-
],
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-vscode.cmake-tools",
11+
"ms-vscode.cpptools"
12+
]
13+
}
14+
},
1115
"runArgs": [
1216
"--privileged"
1317
],
1418
"userEnvProbe": "loginInteractiveShell",
1519
"remoteUser": "root"
16-
}
20+
}

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
!.gitattributes
2020
!.mailmap
2121
!.github
22-
!.devcontainer
22+
!.devcontainer.json
2323

2424
# Backup files
2525
*~
@@ -102,3 +102,8 @@ Release/
102102
# *.ini
103103
log.txt
104104
log.txt
105+
106+
#CMake
107+
/build/
108+
CMakeCache.txt
109+
/CMakeFiles/

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cmake_minimum_required (VERSION 3.12)
2-
project (OpenPineBuds C CXX)
2+
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
3+
project (OpenPineBuds C CXX ASM)
34

45
option (OPB_BLUE_CONN_LIGHT "Enable the blue connection light" OFF) # Use BLE to control this.
56

Dockerfile

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
1-
FROM debian:bullseye-slim AS base
2-
3-
FROM base AS rust_build
4-
5-
LABEL org.opencontainers.image.authors = "Ben V. Brown <[email protected]>, Dom Rodriguez <[email protected]>"
6-
7-
WORKDIR /usr/src
8-
ENV PATH="/root/.cargo/bin:$PATH"
9-
10-
RUN apt-get update \
11-
&& apt-get install -y \
12-
bc \
13-
build-essential \
14-
curl \
15-
git \
16-
libudev-dev \
17-
pkg-config \
18-
&& curl https://sh.rustup.rs -sSf | bash -s -- -y \
19-
&& git clone https://github.com/Ralim/bestool.git \
20-
&& cd /usr/src/bestool/bestool/ \
21-
&& cargo build --release
22-
23-
FROM base as dev_env
24-
25-
WORKDIR /usr/src
26-
27-
RUN apt-get update \
28-
&& apt-get install -y \
29-
bash \
30-
bc \
31-
bzip2 \
32-
curl \
33-
ffmpeg \
34-
clang-format \
35-
git \
36-
make \
37-
tar \
38-
xxd \
39-
&& git config --global --add safe.directory /src \
40-
&& mkdir -pv /src \
41-
&& curl \
42-
https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-$(arch)-linux.tar.bz2 | tar -xj -C /src/
43-
44-
RUN apt-get update \
45-
&& apt-get install -y \
46-
minicom \
47-
sudo
48-
49-
ENV PATH="${PATH}:/src/gcc-arm-none-eabi-9-2019-q4-major/bin"
50-
COPY --from=rust_build /usr/src/bestool/bestool/target/release/bestool /usr/local/bin/bestool
51-
COPY . /usr/src
52-
53-
ENTRYPOINT ["/bin/bash"]
1+
FROM debian:bullseye-slim AS base
2+
3+
FROM base AS rust_build
4+
5+
LABEL org.opencontainers.image.authors = "Ben V. Brown <[email protected]>, Dom Rodriguez <[email protected]>"
6+
7+
WORKDIR /usr/src
8+
ENV PATH="/root/.cargo/bin:$PATH"
9+
10+
RUN apt-get update \
11+
&& apt-get install -y \
12+
bc \
13+
build-essential \
14+
curl \
15+
git \
16+
libudev-dev \
17+
pkg-config \
18+
&& curl https://sh.rustup.rs -sSf | bash -s -- -y \
19+
&& git clone https://github.com/Ralim/bestool.git \
20+
&& cd /usr/src/bestool/bestool/ \
21+
&& cargo build --release
22+
23+
FROM base as dev_env
24+
25+
WORKDIR /usr/src
26+
27+
RUN apt-get update \
28+
&& apt-get install -y \
29+
bash \
30+
bc \
31+
bzip2 \
32+
clang-format \
33+
cmake \
34+
curl \
35+
ffmpeg \
36+
git \
37+
make \
38+
minicom \
39+
sudo \
40+
tar \
41+
xxd \
42+
&& git config --global --add safe.directory /usr/src \
43+
&& mkdir -pv /usr/local/toolchains \
44+
&& curl \
45+
https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-$(arch)-linux.tar.bz2 \
46+
| tar -xj -C /usr/local/toolchains
47+
48+
ENV PATH="${PATH}:/usr/local/toolchains/gcc-arm-none-eabi-9-2019-q4-major/bin"
49+
COPY --from=rust_build /usr/src/bestool/bestool/target/release/bestool /usr/local/bin/bestool
50+
COPY . /usr/src
51+
52+
ENTRYPOINT ["/bin/bash"]

src/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
add_subdirectory (apps)
1+
set(CHIP best2300p)
2+
set(CHIP_BEST2300P 1)
3+
set(CHIP_ID_LITERAL best2300p)
4+
5+
add_compile_definitions(CHIP=${CHIP} CHIP_BEST2300P=${CHIP_BEST2300P} CHIP_ID_LITERAL=${CHIP_ID_LITERAL})
6+
7+
add_subdirectory(apps)
8+
add_subdirectory(utils)
9+
add_subdirectory(platform)
10+
add_subdirectory(rtos)
211

312
include_directories (include)

src/apps/apptester/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ file (GLOB headers "*.h")
22
file (GLOB sources "*.c*")
33

44
add_library (apps_apptester STATIC ${sources} ${headers})
5+
target_link_libraries(apps_apptester apps_common)

src/apps/audioplayers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ file (GLOB headers "*.h")
55
file (GLOB sources "*.c*")
66

77
add_library (apps_audioplayers STATIC ${sources} ${headers})
8+
target_link_libraries(apps_audioplayers util_list)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
file (GLOB headers "*.h")
22
file (GLOB sources "*.c*")
33

4-
add_library (apps_audiplayers_a2dpdecoder STATIC ${sources} ${headers})
4+
add_library (apps_audioplayers_a2dpdecoder STATIC ${sources} ${headers})
5+
target_link_libraries(apps_audioplayers_a2dpdecoder util_list)

src/apps/battery/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ file (GLOB headers "*.h")
22
file (GLOB sources "*.cpp")
33

44
add_library (apps_battery STATIC ${sources} ${headers})
5+
target_link_libraries(apps_battery apps_main)

src/apps/common/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@ file (GLOB headers "*.h")
22
file (GLOB sources "*.c*")
33

44
add_library (apps_common STATIC ${sources} ${headers})
5+
target_link_libraries(apps_common platform_hal platform_drivers_ana)
6+
target_include_directories(apps_common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
7+
target_include_directories(apps_common PRIVATE
8+
${CMAKE_SOURCE_DIR}/services/ibrt_ui/inc/
9+
${CMAKE_SOURCE_DIR}/services/ibrt_core/inc/
10+
${CMAKE_SOURCE_DIR}/services/bt_app/
11+
${CMAKE_SOURCE_DIR}/services/app_ai/inc/
12+
)

0 commit comments

Comments
 (0)