-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Iliya Iliev <iliyailiev3592@gmail.com>
- Loading branch information
0 parents
commit 1b428eb
Showing
287 changed files
with
229,220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
# ############################################################################## | ||
project(es_client_lib_CM7) | ||
# ############################################################################## | ||
set(EXECUTABLE ${CMAKE_PROJECT_NAME}) | ||
|
||
|
||
enable_language(C CXX ASM) | ||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_C_STANDARD_REQUIRED ON) | ||
set(CMAKE_C_EXTENSIONS ON) | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS ON) | ||
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os") | ||
|
||
# MCU Configs / Linker / Startup | ||
include (${CMAKE_SOURCE_DIR}/cmake/h75x.cmake) | ||
|
||
# Compiler flags | ||
include (${CMAKE_SOURCE_DIR}/cmake/warnings.cmake) | ||
|
||
# HAL | ||
add_subdirectory(libs/STM32H7xx_HAL_Driver ${CMAKE_CURRENT_BINARY_DIR}/HAL) | ||
|
||
# Freertos | ||
add_subdirectory(libs/FreeRTOS ${CMAKE_CURRENT_BINARY_DIR}/FreeRTOS) | ||
|
||
# FATFS | ||
add_subdirectory(libs/FATFS ${CMAKE_CURRENT_BINARY_DIR}/FATFS) | ||
|
||
# Libcsp | ||
add_subdirectory(libs/libcsp ${CMAKE_CURRENT_BINARY_DIR}/csp) | ||
|
||
# ES Client API | ||
add_subdirectory(libs/esclient-api ${CMAKE_CURRENT_BINARY_DIR}/esclient-api) | ||
|
||
# Application specifics | ||
file(GLOB APP_SRC_FILES ${PROJECT_SOURCE_DIR}/app/src/*.c) | ||
add_executable(${EXECUTABLE} ${APP_SRC_FILES} ${STARTUP_SCRIPT}) | ||
|
||
target_include_directories(${EXECUTABLE} | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/app/inc> | ||
) | ||
|
||
include_directories($<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libs/esclient-api/include>) | ||
target_link_libraries(${EXECUTABLE} freertos fatfs stm32h7_hal_driver csp esclient-api) | ||
|
||
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD | ||
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${EXECUTABLE}>) | ||
|
||
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD | ||
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${EXECUTABLE}> | ||
${EXECUTABLE}.hex | ||
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> | ||
${EXECUTABLE}.bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
# Application specifics | ||
file(GLOB APP_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c) | ||
add_executable(${EXECUTABLE} ${APP_SRC_FILES} ${STARTUP_SCRIPT}) | ||
|
||
target_include_directories(${EXECUTABLE} | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc> | ||
) | ||
|
||
include_directories($<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../libs/esclient-api/include>) | ||
target_link_libraries(${EXECUTABLE} freertos fatfs stm32h7_hal_driver csp esclient-api) | ||
|
||
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD | ||
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${EXECUTABLE}>) | ||
|
||
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD | ||
COMMAND ${CMAKE_OBJCOPY} -O ihex $<TARGET_FILE:${EXECUTABLE}> | ||
${EXECUTABLE}.hex | ||
COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${EXECUTABLE}> | ||
${EXECUTABLE}.bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#ifndef FREERTOS_CONFIG_H | ||
#define FREERTOS_CONFIG_H | ||
|
||
/* Ensure definitions are only used by the compiler, and not by the assembler. */ | ||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) | ||
#include <stdint.h> | ||
extern uint32_t SystemCoreClock; | ||
#endif | ||
|
||
#ifndef CMSIS_device_header | ||
#define CMSIS_device_header "stm32h7xx.h" | ||
#endif /* CMSIS_device_header */ | ||
|
||
#define configENABLE_FPU 0 | ||
#define configENABLE_MPU 0 | ||
|
||
#define configUSE_PREEMPTION 1 | ||
#define configSUPPORT_STATIC_ALLOCATION 1 | ||
#define configSUPPORT_DYNAMIC_ALLOCATION 1 | ||
#define configUSE_IDLE_HOOK 0 | ||
#define configUSE_TICK_HOOK 0 | ||
#define configCPU_CLOCK_HZ ( SystemCoreClock ) | ||
#define configTICK_RATE_HZ ((TickType_t)1000) | ||
#define configMAX_PRIORITIES ( 56 ) | ||
#define configMINIMAL_STACK_SIZE ((uint16_t)128*2) | ||
#define configTOTAL_HEAP_SIZE ((size_t)1024*35) | ||
#define configMAX_TASK_NAME_LEN ( 16 ) | ||
#define configUSE_TRACE_FACILITY 1 | ||
#define configUSE_16_BIT_TICKS 0 | ||
#define configUSE_MUTEXES 1 | ||
#define configQUEUE_REGISTRY_SIZE 8 | ||
#define configUSE_RECURSIVE_MUTEXES 1 | ||
#define configUSE_COUNTING_SEMAPHORES 1 | ||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 | ||
#define configMESSAGE_BUFFER_LENGTH_TYPE size_t | ||
|
||
/* Co-routine definitions. */ | ||
#define configUSE_CO_ROUTINES 0 | ||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) | ||
|
||
/* Software timer definitions. */ | ||
#define configUSE_TIMERS 1 | ||
#define configTIMER_TASK_PRIORITY ( 2 ) | ||
#define configTIMER_QUEUE_LENGTH 10 | ||
#define configTIMER_TASK_STACK_DEPTH 256 | ||
|
||
/* CMSIS-RTOS V2 flags */ | ||
#define configUSE_OS2_THREAD_SUSPEND_RESUME 1 | ||
#define configUSE_OS2_THREAD_ENUMERATE 1 | ||
#define configUSE_OS2_EVENTFLAGS_FROM_ISR 1 | ||
#define configUSE_OS2_THREAD_FLAGS 1 | ||
#define configUSE_OS2_TIMER 1 | ||
#define configUSE_OS2_MUTEX 1 | ||
|
||
/* Set the following definitions to 1 to include the API function, or zero | ||
to exclude the API function. */ | ||
#define INCLUDE_vTaskPrioritySet 1 | ||
#define INCLUDE_uxTaskPriorityGet 1 | ||
#define INCLUDE_vTaskDelete 1 | ||
#define INCLUDE_vTaskCleanUpResources 0 | ||
#define INCLUDE_vTaskSuspend 1 | ||
#define INCLUDE_vTaskDelayUntil 1 | ||
#define INCLUDE_vTaskDelay 1 | ||
#define INCLUDE_xTaskGetSchedulerState 1 | ||
#define INCLUDE_xTimerPendFunctionCall 1 | ||
#define INCLUDE_xQueueGetMutexHolder 1 | ||
#define INCLUDE_uxTaskGetStackHighWaterMark 1 | ||
#define INCLUDE_xTaskGetCurrentTaskHandle 1 | ||
#define INCLUDE_eTaskGetState 1 | ||
|
||
/* | ||
* The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used | ||
* by the application thus the correct define need to be enabled below | ||
*/ | ||
#define USE_FreeRTOS_HEAP_4 | ||
|
||
/* Cortex-M specific definitions. */ | ||
#ifdef __NVIC_PRIO_BITS | ||
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ | ||
#define configPRIO_BITS __NVIC_PRIO_BITS | ||
#else | ||
#define configPRIO_BITS 4 | ||
#endif | ||
|
||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 | ||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 | ||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) | ||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) | ||
|
||
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} | ||
|
||
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS | ||
standard names. */ | ||
#define vPortSVCHandler SVC_Handler | ||
#define xPortPendSVHandler PendSV_Handler | ||
|
||
#define USE_CUSTOM_SYSTICK_HANDLER_IMPLEMENTATION 0 | ||
|
||
#endif /* FREERTOS_CONFIG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef _ES_SD_CARD_H_ | ||
#define _ES_SD_CARD_H_ | ||
|
||
#include "fatfs.h" | ||
|
||
/* Definitions for MMC/SDC command */ | ||
#define CMD0 (0x40+0) /* GO_IDLE_STATE */ | ||
#define CMD1 (0x40+1) /* SEND_OP_COND */ | ||
#define CMD8 (0x40+8) /* SEND_IF_COND */ | ||
#define CMD9 (0x40+9) /* SEND_CSD */ | ||
#define CMD10 (0x40+10) /* SEND_CID */ | ||
#define CMD12 (0x40+12) /* STOP_TRANSMISSION */ | ||
#define CMD16 (0x40+16) /* SET_BLOCKLEN */ | ||
#define CMD17 (0x40+17) /* READ_SINGLE_BLOCK */ | ||
#define CMD18 (0x40+18) /* READ_MULTIPLE_BLOCK */ | ||
#define CMD23 (0x40+23) /* SET_BLOCK_COUNT */ | ||
#define CMD24 (0x40+24) /* WRITE_BLOCK */ | ||
#define CMD25 (0x40+25) /* WRITE_MULTIPLE_BLOCK */ | ||
#define CMD41 (0x40+41) /* SEND_OP_COND (ACMD) */ | ||
#define CMD55 (0x40+55) /* APP_CMD */ | ||
#define CMD58 (0x40+58) /* READ_OCR */ | ||
|
||
/* MMC card type flags (MMC_GET_TYPE) */ | ||
#define CT_MMC 0x01 /* MMC ver 3 */ | ||
#define CT_SD1 0x02 /* SD ver 1 */ | ||
#define CT_SD2 0x04 /* SD ver 2 */ | ||
#define CT_SDC 0x06 /* SD */ | ||
#define CT_BLOCK 0x08 /* Block addressing */ | ||
|
||
/* Functions */ | ||
DSTATUS SD_disk_initialize (BYTE pdrv); | ||
DSTATUS SD_disk_status (BYTE pdrv); | ||
DRESULT SD_disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); | ||
DRESULT SD_disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); | ||
DRESULT SD_disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); | ||
|
||
int8_t es_sd_card_fatfs_init(void); | ||
int8_t es_sd_card_mount(void); | ||
int8_t es_sd_card_unmount(void); | ||
|
||
int8_t es_sd_card_test_file_create(const char *name, uint32_t lines); | ||
|
||
#define SPI_TIMEOUT 100 | ||
|
||
extern SPI_HandleTypeDef hspi2; | ||
#define HSPI_SDCARD &hspi2 | ||
#define SD_CS_PORT GPIOB | ||
#define SD_CS_PIN GPIO_PIN_11 | ||
|
||
#endif |
Oops, something went wrong.