diff --git a/.cproject b/.cproject
index eda91e4..3a3ba57 100644
--- a/.cproject
+++ b/.cproject
@@ -48,8 +48,8 @@
-
-
+
+
@@ -64,8 +64,8 @@
-
-
+
+
@@ -216,8 +182,8 @@
-
-
+
+
@@ -253,49 +219,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
@@ -331,11 +263,12 @@
-
-
-
-
+
+
+
+
+
diff --git a/app/ll_testbed.cpp b/App/application.cpp
similarity index 94%
rename from app/ll_testbed.cpp
rename to App/application.cpp
index 2676216..1509b8e 100644
--- a/app/ll_testbed.cpp
+++ b/App/application.cpp
@@ -6,14 +6,14 @@
*/
#include
#include
-#include "ll_hsusart.h"
-#include "ll_crchandler.h"
-#include "ll_memcpydma.h"
-#include "ll_consolehandler.h"
+#include "f4ll/ll_hsusart.h"
+#include "f4ll/ll_crchandler.h"
+#include "f4ll/ll_memcpydma.h"
+#include "f4ll/ll_consolehandler.h"
extern "C" {
#include "main.h"
#include "globals.h"
- #include "strutil.h"
+ #include "f4ll_c/strutil.h"
#include "config.h"
}
#include "globals_cpp.h"
diff --git a/app/application.h b/App/application.h
similarity index 64%
rename from app/application.h
rename to App/application.h
index fd15a99..73ea661 100644
--- a/app/application.h
+++ b/App/application.h
@@ -11,6 +11,13 @@
#include
#include "main.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void MainLoop();
+#ifdef __cplusplus
+} // extern "C" {
+#endif // __cplusplus
#endif /* APP_H_ */
diff --git a/app/config.h b/App/config.h
similarity index 100%
rename from app/config.h
rename to App/config.h
diff --git a/app/diag.c b/App/diag.c
similarity index 100%
rename from app/diag.c
rename to App/diag.c
diff --git a/app/diag.h b/App/diag.h
similarity index 100%
rename from app/diag.h
rename to App/diag.h
diff --git a/app/globals.c b/App/globals.c
similarity index 100%
rename from app/globals.c
rename to App/globals.c
diff --git a/app/globals.h b/App/globals.h
similarity index 77%
rename from app/globals.h
rename to App/globals.h
index 439f19c..b6b1f29 100644
--- a/app/globals.h
+++ b/App/globals.h
@@ -10,9 +10,9 @@
#include
#include "config.h"
-#include "usart_handler.h"
-#include "dma_helper.h"
-#include "crc_handler.h"
+#include "f4ll_c/usart_handler.h"
+#include "f4ll_c/dma_helper.h"
+#include "f4ll_c/crc_handler.h"
extern USARTSTATUS g_uartStatuses[USARTCOUNT];
diff --git a/app/globals_cpp.cpp b/App/globals_cpp.cpp
similarity index 69%
rename from app/globals_cpp.cpp
rename to App/globals_cpp.cpp
index 81e55f9..34f6e20 100644
--- a/app/globals_cpp.cpp
+++ b/App/globals_cpp.cpp
@@ -6,8 +6,8 @@
*/
#include "globals.h"
-#include "ll_hsusart.h"
-#include "ll_memcpydma.h"
+#include
+#include
f4ll::LL_HsUsart *g_usarts[4];
diff --git a/app/globals_cpp.h b/App/globals_cpp.h
similarity index 88%
rename from app/globals_cpp.h
rename to App/globals_cpp.h
index 517c2df..2cc6a50 100644
--- a/app/globals_cpp.h
+++ b/App/globals_cpp.h
@@ -9,7 +9,7 @@
#define GLOBALS_CPP_H_
#ifdef __cplusplus
-#include "ll_hsusart.h"
+#include "f4ll/ll_hsusart.h"
extern f4ll::LL_HsUsart *g_usarts[4];
diff --git a/app/platform/crc_ll.h b/App/platform/crc_ll.h
similarity index 100%
rename from app/platform/crc_ll.h
rename to App/platform/crc_ll.h
diff --git a/app/platform/dma_ll.h b/App/platform/dma_ll.h
similarity index 100%
rename from app/platform/dma_ll.h
rename to App/platform/dma_ll.h
diff --git a/app/platform/usart_ll.h b/App/platform/usart_ll.h
similarity index 100%
rename from app/platform/usart_ll.h
rename to App/platform/usart_ll.h
diff --git a/Inc/f4ll b/Inc/f4ll
new file mode 120000
index 0000000..f6794f6
--- /dev/null
+++ b/Inc/f4ll
@@ -0,0 +1 @@
+../components/f4ll/inc/
\ No newline at end of file
diff --git a/Inc/f4ll_c b/Inc/f4ll_c
new file mode 120000
index 0000000..d3596d4
--- /dev/null
+++ b/Inc/f4ll_c
@@ -0,0 +1 @@
+../components/f4ll_c/inc
\ No newline at end of file
diff --git a/lib/fault.c b/Lib/fault.c
similarity index 99%
rename from lib/fault.c
rename to Lib/fault.c
index 25952ab..024cd81 100644
--- a/lib/fault.c
+++ b/Lib/fault.c
@@ -8,7 +8,7 @@
#include
//#include
#include "stm32f4xx.h"
-#include "strutil.h"
+#include "f4ll_c/strutil.h"
#include "fault.h"
typedef struct {
diff --git a/lib/fault.h b/Lib/fault.h
similarity index 100%
rename from lib/fault.h
rename to Lib/fault.h
diff --git a/lib/fault_asm.s b/Lib/fault_asm.s
similarity index 100%
rename from lib/fault_asm.s
rename to Lib/fault_asm.s
diff --git a/lib/singleton.h b/Lib/singleton.h
similarity index 100%
rename from lib/singleton.h
rename to Lib/singleton.h
diff --git a/Makefile b/Makefile
index 852b748..e9af8f2 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,8 @@ CXXSTD = -std=c++14
#######################################
# Build path
BUILD_DIR = build
+COMPONENTS = components
+CONFIG_OVERRIDES = config-overrides
######################################
# source
@@ -49,8 +51,8 @@ Src/usart.c \
Src/usb_otg.c \
Src/stm32f4xx_it.c \
Src/stm32f4xx_hal_msp.c \
-$(wildcard app/*.c) \
-$(wildcard lib/*.c) \
+$(wildcard App/*.c) \
+$(wildcard Lib/*.c) \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_crc.c \
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \
@@ -93,8 +95,15 @@ ASM_SOURCES = \
startup_stm32f407xx.s
CXX_SOURCES = \
-$(wildcard app/*.cpp) \
-$(wildcard lib/*.cpp)
+$(wildcard App/*.cpp) \
+$(wildcard Lib/*.cpp)
+
+
+#######################################
+# components
+#######################################
+include $(sort $(wildcard $(COMPONENTS)/*/component.mk))
+
#######################################
# binaries
@@ -104,14 +113,16 @@ PREFIX = arm-none-eabi-
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
-CXXC = $(GCC_PATH)/$(PREFIX)gcc -x c++
+CXXC = $(GCC_PATH)/$(PREFIX)g++
+LD = $(GCC_PATH)/$(PREFIX)g++
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
-CXXC = $(PREFIX)gcc -x c++
+CXXC = $(PREFIX)g++
AS = $(PREFIX)gcc -x assembler-with-cpp
+LD = $(PREFIX)g++
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
@@ -161,8 +172,8 @@ COMMON_INCLUDES = \
-IMiddlewares/Third_Party/FatFs/src \
-IDrivers/CMSIS/Device/ST/STM32F4xx/Include \
-IDrivers/CMSIS/Include \
--Ilib \
--Iapp
+-IApp \
+-ILib
C_INCLUDES = \
@@ -194,7 +205,22 @@ LDSCRIPT = STM32F407VETx_FLASH.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
-LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
+#LDFLAGS = $(MCU) --specs=nosys.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections -static --specs=nano.specs
+LDFLAGS = $(MCU) -TSTM32F407VETX_FLASH.ld --specs=nosys.specs -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections -static --specs=nano.specs \
+ -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
+
+ifeq ($(MKDBG), 1)
+ $(info >>--------------------------------------------)
+ $(info $$C_SOURCES is [${C_SOURCES}])
+ $(info .)
+ $(info $$CXX_SOURCES is [${CXX_SOURCES}])
+ $(info .)
+ $(info $$C_DEFS is [${C_DEFS}])
+ $(info .)
+ $(info $$C_INCLUDES is [${C_INCLUDES}])
+ $(info $$CFLAGS is [${CFLAGS}])
+ $(info <<--------------------------------------------)
+endif
# default action: build all
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
@@ -208,10 +234,10 @@ OBJECTS = $(addprefix $(BUILD_DIR)/,$(C_SOURCES:.c=.o))
vpath %.c $(sort $(dir $(C_SOURCES)))
# list of ASM program objects
-OBJECTS +=$(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
+OBJECTS +=$(addprefix $(BUILD_DIR)/,$(ASM_SOURCES:.s=.o))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
-OBJECTS +=$(addprefix $(BUILD_DIR)/,$(notdir $(CXX_SOURCES:.cpp=.o)))
+OBJECTS +=$(addprefix $(BUILD_DIR)/,$(CXX_SOURCES:.cpp=.o))
vpath %.cpp $(sort $(dir $(CXX_SOURCES)))
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
@@ -227,7 +253,7 @@ $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
- $(CC) $(OBJECTS) $(LDFLAGS) -o $@
+ $(LD) $(OBJECTS) $(LDFLAGS) -o $@
$(SZ) $@
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
diff --git a/Src/stm32f4xx_it.c b/Src/stm32f4xx_it.c
index 5e4b280..49a52d8 100644
--- a/Src/stm32f4xx_it.c
+++ b/Src/stm32f4xx_it.c
@@ -26,17 +26,17 @@ extern "C" {
#include "stm32f4xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
-#include "usart_handler.h"
-#include "crc_handler.h"
-#include "console_handler.h"
-#include "memcpy_dma.h"
+#include "f4ll_c/usart_handler.h"
+#include "f4ll_c/crc_handler.h"
+#include "f4ll_c/console_handler.h"
+#include "f4ll_c/memcpy_dma.h"
#include "globals.h"
#include "diag.h"
}
#include "globals_cpp.h"
-#include "ll_memcpydma.h"
-#include "ll_consolehandler.h"
+#include "f4ll/ll_memcpydma.h"
+#include "f4ll/ll_consolehandler.h"
extern "C" {
diff --git a/app/application.c b/app/application.c
deleted file mode 100644
index d3fa69e..0000000
--- a/app/application.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include
-#include
-#include "application.h"
-#include "globals.h"
-#include "strutil.h"
-#include "diag.h"
-#include "usart_handler.h"
-#include "crc_handler.h"
-#include "console_handler.h"
-#include "memcpy_dma.h"
-
-#define PACKAGE_DELAY_MS 0
-#define STATS_DELAY_MS 1000
-
-// USART DMA RX TX
-// 1 2 2 7
-// 2 1 5 6
-// 3 1 1 3
-// 6 2 1 6
-// console USART
-// 4 1 2 4
-
-void MainLoop()
-{
- uint8_t const text2Send[] __attribute__((aligned(4))) =
- "Megszentsegtelenithetetlensegeskedeseitekert\r\n"
- "--------------------------------------------\r\n\0\0\0";
-
- struct initdata_t {
- USART_TypeDef* uart;
- DMA_TypeDef* dma;
- uint32_t stream_rx;
- uint32_t stream_tx;
- } static const initdata[] = {
- { USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7 },
- { USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6 },
- { USART3, DMA1, LL_DMA_STREAM_1, LL_DMA_STREAM_3 },
- { USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 },
- };
-
- uint32_t lastStatsTick = 0;
- uint32_t prevSentTick = 0;
- uint8_t statId = 0;
-
- uint32_t tmp = sizeof(text2Send) - 1;
- uint32_t randmask = 0x80000000;
- do
- if(randmask & tmp)
- break;
- while((randmask = randmask >> 1));
- randmask -= 1;
-
- for(uint16_t idx = 0; idx < sizeof(g_uartStatuses) / sizeof(g_uartStatuses[0]); ++idx) {
- struct initdata_t const *id = &initdata[idx];
- InitUartStatus(&g_uartStatuses[idx], id->uart, id->dma, id->stream_rx, id->stream_tx,
- &g_crcStatus, idx + USARTCOUNT, idx, NULL, NULL);
- memcpy(GetTxBuffer(&g_uartStatuses[idx]), text2Send, sizeof(text2Send) -1);
- }
-
- InitCrcStatus(&g_crcStatus, DMA2, LL_DMA_STREAM_4);
-
- InitDmaInfo(&g_ConsoleTxDmaInfo, CONSOLE_DMA_ENGINE, CONSOLE_TX_DMA_STREAM);
- LL_DMA_EnableIT_TC(g_ConsoleTxDmaInfo.dma, g_ConsoleTxDmaInfo.stream);
-
- InitMemcpyDma(MEMCPY_DMA_ENGINE, MEMCPY_DMA_STREAM);
-
- lastStatsTick = HAL_GetTick();
-
- for(uint16_t idx = 0; idx < sizeof(g_uartStatuses) / sizeof(g_uartStatuses[0]); ++idx)
- SetupReceive(&g_uartStatuses[idx]);
-
- for(;;) {
- uint32_t tick = HAL_GetTick();
- uint8_t send = PACKAGE_DELAY_MS ? (tick - prevSentTick > PACKAGE_DELAY_MS) : 1;
- if(send)
- prevSentTick += PACKAGE_DELAY_MS;
-
- for(uint16_t idx = 0; idx < sizeof(g_uartStatuses) / sizeof(g_uartStatuses[0]); ++idx) {
- if(!g_uartStatuses[idx].txBuffer.busy && send) {
- DIAG_ENTER_BUSY();
- PostPacket(&g_uartStatuses[idx], text2Send, sizeof(text2Send) - 1 - (rand() & randmask), &g_crcStatus);
- DIAG_EXIT_BUSY();
- }
- for(uint16_t rIdx = 0; rIdx < 2; ++rIdx)
- if(g_uartStatuses[idx].rxBuffers[rIdx].busy || g_uartStatuses[idx].rxBuffers[rIdx].error) {
- DIAG_ENTER_BUSY();
- ConsumePacket(&g_uartStatuses[idx], rIdx, &g_crcStatus);
- DIAG_EXIT_BUSY();
- }
- }
- if(tick - lastStatsTick > STATS_DELAY_MS) {
- PrintStats((char*)g_statsBuf, statId, &g_uartStatuses[statId].stats, UART4, &g_ConsoleTxDmaInfo);
- lastStatsTick += STATS_DELAY_MS;
- ++statId;
- if(statId >= USARTCOUNT)
- statId = 0;
- }
- uint32_t ein = LL_GPIO_ReadInputPort(KEY1_GPIO_Port);
- if(!(ein & KEY1_Pin)) {
- void (*fptr)(void) = (void (*)(void))(void*)0xa0000000;
- fptr();
- }
- }
-}
diff --git a/components/f4ll/component.mk b/components/f4ll/component.mk
new file mode 100644
index 0000000..28874d8
--- /dev/null
+++ b/components/f4ll/component.mk
@@ -0,0 +1,11 @@
+#encoder
+SELF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
+REL_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+ifeq ($(MKDBG), 1)
+ $(info >>> $(REL_DIR)/component.mk)
+endif
+$(eval C_INCLUDES += -I$(REL_DIR)/inc)
+$(eval CXX_SOURCES += $(wildcard $(REL_DIR)/src/*.cpp))
+ifeq ($(MKDBG), 1)
+ $(info <<<)
+endif
diff --git a/components/f4ll/inc/f4ll b/components/f4ll/inc/f4ll
new file mode 120000
index 0000000..945c9b4
--- /dev/null
+++ b/components/f4ll/inc/f4ll
@@ -0,0 +1 @@
+.
\ No newline at end of file
diff --git a/lib/ll_consolehandler.h b/components/f4ll/inc/ll_consolehandler.h
similarity index 97%
rename from lib/ll_consolehandler.h
rename to components/f4ll/inc/ll_consolehandler.h
index 6ff3aa3..182f115 100644
--- a/lib/ll_consolehandler.h
+++ b/components/f4ll/inc/ll_consolehandler.h
@@ -8,7 +8,7 @@
#ifndef LL_CONSOLEHANDLER_H_
#define LL_CONSOLEHANDLER_H_
-#include "ll_hsusart.h"
+#include "f4ll/ll_hsusart.h"
#include "singleton.h"
diff --git a/lib/ll_crchandler.h b/components/f4ll/inc/ll_crchandler.h
similarity index 98%
rename from lib/ll_crchandler.h
rename to components/f4ll/inc/ll_crchandler.h
index 51b9669..d8fd54f 100644
--- a/lib/ll_crchandler.h
+++ b/components/f4ll/inc/ll_crchandler.h
@@ -9,7 +9,7 @@
#define LL_CRCHANDLER_H_
#include
#include
-#include "ll_dmahelper.h"
+#include "f4ll/ll_dmahelper.h"
#include "singleton.h"
extern "C" void _HandleCrcDmaIrq(void);
diff --git a/lib/ll_dmahelper.h b/components/f4ll/inc/ll_dmahelper.h
similarity index 100%
rename from lib/ll_dmahelper.h
rename to components/f4ll/inc/ll_dmahelper.h
diff --git a/lib/ll_hsusart.h b/components/f4ll/inc/ll_hsusart.h
similarity index 97%
rename from lib/ll_hsusart.h
rename to components/f4ll/inc/ll_hsusart.h
index 20f32e4..4af8b75 100644
--- a/lib/ll_hsusart.h
+++ b/components/f4ll/inc/ll_hsusart.h
@@ -8,8 +8,8 @@
#ifndef LL_HSUSART_H_
#define LL_HSUSART_H_
#include
-#include
-#include
+#include "f4ll/ll_usartcore.h"
+#include "f4ll/ll_crchandler.h"
namespace f4ll {
diff --git a/lib/ll_memcpydma.h b/components/f4ll/inc/ll_memcpydma.h
similarity index 94%
rename from lib/ll_memcpydma.h
rename to components/f4ll/inc/ll_memcpydma.h
index c00ee1d..05c725c 100644
--- a/lib/ll_memcpydma.h
+++ b/components/f4ll/inc/ll_memcpydma.h
@@ -7,7 +7,7 @@
#ifndef LL_MEMCPY_DMA_H_
#define LL_MEMCPY_DMA_H_
-#include "ll_dmahelper.h"
+#include "f4ll/ll_dmahelper.h"
#include "singleton.h"
namespace f4ll {
diff --git a/lib/ll_usartcore.h b/components/f4ll/inc/ll_usartcore.h
similarity index 97%
rename from lib/ll_usartcore.h
rename to components/f4ll/inc/ll_usartcore.h
index 7b3672c..86bf92d 100644
--- a/lib/ll_usartcore.h
+++ b/components/f4ll/inc/ll_usartcore.h
@@ -9,7 +9,7 @@
#define LL_USARTCORE_H_
#include
-#include "ll_dmahelper.h"
+#include "f4ll/ll_dmahelper.h"
namespace f4ll {
diff --git a/lib/ll_consolehandler.cpp b/components/f4ll/src/ll_consolehandler.cpp
similarity index 96%
rename from lib/ll_consolehandler.cpp
rename to components/f4ll/src/ll_consolehandler.cpp
index d82c78f..2eee20a 100644
--- a/lib/ll_consolehandler.cpp
+++ b/components/f4ll/src/ll_consolehandler.cpp
@@ -5,8 +5,8 @@
* Author: abody
*/
-#include
-#include
+#include "f4ll/ll_consolehandler.h"
+#include
namespace f4ll {
diff --git a/lib/ll_crchandler.cpp b/components/f4ll/src/ll_crchandler.cpp
similarity index 99%
rename from lib/ll_crchandler.cpp
rename to components/f4ll/src/ll_crchandler.cpp
index 1042fdc..c0307ce 100644
--- a/lib/ll_crchandler.cpp
+++ b/components/f4ll/src/ll_crchandler.cpp
@@ -4,7 +4,7 @@
* Created on: Oct 26, 2019
* Author: compi
*/
-#include "ll_crchandler.h"
+#include "f4ll/ll_crchandler.h"
namespace f4ll {
diff --git a/lib/ll_dmahelper.cpp b/components/f4ll/src/ll_dmahelper.cpp
similarity index 97%
rename from lib/ll_dmahelper.cpp
rename to components/f4ll/src/ll_dmahelper.cpp
index c6e24e5..6ee1a98 100644
--- a/lib/ll_dmahelper.cpp
+++ b/components/f4ll/src/ll_dmahelper.cpp
@@ -5,7 +5,7 @@ q * ll_dmahelper.cpp
* Author: abody
*/
-#include
+#include "f4ll/ll_dmahelper.h"
namespace f4ll {
diff --git a/lib/ll_hsusart.cpp b/components/f4ll/src/ll_hsusart.cpp
similarity index 99%
rename from lib/ll_hsusart.cpp
rename to components/f4ll/src/ll_hsusart.cpp
index 64deee4..f96a965 100644
--- a/lib/ll_hsusart.cpp
+++ b/components/f4ll/src/ll_hsusart.cpp
@@ -5,7 +5,7 @@
* Author: abody
*/
#include
-#include "ll_hsusart.h"
+#include "f4ll/ll_hsusart.h"
namespace f4ll {
diff --git a/lib/ll_memcpydma.cpp b/components/f4ll/src/ll_memcpydma.cpp
similarity index 96%
rename from lib/ll_memcpydma.cpp
rename to components/f4ll/src/ll_memcpydma.cpp
index 18fdeac..cbfcb16 100644
--- a/lib/ll_memcpydma.cpp
+++ b/components/f4ll/src/ll_memcpydma.cpp
@@ -5,7 +5,7 @@
* Author: abody
*/
-#include
+#include "f4ll/ll_memcpydma.h"
namespace f4ll {
diff --git a/lib/ll_usartcore.cpp b/components/f4ll/src/ll_usartcore.cpp
similarity index 99%
rename from lib/ll_usartcore.cpp
rename to components/f4ll/src/ll_usartcore.cpp
index c8bce70..121c33c 100644
--- a/lib/ll_usartcore.cpp
+++ b/components/f4ll/src/ll_usartcore.cpp
@@ -5,7 +5,7 @@
* Author: abody
*/
-#include
+#include "f4ll/ll_usartcore.h"
namespace f4ll {
diff --git a/components/f4ll_c/component.mk b/components/f4ll_c/component.mk
new file mode 100644
index 0000000..06d8f09
--- /dev/null
+++ b/components/f4ll_c/component.mk
@@ -0,0 +1,11 @@
+#encoder
+SELF_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
+REL_DIR := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+ifeq ($(MKDBG), 1)
+ $(info >>> $(REL_DIR)/component.mk)
+endif
+$(eval C_INCLUDES += -I$(REL_DIR)/inc)
+$(eval C_SOURCES += $(wildcard $(REL_DIR)/src/*.c))
+ifeq ($(MKDBG), 1)
+ $(info <<<)
+endif
diff --git a/lib/console_handler.h b/components/f4ll_c/inc/console_handler.h
similarity index 93%
rename from lib/console_handler.h
rename to components/f4ll_c/inc/console_handler.h
index 3e17705..8302e77 100644
--- a/lib/console_handler.h
+++ b/components/f4ll_c/inc/console_handler.h
@@ -9,7 +9,7 @@
#define INTERRUPT_HANDLERS_H_
#include "usart.h"
-#include "dma_helper.h"
+#include "f4ll_c/dma_helper.h"
void HandleConsoleUsartTxDmaIrq(DMAINFO *info, USART_TypeDef *usart);
void HandleConsoleUsartIrq(USART_TypeDef *usart);
diff --git a/lib/crc_handler.h b/components/f4ll_c/inc/crc_handler.h
similarity index 97%
rename from lib/crc_handler.h
rename to components/f4ll_c/inc/crc_handler.h
index 7f88632..a980cce 100644
--- a/lib/crc_handler.h
+++ b/components/f4ll_c/inc/crc_handler.h
@@ -14,7 +14,7 @@
#include "config.h"
#endif // HAVE_CONFIG
-#include
+#include "f4ll_c/dma_helper.h"
#ifndef CRCTASKCOUNT
#define CRCTASKCOUNT 2
diff --git a/lib/dma_helper.h b/components/f4ll_c/inc/dma_helper.h
similarity index 100%
rename from lib/dma_helper.h
rename to components/f4ll_c/inc/dma_helper.h
diff --git a/components/f4ll_c/inc/f4ll_c b/components/f4ll_c/inc/f4ll_c
new file mode 120000
index 0000000..945c9b4
--- /dev/null
+++ b/components/f4ll_c/inc/f4ll_c
@@ -0,0 +1 @@
+.
\ No newline at end of file
diff --git a/lib/memcpy_dma.h b/components/f4ll_c/inc/memcpy_dma.h
similarity index 100%
rename from lib/memcpy_dma.h
rename to components/f4ll_c/inc/memcpy_dma.h
diff --git a/lib/strutil.h b/components/f4ll_c/inc/strutil.h
similarity index 100%
rename from lib/strutil.h
rename to components/f4ll_c/inc/strutil.h
diff --git a/lib/usart_handler.h b/components/f4ll_c/inc/usart_handler.h
similarity index 98%
rename from lib/usart_handler.h
rename to components/f4ll_c/inc/usart_handler.h
index 80b777d..77b3021 100644
--- a/lib/usart_handler.h
+++ b/components/f4ll_c/inc/usart_handler.h
@@ -9,8 +9,8 @@
#define USART_HANDLER_H_
#include
-#include "dma_helper.h"
-#include "crc_handler.h"
+#include "f4ll_c/dma_helper.h"
+#include "f4ll_c/crc_handler.h"
struct _usart_status;
typedef struct _usart_status USARTSTATUS;
diff --git a/lib/console_handler.c b/components/f4ll_c/src/console_handler.c
similarity index 96%
rename from lib/console_handler.c
rename to components/f4ll_c/src/console_handler.c
index a3fa56a..c37eab8 100644
--- a/lib/console_handler.c
+++ b/components/f4ll_c/src/console_handler.c
@@ -6,8 +6,8 @@
*/
#include "main.h"
#include "globals.h"
-#include "usart_handler.h"
-#include "strutil.h"
+#include "f4ll_c/usart_handler.h"
+#include "f4ll_c/strutil.h"
#ifndef DIAG_INTERRUPT_IN
# define DIAG_INTERRUPT_IN()
diff --git a/lib/crc_handler.c b/components/f4ll_c/src/crc_handler.c
similarity index 98%
rename from lib/crc_handler.c
rename to components/f4ll_c/src/crc_handler.c
index 0764702..e6bced4 100644
--- a/lib/crc_handler.c
+++ b/components/f4ll_c/src/crc_handler.c
@@ -6,9 +6,9 @@
*/
#include
#include
-#include "dma_helper.h"
#include "diag.h"
-#include "crc_handler.h"
+#include "f4ll_c/dma_helper.h"
+#include "f4ll_c/crc_handler.h"
#ifndef DIAG_CRC_CALC_START
# define DIAG_CRC_CALC_START()
diff --git a/lib/dma_helper.c b/components/f4ll_c/src/dma_helper.c
similarity index 98%
rename from lib/dma_helper.c
rename to components/f4ll_c/src/dma_helper.c
index 25d91a3..0080e16 100644
--- a/lib/dma_helper.c
+++ b/components/f4ll_c/src/dma_helper.c
@@ -4,7 +4,7 @@
* Created on: Sep 18, 2019
* Author: abody
*/
-#include "dma_helper.h"
+#include "f4ll_c/dma_helper.h"
volatile uint32_t* GetIsReg(DMA_TypeDef *dma, uint32_t stream)
diff --git a/lib/memcpy_dma.c b/components/f4ll_c/src/memcpy_dma.c
similarity index 94%
rename from lib/memcpy_dma.c
rename to components/f4ll_c/src/memcpy_dma.c
index 0c3a654..885357a 100644
--- a/lib/memcpy_dma.c
+++ b/components/f4ll_c/src/memcpy_dma.c
@@ -4,8 +4,8 @@
* Created on: Oct 1, 2019
* Author: abody
*/
-#include "memcpy_dma.h"
-#include "dma_helper.h"
+#include "f4ll_c/memcpy_dma.h"
+#include "f4ll_c/dma_helper.h"
#ifndef DIAG_INTERRUPT_IN
# define DIAG_INTERRUPT_IN()
diff --git a/lib/strutil.c b/components/f4ll_c/src/strutil.c
similarity index 98%
rename from lib/strutil.c
rename to components/f4ll_c/src/strutil.c
index 12c5812..c41e16e 100644
--- a/lib/strutil.c
+++ b/components/f4ll_c/src/strutil.c
@@ -1,5 +1,5 @@
#include
-#include "strutil.h"
+#include "f4ll_c/strutil.h"
//////////////////////////////////////////////////////////////////////////////
size_t strcpy_ex(char *dst, char const *src)
diff --git a/lib/usart_handler.c b/components/f4ll_c/src/usart_handler.c
similarity index 98%
rename from lib/usart_handler.c
rename to components/f4ll_c/src/usart_handler.c
index fcf5dc0..2a0e04b 100644
--- a/lib/usart_handler.c
+++ b/components/f4ll_c/src/usart_handler.c
@@ -8,10 +8,10 @@
#include
#include
#include "diag.h"
-#include "usart_handler.h"
-#include "dma_helper.h"
-#include "crc_handler.h"
-#include "memcpy_dma.h"
+#include "f4ll_c/usart_handler.h"
+#include "f4ll_c/dma_helper.h"
+#include "f4ll_c/crc_handler.h"
+#include "f4ll_c/memcpy_dma.h"
#ifndef DIAG_RX_BUFFER_SWITCH
# define DIAG_RX_BUFFER_SWITCH(x)
diff --git a/lib/StaticList.h b/lib/StaticList.h
deleted file mode 100644
index b0800cd..0000000
--- a/lib/StaticList.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * StaticList.h
- *
- * Created on: Oct 29, 2019
- * Author: abody
- */
-
-#ifndef STATICLIST_H_
-#define STATICLIST_H_
-
-
-
-
-
-#endif /* STATICLIST_H_ */