Skip to content

Commit

Permalink
Init base code & buildsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
MG-5 committed Nov 7, 2022
1 parent b639757 commit 014fdf2
Show file tree
Hide file tree
Showing 11 changed files with 1,692 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BasedOnStyle: "LLVM"

AccessModifierOffset: "-4"
AllowShortFunctionsOnASingleLine: "false"
BreakBeforeBraces: "Allman"
ColumnLimit: "100"
IndentCaseLabels: "false"
IndentWidth: "4"
AlwaysBreakTemplateDeclarations: "true"
82 changes: 82 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Checks: abseil-*,

altera-struct-pack-align,

bugprone-*,
-bugprone-bool-pointer-implicit-conversion,
-bugprone-exception-escape,
-bugprone-infinite-loop,
-bugprone-signed-char-misuse,

boost-*,

cert-dcl03-c,
cert-dcl21-cpp,
cert-dcl58-cpp,
cert-err34-c,
cert-err52-cpp,
cert-err58-cpp,
cert-err60-cpp,
cert-flp30-c,
cert-msc50-cpp,
cert-msc51-cpp,
cert-oop54-cpp,

cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-macro-usage,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,

google-default-arguments,
google-explicit-constructor,
google-runtime-operator,

hicpp-exception-baseclass,
hicpp-multiway-paths-covered,

misc-*,
-misc-non-private-member-variables-in-classes,
-misc-unused-*,

modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-default-member-init,
-modernize-use-trailing-return-type,

mpi-*,

openmp-use-default-none,

performance-*,

portability-*,

readability-*,
-readability-simplify-boolean-expr,
-readability-braces-around-statements,
-readability-convert-member-functions-to-static,
-readability-function-size,
-readability-implicit-bool-conversion,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-make-member-function-const,
-readability-named-parameter,
-readability-qualified-auto,
-readability-redundant-access-specifiers,
-readability-uppercase-literal-suffix,

CheckOptions:
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.ConstantCase, value: CamelCase }
- { key: readability-identifier-naming.ConstantParameterCase, value: camelBack }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.MethodCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.ParameterCase, value: camelBack }
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
- { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build/
.vscode/**
!.vscode/c_cpp_properties.json
!.vscode/launch.json
!.vscode/tasks.json
/main/loginData.hpp
/sdkconfig.old
12 changes: 12 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configurations": [
{
"name": "ESP-IDF",
"cStandard": "c11",
"cppStandard": "c++17",
"compilerPath": "${config:idf.toolsPath}/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"cwd": "${workspaceFolder}",
"gdbpath": "${command:espIdf.getXtensaGdb}",
// "preLaunchTask": "OpenOCD",
"environment": [
{
"name": "PATH",
"value": "${config:idf.customExtraPaths}"
}
],
"autorun": [
"-enable-pretty-printing",
"target remote :3333",
"mon reset halt",
"flushregs",
"thb app_main",
"c"
],
}
]
}
56 changes: 56 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build - Build project",
"type": "shell",
"command": "${config:idf.pythonBinPath} ${config:idf.espIdfPath}/tools/idf.py build",
"windows": {
"command": "${config:idf.pythonBinPathWin} ${config:idf.espIdfPathWin}\\tools\\idf.py build",
"options": {
"env": {
"PATH": "${env:PATH};${config:idf.customExtraPaths}"
}
}
},
"options": {
"env": {
"PATH": "${env:PATH}:${config:idf.customExtraPaths}"
}
},
"problemMatcher": [
{
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": {
"regexp": "^\\.\\.(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
{
"owner": "cpp",
"fileLocation": "absolute",
"pattern": {
"regexp": "^[^\\.](.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.16)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp-dfi-ignah)
48 changes: 48 additions & 0 deletions main/Application.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "Application.hpp"

#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "sdkconfig.h"

#include <memory>

// called by ESP-IDF
extern "C" void app_main(void) // NOLINT
{
auto previousHeapFreeSpace = esp_get_free_heap_size();
auto &app = Application::getApplicationInstance();
auto currentHeapFreeSpace = esp_get_free_heap_size();

static constexpr auto PrintTag = "[Application]";

ESP_LOGI(PrintTag, "Moin");
ESP_LOGI(PrintTag, "Free memory: %d bytes", currentHeapFreeSpace);
ESP_LOGI(PrintTag, "Application consumes %d bytes on heap",
(previousHeapFreeSpace - currentHeapFreeSpace));

// vTaskDelay(toOsTicks(100.0_ms));

app.run();
}

//--------------------------------------------------------------------------------------------------
void Application::run()
{
// util::wrappers::Task::applicationIsReadyStartAllTasks();

// sync::waitForAll(sync::ConnectedToWifi);
// Timebase::initTimeSychronization();

while (true)
{
vTaskDelay(portMAX_DELAY);
}
}

//--------------------------------------------------------------------------------------------------
Application &Application::getApplicationInstance()
{
static auto app = std::make_unique<Application>();
return *app;
}
22 changes: 22 additions & 0 deletions main/Application.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

// #include "dfi/Dfi.hpp"
// #include "StatusLed.hpp"
// #include "Timebase.hpp"
// #include "Wireless.hpp"

class Application
{
public:
Application(){};
void run();

static Application &getApplicationInstance();

private:
// bool isConnected = false;

// Wireless wireless{isConnected};
// StatusLed statusLed{isConnected, pulseDetected};
// Dfi dfi{isConnected};
};
19 changes: 19 additions & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
idf_component_register(SRCS
#dfi/Dfi.cxx
#dfi/HttpClient.cxx

Application.cxx
#StatusLed.cxx
#Wireless.cxx

INCLUDE_DIRS ".")

#add_subdirectory(components/pugixml)
#add_subdirectory(components/Time)
#add_subdirectory(components/util)

target_link_libraries(${COMPONENT_LIB} PUBLIC
#pugixml
#Time
#util
)
Loading

0 comments on commit 014fdf2

Please sign in to comment.