Skip to content

Commit e834e99

Browse files
authored
Initial commit
0 parents  commit e834e99

File tree

109 files changed

+6806
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+6806
-0
lines changed

.github/workflows/build-app.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build Electrostatic-Application
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "master" branch
8+
push:
9+
branches: [ "master" ]
10+
pull_request:
11+
branches: [ "master" ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
jobs:
17+
build-electrostatic-app:
18+
# runner images with architectures (variants)
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
matrix:
22+
os: [ 'ubuntu-latest' ]
23+
name: Build Electrostatic App
24+
25+
# Steps represent a sequence of tasks that will be executed as part of the job
26+
steps:
27+
- name: Checkout Job
28+
uses: actions/checkout@v3
29+
30+
- name: Setup Electrostatic-Sandbox Workstation
31+
run: chmod +rwx ./helper-scripts/setup-environment/setup-sandbox.sh && ./helper-scripts/setup-environment/setup-sandbox.sh
32+
33+
- name: User's Permissions Granting
34+
run: chmod +rwx ./helper-scripts/project-impl/*.sh
35+
36+
- name: Building Electrostatic-application Executable Binaries
37+
run: sudo ./helper-scripts/project-impl/compile-all.sh
38+
39+
- name: Testing Electrostatic-app ELF
40+
run: sudo ./build/linux/x86-64/electrostatic-app.elf

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.buildconfig
2+
.Makefile
3+
# Ignore Gradle project-specific cache directory
4+
.gradle
5+
# Ignore Gradle/CMake build output directory
6+
build
7+
docs/doxygen
8+
cmake-build
9+
.so
10+
.cache
11+
.idea
12+
.vscode

CMakeLists.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
cmake_minimum_required(VERSION 3.18.1)
2+
3+
# define a project with a version
4+
project(electrostatic-application VERSION 1.0)
5+
6+
# To generate compile_commands.json for your project,
7+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8+
9+
###################### CMake Predefined Variables ######################
10+
############################################################
11+
12+
message(STATUS "Project: electrostatic-application")
13+
message(STATUS "Current Output in-comission: ${COMMISSION_OUTPUT}")
14+
message(STATUS "GCC: ${GCC_BIN}")
15+
message(STATUS "GPP: ${GPP_BIN}")
16+
message(STATUS "Compiler Options: ${INPUT_COMPILER_OPTIONS}")
17+
message(STATUS "Target architecture: ${TARGET}")
18+
message(STATUS "Toolchain Headers: ${HEADERS}")
19+
message(STATUS "Source Directory: ${SOURCES_DIR}")
20+
message(STATUS "Project sources: ${PROJECT_SOURCES}")
21+
message(STATUS "Dependencies: ${DEPENDENCIES}")
22+
message(STATUS "Building the binaries to: ${BUILD_DIR}")
23+
24+
###################### CMake Variables ######################
25+
############################################################
26+
27+
set(PROJECT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${SOURCES_DIR}")
28+
29+
set(commission_exe "${COMMISSION_OUTPUT}.elf")
30+
31+
set(CMAKE_C_COMPILER "${GCC_BIN}")
32+
set(CMAKE_CXX_COMPILER "${GPP_BIN}")
33+
set(COMPILER_OPTIONS "${TARGET} ${INPUT_COMPILER_OPTIONS}")
34+
35+
set(headers "${HEADERS}")
36+
37+
###################### Build routines ######################
38+
############################################################
39+
40+
# build an executable
41+
add_executable(${commission_exe}) # executable based on the static archive
42+
set_target_properties(${commission_exe} PROPERTIES COMPILE_FLAGS "${COMPILER_OPTIONS}" LINK_FLAGS "${COMPILER_OPTIONS}")
43+
# include headers for the target
44+
target_include_directories(${commission_exe} PUBLIC ${lib_headers} ${headers})
45+
target_link_libraries(${commission_exe} PUBLIC "${DEPENDENCIES}")
46+
# Start building the target
47+
target_sources(${commission_exe} PUBLIC "${PROJECT_SOURCES}")

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2025-2026, Electrostatic-Sandbox, Electrostat-Lab
4+
Author: Pavly G.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Electrostatic-application
2+
> An executable template utilizing the Electrostatic-Sandbox SDK
3+
4+
This is a template that builds a cross-platform native executable application for Linux variants, Android variants, and AVR MCU variants utilizing the Electrostatic-Sandbox SDK libraries.
5+
6+
## System Requirements
7+
1) A GNU/Linux System or a WSL System.
8+
2) A minimum of 1GB RAM, and 4GB Disk Space.
9+
3) If planned Microcontroller development; ATMega32 and/or ATMega328p are the currently supported ones.
10+
4) If planned Android development; all Android variants are supported.
11+
12+
## Setup the Electrostatic Environment
13+
This will install missing dependencies (CLI tools and toolchains) in `/opt/electrostatic-sandbox` that shall be utilized by the SDK build front-end and CMake to build the applications.
14+
15+
```bash
16+
chmod +rwx ./helper-scripts/setup-environment/setup-sandbox.sh && \
17+
./helper-scripts/setup-environment/setup-sandbox.sh
18+
```
19+
20+
## Build the application binary (.elf)
21+
This will build the application binary to all supported platforms; usually if a new build routine is to be built, it has to go here.
22+
23+
```bash
24+
chmod +x ./helper-scripts/project-impl/compile-all.sh && \
25+
./helper-scripts/project-impl/compile-all.sh
26+
```
27+
28+
## Introducing other building routines using Bash
29+
Introducing other building routines is far easy. However, it's mostly dependent on whether the original SDK is supporting those platforms. If not yet, you will have to build a pre-compilation header that excludes the SDK for those unsupported systems or else you will get linking errors.
30+
31+
Usually the build routines will look like that in general:
32+
https://github.com/Electrostat-Lab/Electrostatic-application/blob/0a4d1cb1635df59e5753aad2e2fad8a380d87706/helper-scripts/project-impl/compile-all.sh#L3-L14
33+
34+
They are dependent on that abstraction:
35+
https://github.com/Electrostat-Lab/Electrostatic-application/blob/0a4d1cb1635df59e5753aad2e2fad8a380d87706/helper-scripts/abstract/abstract-compile.sh#L1-L35
36+
37+
## Changing the project output name
38+
This could be attained by changing the variable `COMMISSION_EXE` in the `./helper-scripts/project-impl/variables.sh`:
39+
https://github.com/Electrostat-Lab/Electrostatic-application/blob/4963fe780fbb90f48d0fe2448488f006e202e88e/helper-scripts/project-impl/variables.sh#L9
40+
41+
## Adding new dependencies
42+
Add your dependencies in the `libs` directory with the system directory of choice if required (in case of platform-dependent binaries); the build script finds all libraries listed under this directory through this code snippet:
43+
https://github.com/Electrostat-Lab/Electrostatic-application/blob/4963fe780fbb90f48d0fe2448488f006e202e88e/helper-scripts/project-impl/compile-electrostatic-app.sh#L27-L43
44+
45+
## Build front-end automata, CMake, and Toolchains
46+
Essentially, the build architecture of the Electrostatic-Sandbox SDK is based on the idea of creating a front-end scripted API that creates a building automata, which entails taking an input and passing into a chain of states, and eventually ending with a terminal state; thus the recognition of the machine to the building holds if the terminal state is being reached by the program counter. The initial input to the automata is mainly a building routine instruction and the outputs are proceeded and could be found at the filesystems cmake-build and build, where the terminal output is produced.
47+
48+
The build of the Electrostatic-applications is much simpler than the SDK; it's literally a subset of it.
49+
50+
For more; refer to the [build architecture of the Electrostatic-Sandbox SDK](https://github.com/Electrostat-Lab/Electrostatic-Sandbox/blob/master/electrostatic-sandbox-framework/docs/system-build/architecture.md).
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
function build_sdk_() {
4+
# specify build targets
5+
BUILD_LINUX="${1}"
6+
BUILD_ANDROID="${2}"
7+
BUILD_MCU="${3}"
8+
9+
# compilation
10+
11+
# create the SDK build
12+
13+
# Zip the SDK build into a tar
14+
15+
# publish to maven-central
16+
}
17+
18+
function build_sdk__() {
19+
##
20+
return $?
21+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
function compile() {
4+
local GCC_BIN=${1}
5+
local GPP_BIN=${2}
6+
local INPUT_COMPILER_OPTIONS=${3}
7+
local TARGET=${4}
8+
local TOOLCHAIN_INCLUDES=${5}
9+
local JAVA_HOME=${6}
10+
local ELECTROSTATIC_CORE=${7}
11+
local BUILD_DIR=${8}
12+
local SOURCE_DIR=${9}
13+
14+
local TEMP=$(pwd)
15+
cd ${SOURCE_DIR}
16+
17+
cmake-3.19 "-DGCC_BIN=${GCC_BIN}" \
18+
"-DGPP_BIN=${GPP_BIN}" \
19+
"-DINPUT_COMPILER_OPTIONS=${INPUT_COMPILER_OPTIONS}" \
20+
"-DTARGET=${TARGET}" \
21+
"-DTOOLCHAIN_INCLUDES=${TOOLCHAIN_INCLUDES}" \
22+
"-DJAVA_HOME=${JAVA_HOME}" \
23+
"-DELECTROSTATIC_CORE=${ELECTROSTATIC_CORE}" \
24+
"-DBUILD_DIR=${BUILD_DIR}" \
25+
-S . -B "./cmake-build/${BUILD_DIR}"
26+
27+
cmake --build "./cmake-build/${BUILD_DIR}"
28+
cd ${TEMP}
29+
}
30+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
function compile() {
4+
local COMMISSION_OUTPUT=${1}
5+
local GCC_BIN=${2}
6+
local GPP_BIN=${3}
7+
local INPUT_COMPILER_OPTIONS=${4}
8+
local TARGET=${5}
9+
local HEADERS=${6}
10+
local SOURCES_DIR=${7}
11+
local PROJECT_SOURCES=${8}
12+
local DEPENDENCIES=${9}
13+
local BUILD_DIR=${10}
14+
local CMAKE_DIR=${11}
15+
16+
local TEMP=$(pwd)
17+
18+
cd "${CMAKE_DIR}" || exit $?
19+
20+
cmake-3.19 "-DCOMMISSION_OUTPUT=${COMMISSION_OUTPUT}" \
21+
"-DGCC_BIN=${GCC_BIN}" \
22+
"-DGPP_BIN=${GPP_BIN}" \
23+
"-DINPUT_COMPILER_OPTIONS=${INPUT_COMPILER_OPTIONS}" \
24+
"-DTARGET=${TARGET}" \
25+
"-DHEADERS=${HEADERS}" \
26+
"-DSOURCES_DIR=${SOURCES_DIR}" \
27+
"-DPROJECT_SOURCES=${PROJECT_SOURCES}" \
28+
"-DDEPENDENCIES=${DEPENDENCIES}" \
29+
"-DBUILD_DIR=${BUILD_DIR}" \
30+
-S . -B "$(pwd)/${SOURCES_DIR}/cmake-build/${BUILD_DIR}"
31+
32+
cmake-3.19 --build "$(pwd)/${SOURCES_DIR}/cmake-build/${BUILD_DIR}" || exit $?
33+
34+
cd "${TEMP}" || exit $?
35+
}
36+

0 commit comments

Comments
 (0)