Skip to content

Commit

Permalink
Add Lcd display.
Browse files Browse the repository at this point in the history
  • Loading branch information
NobuoTsukamoto committed Jan 31, 2020
1 parent b797321 commit 9d28c7b
Show file tree
Hide file tree
Showing 41 changed files with 1,424 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Expand Up @@ -54,6 +54,7 @@
"xlocnum": "cpp", "xlocnum": "cpp",
"xmemory": "cpp", "xmemory": "cpp",
"xstddef": "cpp", "xstddef": "cpp",
"xtr1common": "cpp" "xtr1common": "cpp",
"global_config.h": "c"
} }
} }
3 changes: 1 addition & 2 deletions CMakeLists.txt
Expand Up @@ -20,7 +20,7 @@ project(${PROJ} C CXX ASM)
# config self use headers # config self use headers
include(./cmake/macros.internal.cmake) include(./cmake/macros.internal.cmake)
header_directories(${SDK_ROOT}/lib) header_directories(${SDK_ROOT}/lib)

header_directories(${SDK_ROOT}/components)


#header_directories(src/${PROJ}) #header_directories(src/${PROJ})
#header_directories(kendryte-standalone-demo/${PROJ}) #header_directories(kendryte-standalone-demo/${PROJ})
Expand All @@ -34,7 +34,6 @@ include_directories(src/micro/tensorflow/tensorflow/lite/micro/tools/make/downlo
# build library first # build library first
add_subdirectory(lib) add_subdirectory(lib)


# add_subdirectory(components)


add_compile_definitions(TF_LITE_USE_GLOBAL_ROUND) add_compile_definitions(TF_LITE_USE_GLOBAL_ROUND)


Expand Down
2 changes: 2 additions & 0 deletions lib/CMakeLists.txt
Expand Up @@ -8,12 +8,14 @@ FILE(GLOB_RECURSE LIB_SRC
"${CMAKE_CURRENT_LIST_DIR}/bsp/*.h" "${CMAKE_CURRENT_LIST_DIR}/bsp/*.h"
"${CMAKE_CURRENT_LIST_DIR}/drivers/*.h" "${CMAKE_CURRENT_LIST_DIR}/drivers/*.h"
"${CMAKE_CURRENT_LIST_DIR}/utils/*.h" "${CMAKE_CURRENT_LIST_DIR}/utils/*.h"
"${CMAKE_CURRENT_LIST_DIR}/components/*.h"
"${CMAKE_CURRENT_LIST_DIR}/bsp/*.hpp" "${CMAKE_CURRENT_LIST_DIR}/bsp/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/drivers/*.hpp" "${CMAKE_CURRENT_LIST_DIR}/drivers/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/utils/*.hpp" "${CMAKE_CURRENT_LIST_DIR}/utils/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/bsp/*.c" "${CMAKE_CURRENT_LIST_DIR}/bsp/*.c"
"${CMAKE_CURRENT_LIST_DIR}/drivers/*.c" "${CMAKE_CURRENT_LIST_DIR}/drivers/*.c"
"${CMAKE_CURRENT_LIST_DIR}/utils/*.c" "${CMAKE_CURRENT_LIST_DIR}/utils/*.c"
"${CMAKE_CURRENT_LIST_DIR}/components/*.c"
"${CMAKE_CURRENT_LIST_DIR}/bsp/*.cpp" "${CMAKE_CURRENT_LIST_DIR}/bsp/*.cpp"
"${CMAKE_CURRENT_LIST_DIR}/drivers/*.cpp" "${CMAKE_CURRENT_LIST_DIR}/drivers/*.cpp"
"${CMAKE_CURRENT_LIST_DIR}/utils/*.cpp" "${CMAKE_CURRENT_LIST_DIR}/utils/*.cpp"
Expand Down
30 changes: 30 additions & 0 deletions lib/components/CMakeLists.txt
@@ -0,0 +1,30 @@
#project(components)

# create driver library
message("CMAKE_CURRENT_LIST_DIR: ${CMAKE_CURRENT_LIST_DIR}")

FILE(GLOB_RECURSE LIB_SRC
"${CMAKE_CURRENT_LIST_DIR}/*.h"
"${CMAKE_CURRENT_LIST_DIR}/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/*.cpp"
"${CMAKE_CURRENT_LIST_DIR}/*.c"
"${CMAKE_CURRENT_LIST_DIR}/*.s"
"${CMAKE_CURRENT_LIST_DIR}/*.S"
)

message("LIB_SRC: ${LIB_SRC}")

FILE(GLOB_RECURSE ASSEMBLY_FILES
"${CMAKE_CURRENT_LIST_DIR}/*.s"
"${CMAKE_CURRENT_LIST_DIR}/*.S"
)

include_directories(${CMAKE_CURRENT_LIST_DIR}/boards/include ${CMAKE_CURRENT_LIST_DIR}/boards/m5stick/include ${CMAKE_CURRENT_LIST_DIR}/config)

SET_PROPERTY(SOURCE ${ASSEMBLY_FILES} PROPERTY LANGUAGE C)
SET_SOURCE_FILES_PROPERTIES(${ASSEMBLY_FILES} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp -D __riscv64")

ADD_LIBRARY(components
${LIB_SRC}
)
SET_TARGET_PROPERTIES(components PROPERTIES LINKER_LANGUAGE C)
13 changes: 13 additions & 0 deletions lib/components/boards/CMakeLists.txt
@@ -0,0 +1,13 @@
if(CONFIG_BOARD_M5STICK)

list(APPEND ADD_INCLUDE "m5stick/include")
aux_source_directory("m5stick/src" ADD_SRCS)
list(APPEND ADD_REQUIREMENTS kendryte_sdk)

endif()

list(APPEND ADD_INCLUDE "include")
aux_source_directory("src" BOARDS_SRCS)
list(APPEND ADD_SRCS ${BOARDS_SRCS})

register_component()
30 changes: 30 additions & 0 deletions lib/components/boards/Kconfig
@@ -0,0 +1,30 @@

menu "Board config"

choice BOARD
bool "Select board"
default BOARD_MAIX
config BOARD_MAIX
bool "Select board Maix"

config BOARD_M5STICK
bool "Select board m5stick"
endchoice

config LCD_DEFAULT_WIDTH
int "LCD default width"
default 320

config LCD_DEFAULT_HEIGHT
int "LCD default height"
default 240

config LCD_DEFAULT_FREQ
int "LCD default driver clock frequency"
default 15000000

config SENSOR_FREQ
int "Sensor clock(xclk) frequency"
default 24000000
endmenu

21 changes: 21 additions & 0 deletions lib/components/boards/include/boards.h
@@ -0,0 +1,21 @@
#ifndef __BOARDS_H
#define __BOARDS_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "global_config.h"

// #define CONFIG_LCD_DEFAULT_FREQ 15000000
// #define CONFIG_LCD_DEFAULT_WIDTH 320
// #define CONFIG_LCD_DEFAULT_HEIGHT 240

extern int boards_init();

#ifdef __cplusplus
}
#endif

#endif //__BOARDS_H

17 changes: 17 additions & 0 deletions lib/components/boards/m5stick/include/m5stick.h
@@ -0,0 +1,17 @@
#ifndef __M5STICK_H
#define __M5STICK_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "stdbool.h"

extern bool m5stick_init();

#ifdef __cplusplus
}
#endif

#endif

13 changes: 13 additions & 0 deletions lib/components/config/global_build_info_time.h
@@ -0,0 +1,13 @@

//compile append define start

#define BUILD_TIME_YEAR 2020
#define BUILD_TIME_MONTH 1
#define BUILD_TIME_DAY 12
#define BUILD_TIME_HOUR 20
#define BUILD_TIME_MINUTE 49
#define BUILD_TIME_SECOND 33
#define BUILD_TIME_WEEK_OF_DAY 6
#define BUILD_TIME_YEAR_OF_DAY 12

//compile append define end
11 changes: 11 additions & 0 deletions lib/components/config/global_build_info_version.h
@@ -0,0 +1,11 @@

//compile append define start

#define BUILD_VERSION_MAJOR 0
#define BUILD_VERSION_MINOR 5
#define BUILD_VERSION_DEV 0
#define BUILD_VERSION_DEV2 12
#define BUILD_GIT_COMMIT_ID "g284ce83d6"
#define BUILD_GIT_IS_DIRTY 0

//compile append define end
23 changes: 23 additions & 0 deletions lib/components/config/global_config.cmake
@@ -0,0 +1,23 @@
# Generated by c_cpp_project_framework(https://github.com/Neutree/c_cpp_project_framework)
### DO NOT edit this file!! ###

set(CONFIG_TOOLCHAIN_PATH "/opt/kendryte-toolchain/bin")
set(CONFIG_TOOLCHAIN_PREFIX "riscv64-unknown-elf-")
set(CONFIG_BOARD_MAIX "y")
set(CONFIG_BOARD_M5STICK "")
set(CONFIG_LCD_DEFAULT_WIDTH "320")
set(CONFIG_LCD_DEFAULT_HEIGHT "240")
set(CONFIG_LCD_DEFAULT_FREQ "15000000")
set(CONFIG_SENSOR_FREQ "24000000")
set(CONFIG_COMPONENT_DRIVERS_ENABLE "")
set(CONFIG_COMPONENT_KENDRYTE_SDK_ENABLE "y")
set(CONFIG_SDK_LOG_LEVEL "5")
set(CONFIG_FREERTOS_ENABLE "y")
set(CONFIG_STATIC_TASK_CLEAN_UP_ENABLE "")
set(CONFIG_FREERTOS_MALLOC_CUSTOM "")
set(CONFIG_FREEROTS_MINIMUM_STACK_SIZE "2048")
set(CONFIG_MIC_ARRAY_ENABLE "")
set(CONFIG_COMPONENT_MICROPYTHON_ENABLE "")
set(CONFIG_COMPONENT_SPIFFS_ENABLE "")
set(CONFIG_COMPONENT_UTILS_ENABLE "")
set(CONFIGS_LIST CONFIG_TOOLCHAIN_PATH;CONFIG_TOOLCHAIN_PREFIX;CONFIG_BOARD_MAIX;CONFIG_BOARD_M5STICK;CONFIG_LCD_DEFAULT_WIDTH;CONFIG_LCD_DEFAULT_HEIGHT;CONFIG_LCD_DEFAULT_FREQ;CONFIG_SENSOR_FREQ;CONFIG_COMPONENT_DRIVERS_ENABLE;CONFIG_COMPONENT_KENDRYTE_SDK_ENABLE;CONFIG_SDK_LOG_LEVEL;CONFIG_FREERTOS_ENABLE;CONFIG_STATIC_TASK_CLEAN_UP_ENABLE;CONFIG_FREERTOS_MALLOC_CUSTOM;CONFIG_FREEROTS_MINIMUM_STACK_SIZE;CONFIG_MIC_ARRAY_ENABLE;CONFIG_COMPONENT_MICROPYTHON_ENABLE;CONFIG_COMPONENT_SPIFFS_ENABLE;CONFIG_COMPONENT_UTILS_ENABLE)
13 changes: 13 additions & 0 deletions lib/components/config/global_config.h
@@ -0,0 +1,13 @@
/* Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib) */
#define CONFIG_TOOLCHAIN_PATH "/opt/kendryte-toolchain/bin"
#define CONFIG_TOOLCHAIN_PREFIX "riscv64-unknown-elf-"
#define CONFIG_BOARD_M5STICK
#define CONFIG_BOARD_MAIX 1
#define CONFIG_LCD_DEFAULT_WIDTH 320
#define CONFIG_LCD_DEFAULT_HEIGHT 240
#define CONFIG_LCD_DEFAULT_FREQ 15000000
#define CONFIG_SENSOR_FREQ 24000000
#define CONFIG_COMPONENT_KENDRYTE_SDK_ENABLE 1
#define CONFIG_SDK_LOG_LEVEL 5
#define CONFIG_FREERTOS_ENABLE 1
#define CONFIG_FREEROTS_MINIMUM_STACK_SIZE 2048
48 changes: 48 additions & 0 deletions lib/components/config/global_config.mk
@@ -0,0 +1,48 @@
# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)

#
# Toolchain configuration
#
CONFIG_TOOLCHAIN_PATH="/opt/kendryte-toolchain/bin"
CONFIG_TOOLCHAIN_PREFIX="riscv64-unknown-elf-"
# end of Toolchain configuration

#
# Components configuration
#

#
# Board config
#
CONFIG_BOARD_MAIX=y
# CONFIG_BOARD_M5STICK is not set
CONFIG_LCD_DEFAULT_WIDTH=320
CONFIG_LCD_DEFAULT_HEIGHT=240
CONFIG_LCD_DEFAULT_FREQ=15000000
CONFIG_SENSOR_FREQ=24000000
# end of Board config

# CONFIG_COMPONENT_DRIVERS_ENABLE is not set
CONFIG_COMPONENT_KENDRYTE_SDK_ENABLE=y

#
# Kendryte SDK configurations
#
CONFIG_SDK_LOG_LEVEL=5
CONFIG_FREERTOS_ENABLE=y

#
# FreeRTOS configurations
#
# CONFIG_STATIC_TASK_CLEAN_UP_ENABLE is not set
# CONFIG_FREERTOS_MALLOC_CUSTOM is not set
CONFIG_FREEROTS_MINIMUM_STACK_SIZE=2048
# end of FreeRTOS configurations

# CONFIG_MIC_ARRAY_ENABLE is not set
# end of Kendryte SDK configurations

# CONFIG_COMPONENT_MICROPYTHON_ENABLE is not set
# CONFIG_COMPONENT_SPIFFS_ENABLE is not set
# CONFIG_COMPONENT_UTILS_ENABLE is not set
# end of Components configuration
34 changes: 34 additions & 0 deletions lib/components/drivers/CMakeLists.txt
@@ -0,0 +1,34 @@
if(CONFIG_COMPONENT_DRIVERS_ENABLE)

list(APPEND ADD_INCLUDE "flash/include"
"joystick/include"
"lcd/include"
"sd_card/include"
)
aux_source_directory("flash/src" FLASH_SRCS)
aux_source_directory("joystick/src" JOYSTICK_SRCS)
aux_source_directory("lcd/src" LCD_SRCS)
aux_source_directory("sd_card/src" SD_CARD_SRCS)

if(CONFIG_WS2812_ENABLE)
list(APPEND ADD_INCLUDE "ws2812/include")
aux_source_directory("ws2812/src" WS2812_SRCS)
list(APPEND ADD_SRCS ${WS2812_SRCS})
endif()
if(CONFIG_HTPA_ENABLE)
list(APPEND ADD_INCLUDE "htpa/include")
aux_source_directory("htpa/src" HTPA_SRCS)
list(APPEND ADD_SRCS ${HTPA_SRCS})
endif()

list(APPEND ADD_SRCS ${FLASH_SRCS}
${JOYSTICK_SRCS}
${LCD_SRCS}
${SD_CARD_SRCS}
)

list(APPEND ADD_REQUIREMENTS kendryte_sdk)

register_component()
endif()

28 changes: 28 additions & 0 deletions lib/components/drivers/Kconfig
@@ -0,0 +1,28 @@


config COMPONENT_DRIVERS_ENABLE
bool "Enbale drivers component"
default n
select COMPONENT_KENDRYTE_SDK_ENABLE

menu "Drivers configuration"
depends on COMPONENT_DRIVERS_ENABLE

menu "SD card"
config SPI_SD_CARD_FORCE_HIGH_SPEED
bool "Force SPI SD card high speed mode"
default y
endmenu

menu "WS2812"
config WS2812_ENABLE
bool "Enbale ws2812 over i2s component"
default n
endmenu
menu "HTPA thermal sensor"
config HTPA_ENABLE
bool "Enbale HTPA thermal sensor"
default n
endmenu
endmenu

0 comments on commit 9d28c7b

Please sign in to comment.