Deteled BSL & managed to export main.h one level higher so that KED could be used as a git Submodule

interrupts
key 3 years ago
parent e07b78241b
commit 967d132301

@ -2,19 +2,19 @@ cmake_minimum_required(VERSION 3.5)
include(config_files/cmakeProjectConfig.cmake) include(config_files/cmakeProjectConfig.cmake)
set(BSL_DIR ${CMAKE_SOURCE_DIR}/bsl/${BSL_USED}) set(CSL_DIR ${CMAKE_SOURCE_DIR}/csl/${CSL_USED})
if(EXISTS ${BSL_DIR}) # Cheking if the directory exists if(EXISTS ${CSL_DIR}) # Cheking if the directory exists
message("${BoldGreen}Compiling for ${BSL_USED} ${ColourReset}") message("${BoldGreen}Compiling for ${CSL_USED} ${ColourReset}")
set(COMPILER_DEFS ${BSL_DIR}/bslCompiler.cmake) set(COMPILER_DEFS ${CSL_DIR}/compiler.cmake)
set(PROJECT_DEFS ${BSL_DIR}/bslConfig.cmake) set(PROJECT_DEFS ${CSL_DIR}/config.cmake)
else() else()
message( FATAL_ERROR "${BoldRed}Please Select a valid BSL, CMake will exit.${ColourReset}" ) message( FATAL_ERROR "${BoldRed}Please Select a valid BSL, CMake will exit.${ColourReset}" )
endif() endif()
include(${COMPILER_DEFS}) include(${COMPILER_DEFS})
project(${BSL_USED} ASM C CXX) #do this intead sf declaring languages in the beginning it will prevent loop errors. project(${CSL_USED} ASM C CXX) #do this intead sf declaring languages in the beginning it will prevent loop errors.
set(CMAKE_VERBOSE_MAKEFILE off) #Shoul make print everythign ?? set(CMAKE_VERBOSE_MAKEFILE off) #Shoul make print everythign ??
set(EXECUTABLE ${PROJECT_NAME}) #Create the executable set(EXECUTABLE ${PROJECT_NAME}) #Create the executable
@ -22,7 +22,7 @@ set(EXECUTABLE ${PROJECT_NAME}) #Create the executable
#################################################################################################### ####################################################################################################
#CONFIG FILE #CONFIG FILE
#################################################################################################### ####################################################################################################
set(INTERFACES_DIR ${CMAKE_SOURCE_DIR}/bsl/csl/interfaces) set(INTERFACES_DIR ${CMAKE_SOURCE_DIR}/csl/interfaces)
set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils/assert) set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils/assert)
#################################################################################################### ####################################################################################################
@ -30,10 +30,7 @@ set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils/assert)
#################################################################################################### ####################################################################################################
include(${PROJECT_DEFS}) include(${PROJECT_DEFS})
add_subdirectory(utils) add_subdirectory(utils)
add_subdirectory(bsl) add_subdirectory(csl)
#set(BSL_HEADER_FILE ${CMAKE_SOURCE_DIR}/bsl/raspberry/bsl_raspberry.hpp)
#set(BSL_HEADER_FILE ${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp)
message("${BoldBlue}Project Info ${ColourReset}") message("${BoldBlue}Project Info ${ColourReset}")
message("${Blue} |--> Exec Name \t: ${EXECUTABLE} ${ColourReset}") message("${Blue} |--> Exec Name \t: ${EXECUTABLE} ${ColourReset}")

@ -1,2 +0,0 @@
add_subdirectory(csl)
add_subdirectory(${BSL_USED})

@ -1 +0,0 @@
add_subdirectory(${CLS_USED})

