Compare commits
3 Commits
dev
...
5190e3116b
Author | SHA1 | Date | |
---|---|---|---|
5190e3116b | |||
06893c21ab | |||
43b14bdb92 |
Submodule stm-firmware/base64-lib updated: 0418c0702d...251e90abf3
Submodule stm-firmware/linklist-lib updated: fdd99bad48...18b3ab377a
@@ -2,7 +2,7 @@ project(updater-ram-code)
|
|||||||
set(CMAKE_SYSTEM_NAME Generic)
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||||
set(CMAKE_CROSSCOMPILING 1)
|
set(CMAKE_CROSSCOMPILING 1)
|
||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
set(CMAKE_TOOLCHAIN_FILE "arm-none-eabi-gcc.cmake")
|
set(CMAKE_TOOLCHAIN_FILE "arm-none-eabi-gcc.cmake")
|
||||||
|
|
||||||
|
2
temp-profile-checker/.gitignore
vendored
Normal file
2
temp-profile-checker/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*.o
|
||||||
|
build/*
|
41
temp-profile-checker/CMakeLists.txt
Normal file
41
temp-profile-checker/CMakeLists.txt
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
project(tprcc LANGUAGES CXX)
|
||||||
|
|
||||||
|
set (CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
aux_source_directory("src" SRC_DIR)
|
||||||
|
|
||||||
|
set (SRC_GENERATED "${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp" "${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp")
|
||||||
|
|
||||||
|
set (SOURCES
|
||||||
|
${SRC_DIR}
|
||||||
|
${SRC_GENERATED}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
DEPENDS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l
|
||||||
|
OUTPUT
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp
|
||||||
|
COMMAND
|
||||||
|
flex -+ -o "${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
DEPENDS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp
|
||||||
|
OUTPUT
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp
|
||||||
|
COMMAND
|
||||||
|
mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/generated" && bison -o"${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp" --header="${CMAKE_CURRENT_BINARY_DIR}/generated/tpr-parser.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(${SRC_GENERATED} PROPERTIES GENERATED 1)
|
||||||
|
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
|
# TEMPORARY FIx:
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
38
temp-profile-checker/include/tpr/tpr-scanner.hpp
Normal file
38
temp-profile-checker/include/tpr/tpr-scanner.hpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#ifndef _TPR_SCANNER_HPP_
|
||||||
|
#define _TPR_SCANNER_HPP_
|
||||||
|
|
||||||
|
|
||||||
|
#if ! defined(yyFlexLexerOnce)
|
||||||
|
#include <FlexLexer.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tpr-parser.hpp"
|
||||||
|
#include "location.hh"
|
||||||
|
|
||||||
|
namespace tpr {
|
||||||
|
|
||||||
|
class TempProfileScanner : public yyFlexLexer{
|
||||||
|
public:
|
||||||
|
|
||||||
|
TempProfileScanner(std::istream *in) : yyFlexLexer(in) {
|
||||||
|
};
|
||||||
|
virtual ~TempProfileScanner() {};
|
||||||
|
|
||||||
|
//get rid of override virtual function warning
|
||||||
|
using FlexLexer::yylex;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
int yylex( tpr::TempProfileParser::semantic_type * const lval,
|
||||||
|
tpr::TempProfileParser::location_type *location );
|
||||||
|
// YY_DECL defined in mc_lexer.l
|
||||||
|
// Method body created by flex in mc_lexer.yy.cc
|
||||||
|
|
||||||
|
private:
|
||||||
|
/* yyval ptr */
|
||||||
|
tpr::TempProfileParser::semantic_type *yylval = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* end namespace MC */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _TPR_SCANNER_HPP_ */
|
26
temp-profile-checker/parser/tpr.l
Normal file
26
temp-profile-checker/parser/tpr.l
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
%{
|
||||||
|
#include <tpr/tpr-scanner.hpp>
|
||||||
|
#undef YY_DECL
|
||||||
|
#define YY_DECL int tpr::TempProfileScanner::yylex(tpr::TempProfileParser::semantic_type * const lval, tpr::TempProfileParser::location_type *loc )
|
||||||
|
|
||||||
|
#define YY_USER_ACTION loc->step(); loc->columns(yyleng);
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
|
%option yyclass="tpr::TempProgileScanner"
|
||||||
|
%option noyywrap
|
||||||
|
%option never-interactive
|
||||||
|
%option c++
|
||||||
|
|
||||||
|
/* Predefined rules */
|
||||||
|
NEWLINE "\n"|"\r\n"
|
||||||
|
SPACE " "|"\t"|"\f"
|
||||||
|
COMMENT_BEGIN "/*"
|
||||||
|
COMMENT_END "*/"
|
||||||
|
COMMENT_LINE "//".*\n
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
SPACE {return 0;}
|
||||||
|
|
||||||
|
%%
|
48
temp-profile-checker/parser/tpr.ypp
Normal file
48
temp-profile-checker/parser/tpr.ypp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
%language "c++"
|
||||||
|
%require "3.2"
|
||||||
|
%defines
|
||||||
|
%define api.namespace {tpr}
|
||||||
|
%define api.parser.class {TempProfileParser}
|
||||||
|
|
||||||
|
%define parse.error verbose
|
||||||
|
|
||||||
|
%code requires{
|
||||||
|
namespace tpr {
|
||||||
|
class TempProfileScanner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
%parse-param { TempProfileScanner &scanner }
|
||||||
|
|
||||||
|
%code {
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <fstream>
|
||||||
|
#include <utility>
|
||||||
|
#include <tuple>
|
||||||
|
#include <tpr/tpr-scanner.hpp>
|
||||||
|
#undef yylex
|
||||||
|
#define yylex scanner.yylex
|
||||||
|
}
|
||||||
|
|
||||||
|
%define api.value.type variant
|
||||||
|
%locations
|
||||||
|
%start tpr_file
|
||||||
|
|
||||||
|
%token foo
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
tpr_file: foo
|
||||||
|
| tpr_file foo
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
void tpr::TempProfileParser::error(const location_type &l, const std::string &err_message)
|
||||||
|
{
|
||||||
|
std::cerr << "Error " << err_message << " at " << l << std::endl;
|
||||||
|
std::abort();
|
||||||
|
}
|
8
temp-profile-checker/src/main.cpp
Normal file
8
temp-profile-checker/src/main.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
std::cout << "Hello world" << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Reference in New Issue
Block a user