@ -1,6 +0,0 @@
add_library(stmTranslator bsl_nucleo_f042k6.cpp)
target_compile_options(stmTranslator PRIVATE ${C_FLAGS})
target_compile_definitions(stmTranslator PRIVATE ${C_DEFS})
target_include_directories(stmTranslator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_library(sub::translator ALIAS stmTranslator)

@ -1,17 +0,0 @@
#include "bsl_nucleo_f042k6.hpp"
Nucleo_f042k6::Nucleo_f042k6()
{
}
Nucleo_f042k6::~Nucleo_f042k6(){}
void Nucleo_f042k6::init()
{
}
void Nucleo_f042k6::running()
{
}

@ -1,21 +0,0 @@
#ifndef BSL_NUCLEO_F042K6_H
#define BSL_NUCLEO_F042K6_H
// TODO: implement bsl as singleton!
// https://stackoverflow.com/questions/1008019/c-singleton-design-pattern
class Nucleo_f042k6
{
public:
Nucleo_f042k6();
~Nucleo_f042k6();
void init();
void running();
private :
};
#endif /* BSL_NUCLEO_F042K6_H */

@ -1,7 +0,0 @@
add_library(rpiTranslator bsl_raspberry.cpp)
target_compile_options(rpiTranslator PRIVATE ${C_FLAGS})
target_compile_definitions(rpiTranslator PRIVATE ${C_DEFS})
target_include_directories(rpiTranslator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
add_library(sub::translator ALIAS rpiTranslator)

@ -1,23 +0,0 @@
#include "bsl_raspberry.hpp"
#include "../csl/interfaces/delay.hpp"
#include "../csl/interfaces/pin.hpp"
int startBSL()
{
int i = 0;
Pin pin;
Delay delay;
pin.init();
pin.setMode(Pin::output);
for(i=0; i < 5; i++)
{
std::cout << "Hello from raspberry" << std::endl;
pin.write(1);
delay.ms(500);
pin.write(0);
delay.ms(500);
}
return 1;
}

@ -1,8 +0,0 @@
#ifndef BSL_RASPBERRY_HPP
#define BSL_RASPBERRY_HPP
#include <stdio.h>
#include <iostream>
int startBSL();
#endif

@ -0,0 +1 @@
add_subdirectory(${CSL_USED})

@ -6,8 +6,7 @@
#PROJECT & LIBRARIES : defined by user and important that it comes after the VARIABLES otherwise the Set varibale will not be used. #PROJECT & LIBRARIES : defined by user and important that it comes after the VARIABLES otherwise the Set varibale will not be used.
#################################################################################################### ####################################################################################################
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(BSL_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CSL_USED ${CMAKE_SOURCE_DIR}/csl/rpi)
set(CLS_USED ${CMAKE_SOURCE_DIR}/bsl/csl/rpi)
#################################################################################################### ####################################################################################################
#VARIABLES : defined by user #VARIABLES : defined by user
#################################################################################################### ####################################################################################################
@ -25,6 +24,6 @@ set (CPP_INCLUDES ${CMAKE_SOURCE_DIR})
set (CPP_FLAGS ${C_FLAGS}) set (CPP_FLAGS ${C_FLAGS})
set (CPP_DEFS ${C_DEFS}) set (CPP_DEFS ${C_DEFS})
list(APPEND EXTRA_LIBS sub::translator) #list(APPEND EXTRA_LIBS sub::translator)
list(APPEND EXTRA_LIBS sub::delay) list(APPEND EXTRA_LIBS sub::delay)
list(APPEND EXTRA_LIBS sub::gpio) list(APPEND EXTRA_LIBS sub::gpio)

@ -4,9 +4,9 @@
set(CPU_MCU "-mcpu=cortex-m0") set(CPU_MCU "-mcpu=cortex-m0")
set(IDIR_BIN "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/bin") #set(IDIR_BIN "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/bin")
set(IDIR_LIB "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/lib") #set(IDIR_LIB "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/lib")
set(IDIR_INC "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/inc") #set(IDIR_INC "${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/inc")
#################################################################################################### ####################################################################################################
#PROJECT & LIBRARIES : defined by user and important that it comes after the VARIABLES otherwise the Set varibale will not be used. #PROJECT & LIBRARIES : defined by user and important that it comes after the VARIABLES otherwise the Set varibale will not be used.
@ -16,17 +16,16 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CROSSCOMPILING TRUE) set(CMAKE_CROSSCOMPILING TRUE)
set(LINKER ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/startup/STM32F042K6Tx_FLASH.ld) set(LINKER ${CMAKE_SOURCE_DIR}/csl/stm32f042/startup/STM32F042K6Tx_FLASH.ld)
set(BSL_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CSL_USED ${CMAKE_SOURCE_DIR}/csl/stm32f042)
set(CLS_USED ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042)
#################################################################################################### ####################################################################################################
#VARIABLES : defined by user #VARIABLES : defined by user
#################################################################################################### ####################################################################################################
set(CSL_INCLUDES set(CSL_INCLUDES
${UTILS_DIR} ${UTILS_DIR}
${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/CMSIS/Include ${CMAKE_SOURCE_DIR}/csl/stm32f042/CMSIS/Include
${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/Device) ${CMAKE_SOURCE_DIR}/csl/stm32f042/Device)
# For flags please check https://manned.org/arm-none-eabi-gcc/34fd6095 # For flags please check https://manned.org/arm-none-eabi-gcc/34fd6095
set(C_FLAGS set(C_FLAGS
@ -72,7 +71,7 @@ set (MAIN_FLAGS ${C_FLAGS})
set (MAIN_DEFS ${C_DEFS}) set (MAIN_DEFS ${C_DEFS})
list(APPEND EXTRA_LIBS sub::startup) list(APPEND EXTRA_LIBS sub::startup)
list(APPEND EXTRA_LIBS sub::translator) #list(APPEND EXTRA_LIBS sub::translator)
list(APPEND EXTRA_LIBS sub::delay) list(APPEND EXTRA_LIBS sub::delay)
list(APPEND EXTRA_LIBS sub::pin) list(APPEND EXTRA_LIBS sub::pin)
list(APPEND EXTRA_LIBS sub::usart) list(APPEND EXTRA_LIBS sub::usart)

@ -1,14 +1,14 @@
#!/bin/bash #!/bin/bash
BSL_TO_USE=$1 CSL_TO_USE=$1
BSL_LIST=$(ls -d -- ./bsl) CSL_LIST=$(ls -d -- ./csl)
FILE=build/ FILE=build/
if [ -z "$BSL_TO_USE" ];then if [ -z "$CSL_TO_USE" ];then
echo "Please enter a BSL" echo "Please enter a CSL"
cd bsl cd csl
echo Curretnly awailable BSL are : echo Curretnly awailable CSL are :
for d in */ ; do #Cheking the directroy to print files for d in */ ; do #Cheking the directroy to print files
if [ "$d" != "csl/" ];then #Exept csl/ if [ "$d" != "csl/" ];then #Exept csl/
@ -20,22 +20,22 @@ else
if [ -d "$FILE" ];then if [ -d "$FILE" ];then
rm -r build rm -r build
cmake -S . -B build/ -DBSL_USED=$BSL_TO_USE cmake -S . -B build/ -DCSL_USED=$CSL_TO_USE
else else
cmake -S . -B build/ -DBSL_USED=$BSL_TO_USE cmake -S . -B build/ -DCSL_USED=$CSL_TO_USE
fi fi
cd $FILE cd $FILE
make -j4 make -j4
if [ "$BSL_TO_USE" == "raspberry" ];then if [ "$CSL_TO_USE" == "raspberry" ];then
echo -e "\e[36m" echo -e "\e[36m"
echo "+--------------------------------------+" echo "+--------------------------------------+"
echo -e "\tExecuting $BSL_TO_USE" echo -e "\tExecuting $CSL_TO_USE"
echo "+--------------------------------------+" echo "+--------------------------------------+"
echo -e "\e[32m" echo -e "\e[32m"
./$BSL_TO_USE ./$CSL_TO_USE
echo -e "\e[36m" echo -e "\e[36m"
echo "+--------------------------------------+" echo "+--------------------------------------+"
@ -44,14 +44,14 @@ else
echo -e "\e[32m" echo -e "\e[32m"
fi fi
if [ "$BSL_TO_USE" == "nucleo_f042k6" ];then if [ "$CSL_TO_USE" == "nucleo_f042k6" ];then
echo -e "\e[36m" echo -e "\e[36m"
echo "+--------------------------------------+" echo "+--------------------------------------+"
echo -e "\tFlashing $BSL_TO_USE" echo -e "\tFlashing $CSL_TO_USE"
echo "+--------------------------------------+" echo "+--------------------------------------+"
echo -e "\e[32m" echo -e "\e[32m"
st-flash write $BSL_TO_USE.bin 0x08000000 st-flash write $CSL_TO_USE.bin 0x08000000
echo -e "\e[36m" echo -e "\e[36m"
echo "+--------------------------------------+" echo "+--------------------------------------+"

@ -7,13 +7,6 @@ extern "C" {
#ifdef RASPBERRY
#include "bsl/raspberry/bsl_raspberry.hpp"
#endif
#ifdef ARM_MCU
// #include "bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp"
#endif

@ -1,14 +1,6 @@
#ifndef MAIN_H #ifndef MAIN_H
#define MAIN_H #define MAIN_H
#ifdef RASPBERRY
#include "bsl/raspberry/bsl_raspberry.hpp"
#endif
#ifdef ARM_MCU
#include "bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp"
#endif
struct Delay struct Delay
{ {

Loading…
Cancel
Save