diff --git a/arch/Makefile b/arch/Makefile new file mode 100644 index 00000000..aa7173bd --- /dev/null +++ b/arch/Makefile @@ -0,0 +1,48 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= +ifneq (help,$(findstring help,$(MAKECMDGOALS))) + +ifeq (, $(strip ${BP})) +$(error when compile arch/, must specify BP obviously , see `make help`) +endif + +include ${QTOP}/qmk/board-pack/bp.${BP} + + +ifeq (,$(strip ${ARCH_LSRCS})) +$(error when compile arch/, must specify ARCH_LSRCS on your bp.${BP} , see `make help`) +endif +endif + +# arch src should be specify by bp +LSRCS := $(subst $(QTOP)/arch/,, ${ARCH_LSRCS}) +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/board/Linux_Posix/hello_world/Makefile b/board/Linux_Posix/hello_world/Makefile new file mode 100644 index 00000000..ab86992e --- /dev/null +++ b/board/Linux_Posix/hello_world/Makefile @@ -0,0 +1,50 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +export QTOP + +#################################################################### + + +export BP=Linux_Posix + +TREE_LIB_ENABLE=1 +lib= +subdirs = + + +all:: + make -C ${QTOP}/arch BP=${BP} + make -C ${QTOP}/kernel BP=${BP} + make -C ${QTOP}/osal BP=${BP} + make -C ${QTOP}/net BP=${BP} + make -C ${QTOP}/devices BP=${BP} +exec = +LD_A_FILES += $(LIBDIR)/libarch.a +LD_A_FILES += $(LIBDIR)/libkernel.a +LD_A_FILES += $(LIBDIR)/libhello_world.a +LD_A_FILES += $(LIBDIR)/libcmsis_os.a +LDFLAGS += -lpthread + +include ${QTOP}/qmk/generic/Make.exec + + diff --git a/board/Linux_Posix/hello_world/inc/lwipopts.h b/board/Linux_Posix/hello_world/inc/lwipopts.h new file mode 100644 index 00000000..7e9e2522 --- /dev/null +++ b/board/Linux_Posix/hello_world/inc/lwipopts.h @@ -0,0 +1,236 @@ +/** + ****************************************************************************** + * @file lwipopts.h + * @author MCD Application Team + * @version V1.1.0 + * @date 31-July-2013 + * @brief lwIP Options Configuration. + * This file is based on Utilities\lwip_v1.4.1\src\include\lwip\opt.h + * and contains the lwIP configuration for the STM32F4x7 demonstration. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT 2013 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + +#ifndef __LWIPOPTS_H__ +#define __LWIPOPTS_H__ + +/** + * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain + * critical regions during buffer allocation, deallocation and memory + * allocation and deallocation. + */ +#define SYS_LIGHTWEIGHT_PROT 1 + +/** + * NO_SYS==1: Provides VERY minimal functionality. Otherwise, + * use lwIP facilities. + */ +#define NO_SYS 0 + +/** + * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1 + * Mainly for compatibility to old versions. + */ +#define NO_SYS_NO_TIMERS 0 + +/* ---------- Memory options ---------- */ +/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which + lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 + byte alignment -> define MEM_ALIGNMENT to 2. */ +#define MEM_ALIGNMENT 4 + +/* MEM_SIZE: the size of the heap memory. If the application will send +a lot of data that needs to be copied, this should be set high. */ +#define MEM_SIZE (5 * 1024) + +/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application + sends a lot of data out of ROM (or other static memory), this + should be set high. */ +#define MEMP_NUM_PBUF 25 +/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One + per active UDP "connection". */ +#define MEMP_NUM_UDP_PCB 4 +/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP + connections. */ +#define MEMP_NUM_TCP_PCB 6 +/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP + connections. */ +#define MEMP_NUM_TCP_PCB_LISTEN 6 +/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP + segments. */ +#define MEMP_NUM_TCP_SEG 150 +/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active + timeouts. */ +#define MEMP_NUM_SYS_TIMEOUT 6 + +/* ---------- Pbuf options ---------- */ +/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ +#define PBUF_POOL_SIZE 25 +/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ +#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN) + +/* ---------- TCP options ---------- */ +#define LWIP_TCP 1 +#define TCP_TTL 255 + +/* Controls if TCP should queue segments that arrive out of + order. Define to 0 if your device is low on memory. */ +#define TCP_QUEUE_OOSEQ 0 + +/* TCP Maximum segment size. */ +#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */ + +/* TCP sender buffer space (bytes). */ +#define TCP_SND_BUF (7 * TCP_MSS) + +/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least + as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */ + +#define TCP_SND_QUEUELEN (8 * TCP_SND_BUF / TCP_MSS) + +/* TCP receive window. */ +#define TCP_WND (9 * TCP_MSS) + +/* ---------- ICMP options ---------- */ +#define LWIP_ICMP 1 + +/* ---------- DHCP options ---------- */ +/* Define LWIP_DHCP to 1 if you want DHCP configuration of + interfaces. DHCP is not implemented in lwIP 0.5.1, however, so + turning this on does currently not work. */ +#define LWIP_DHCP 1 + +/* ---------- UDP options ---------- */ +#define LWIP_UDP 1 +#define UDP_TTL 255 + +/* ---------- Statistics options ---------- */ +#define LWIP_STATS 0 +#define LWIP_PROVIDE_ERRNO 1 + +/* ---------- link callback options ---------- */ +/* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface + * whenever the link changes (i.e., link down) + */ +#define LWIP_NETIF_LINK_CALLBACK 0 +/* + -------------------------------------- + ---------- Checksum options ---------- + -------------------------------------- +*/ + +/* +The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware: + - To use this feature let the following define uncommented. + - To disable it and process by CPU comment the the checksum. +*/ +#define CHECKSUM_BY_HARDWARE +//#undef CHECKSUM_BY_HARDWARE + +#ifdef CHECKSUM_BY_HARDWARE +/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/ +#define CHECKSUM_GEN_IP 0 +/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/ +#define CHECKSUM_GEN_UDP 0 +/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/ +#define CHECKSUM_GEN_TCP 0 +/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/ +#define CHECKSUM_CHECK_IP 0 +/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/ +#define CHECKSUM_CHECK_UDP 0 +/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/ +#define CHECKSUM_CHECK_TCP 0 +/* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/ +#define CHECKSUM_GEN_ICMP 0 +#else +/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/ +#define CHECKSUM_GEN_IP 1 +/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/ +#define CHECKSUM_GEN_UDP 1 +/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/ +#define CHECKSUM_GEN_TCP 1 +/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/ +#define CHECKSUM_CHECK_IP 1 +/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/ +#define CHECKSUM_CHECK_UDP 1 +/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/ +#define CHECKSUM_CHECK_TCP 1 +/* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/ +#define CHECKSUM_GEN_ICMP 1 +#endif + +#define LWIP_TCPIP_CORE_LOCKING 1 + +/* + ---------------------------------------------- + ---------- Sequential layer options ---------- + ---------------------------------------------- +*/ +/** + * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) + */ +#define LWIP_NETCONN 1 + +/* + ------------------------------------ + ---------- Socket options ---------- + ------------------------------------ +*/ +/** + * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) + */ +#define LWIP_SOCKET 1 + +/* + --------------------------------- + ---------- OS options ---------- + --------------------------------- +*/ + +#define DEFAULT_UDP_RECVMBOX_SIZE 10 +#define DEFAULT_TCP_RECVMBOX_SIZE 10 +#define DEFAULT_ACCEPTMBOX_SIZE 10 +#define DEFAULT_THREAD_STACKSIZE 1024 * 2 + +#define TCPIP_THREAD_NAME "lwip" +#define TCPIP_THREAD_STACKSIZE 1024 +#define TCPIP_MBOX_SIZE 10 +#define TCPIP_THREAD_PRIO 1 + +#define LWIP_DNS_API_DECLARE_STRUCTS 1 +#define LWIP_DNS 1 + +/** DNS server IP address */ +#ifndef DNS_SERVER_ADDRESS +#define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("208.67.222.222"))) /* resolver1.opendns.com */ +#endif + +/* + ---------------------------------------- + ---------- Lwip Debug options ---------- + ---------------------------------------- +*/ +#define LWIP_DEBUG 0 + +#define ethernet_with_mac 1 + +#endif /* __LWIPOPTS_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/board/Linux_Posix/hello_world/inc/tos_config.h b/board/Linux_Posix/hello_world/inc/tos_config.h index 7cd5e2a9..4c75d6e4 100644 --- a/board/Linux_Posix/hello_world/inc/tos_config.h +++ b/board/Linux_Posix/hello_world/inc/tos_config.h @@ -2,12 +2,13 @@ #define _TOS_CONFIG_H_ #include "stddef.h" +#include "stdint.h" #define TOS_CFG_TASK_PRIO_MAX 10u // 配置TencentOS tiny默认支持的最大优先级数量 #define TOS_CFG_ROUND_ROBIN_EN 1u // 配置TencentOS tiny的内核是否开启时间片轮转 -#define TOS_CFG_OBJECT_VERIFY 0u // 配置TencentOS tiny是否校验指针合法 +#define TOS_CFG_OBJECT_VERIFY_EN 1u // 配置TencentOS tiny是否校验指针合法 #define TOS_CFG_EVENT_EN 1u // TencentOS tiny 事件模块功能宏 @@ -19,8 +20,12 @@ #define TOS_CFG_MUTEX_EN 1u // 配置TencentOS tiny是否开启互斥锁模块 -#define TOS_CFG_QUEUE_EN 1u // 配置TencentOS tiny是否开启队列模块 +#define TOS_CFG_MESSAGE_QUEUE_EN 1u +#define TOS_CFG_MAIL_QUEUE_EN 1u +#define TOS_CFG_PRIORITY_MESSAGE_QUEUE_EN 1u + +#define TOS_CFG_PRIORITY_MAIL_QUEUE_EN 1u #define TOS_CFG_TIMER_EN 1u // 配置TencentOS tiny是否开启软件定时器模块 #define TOS_CFG_SEM_EN 1u // 配置TencentOS tiny是否开启信号量模块 @@ -43,4 +48,4 @@ #define TOS_CFG_TIMER_AS_PROC 1u // 配置是否将TIMER配置成函数模式 -#endif \ No newline at end of file +#endif diff --git a/board/Linux_Posix/mqtt_demo/Makefile b/board/Linux_Posix/mqtt_demo/Makefile new file mode 100644 index 00000000..180951cb --- /dev/null +++ b/board/Linux_Posix/mqtt_demo/Makefile @@ -0,0 +1,58 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +export QTOP + +#################################################################### + + +export BP=Linux_Posix + +TREE_LIB_ENABLE=1 +lib= +subdirs = + +CFGFLAGS += -I$(CUR_DIR)/inc +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper +CFGFLAGS += -I$(QTOP)/components/connectivity/Eclipse-Paho-MQTT/wrapper/include +CFGFLAGS += -I$(QTOP)/components/connectivity/Eclipse-Paho-MQTT/3rdparty/include + +all:: + make -C ${QTOP}/arch BP=Linux_Posix + make -C ${QTOP}/kernel + make -C ${QTOP}/osal + make -C ${QTOP}/net + make -C ${QTOP}/devices + make -C ${QTOP}/components/connectivity/Eclipse-Paho-MQTT + +exec = +LD_A_FILES += $(LIBDIR)/libarch.a +LD_A_FILES += $(LIBDIR)/libkernel.a +LD_A_FILES += $(LIBDIR)/libhello_world.a +LD_A_FILES += $(LIBDIR)/libcmsis_os.a +LD_A_FILES += $(LIBDIR)/libEclipse-Paho-MQTT.a +LD_A_FILES += $(LIBDIR)/libsal_module_wrapper.a +LDFLAGS += -lpthread + +include ${QTOP}/qmk/generic/Make.exec + + diff --git a/board/Linux_Posix/mqtt_demo/inc/mqtt_config.h b/board/Linux_Posix/mqtt_demo/inc/mqtt_config.h index 1e6ae9e4..a9342b76 100644 --- a/board/Linux_Posix/mqtt_demo/inc/mqtt_config.h +++ b/board/Linux_Posix/mqtt_demo/inc/mqtt_config.h @@ -11,7 +11,7 @@ #define MQTT_SUBSCRIBE_TOPIC "$product/$dev/$sub" #define MQTT_PUBLISH_TOPIC "$product/$dev/$pub" -#error please replace yourself server configuration +//#error please replace yourself server configuration /** * 1. run python tool * ``` diff --git a/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/QSPI_FLASH/hal_qspi_flash.c b/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/QSPI_FLASH/hal_qspi_flash.c index d3f7a3a9..b8baa240 100644 --- a/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/QSPI_FLASH/hal_qspi_flash.c +++ b/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/QSPI_FLASH/hal_qspi_flash.c @@ -43,7 +43,7 @@ extern QSPI_HandleTypeDef hqspi; /* This function is called by inner-HAL lib */ -static void HAL_QSPI_MspInit(QSPI_HandleTypeDef* qspiHandle) +void HAL_QSPI_MspInit(QSPI_HandleTypeDef* qspiHandle) { GPIO_InitTypeDef GPIO_InitStruct; @@ -75,7 +75,7 @@ static void HAL_QSPI_MspInit(QSPI_HandleTypeDef* qspiHandle) } /* This function is called by inner-HAL lib */ -static void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* qspiHandle) +void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef* qspiHandle) { if(qspiHandle->Instance==QUADSPI) diff --git a/board/TencentOS_tiny_EVB_MX_Plus/BSP/Makefile b/board/TencentOS_tiny_EVB_MX_Plus/BSP/Makefile new file mode 100644 index 00000000..3939796b --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/BSP/Makefile @@ -0,0 +1,47 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= +ifneq (help,$(findstring help,$(MAKECMDGOALS))) + +ifeq (, $(strip ${BP})) +$(error when compile arch/, must specify BP and BSP_LSRCS obviously , see `make help`) +endif + +include ${QTOP}/qmk/board-pack/bp.${BP} + +ifeq (,$(strip ${BSP_LSRCS})) +$(error when compile arch/, must specify BP and BSP_LSRCS obviously , see `make help`) +endif +endif + +# arch src should be specify by bp +LSRCS := $(sort $(subst $(QTOP)/$(LOCALDIR)/,, ${BSP_LSRCS})) +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/BSP/Src/stm32l4xx_it_evtdrv_module.c b/board/TencentOS_tiny_EVB_MX_Plus/BSP/Src/stm32l4xx_it_evtdrv_module.c index 9ad57024..b6369783 100644 --- a/board/TencentOS_tiny_EVB_MX_Plus/BSP/Src/stm32l4xx_it_evtdrv_module.c +++ b/board/TencentOS_tiny_EVB_MX_Plus/BSP/Src/stm32l4xx_it_evtdrv_module.c @@ -16,6 +16,7 @@ * ****************************************************************************** */ +#if TOS_CFG_EVENT_DRIVEN_EN > 0u /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ @@ -301,3 +302,5 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) } /* USER CODE END 1 */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + +#endif diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/Makefile b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/Makefile new file mode 100644 index 00000000..04989722 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +export BP=TencentOS_tiny_EVB_MX_Plus + +include ${QTOP}/qmk/generic/Make.tpl + + +include ${QTOP}/qmk/generic/Make.subdirs + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/Makefile b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/Makefile new file mode 100644 index 00000000..ea724e38 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/Makefile @@ -0,0 +1,70 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +export QTOP + +#################################################################### + + +export BP=TencentOS_tiny_EVB_MX_Plus + +TREE_LIB_ENABLE=1 +lib= +subdirs = + +LSRCS += $(QTOP)/examples/farm_ai_demo/farm_ai_demo.c +LSRCS += $(wildcard *.s) + +all:: + make -C ${QTOP}/arch BP=${BP} + make -C ${QTOP}/board/TencentOS_tiny_EVB_MX_Plus/BSP BP=${BP} + make -C ${QTOP}/components/connectivity/Eclipse-Paho-MQTT BP=${BP} + make -C ${QTOP}/components/utils/JSON BP=${BP} + make -C ${QTOP}/devices BP=${BP} + make -C ${QTOP}/kernel BP=${BP} + make -C ${QTOP}/net/at BP=${BP} + make -C ${QTOP}/net/sal_module_wrapper BP=${BP} + make -C ${QTOP}/net/socket_wrapper BP=${BP} + make -C ${QTOP}/net/tencent_firmware_module_wrapper BP=${BP} + make -C ${QTOP}/osal BP=${BP} + make -C ${QTOP}/platform BP=${BP} +#exec = +LD_A_FILES += $(LIBDIR)/libarch.a +LD_A_FILES += $(LIBDIR)/libkernel.a +#LD_A_FILES += $(LIBDIR)/lib$(notdir $(CUR_DIR)).a +LD_A_FILES += $(LIBDIR)/libcmsis_os.a +LD_A_FILES += $(LIBDIR)/libhal.a +LD_A_FILES += $(LIBDIR)/libvendor_bsp.a +LD_A_FILES += $(LIBDIR)/libJSON.a +LD_A_FILES += $(LIBDIR)/libBSP.a +LD_A_FILES += $(LIBDIR)/libEclipse-Paho-MQTT.a +LD_A_FILES += $(LIBDIR)/libesp8266_tencent_firmware.a +LD_A_FILES += $(LIBDIR)/libesp8266.a +LD_A_FILES += $(LIBDIR)/libat.a +LD_A_FILES += $(LIBDIR)/libtencent_firmware_module_wrapper.a +LD_A_FILES += $(LIBDIR)/libsal_module_wrapper.a +LD_A_FILES += $(LIBDIR)/libsocket_wrapper.a +LD_A_LISTS += -lc -lm -lnosys +LD_L_LISTS += -specs=nosys.specs -T$(CUR_DIR)/STM32L431RCTx_FLASH.ld -Wl,-Map=$(LIBDIR)/$(notdir $(CUR_DIR)).map,--cref -Wl,--gc-sections +include ${QTOP}/qmk/generic/Make.exec + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/STM32L431RCTx_FLASH.ld b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/STM32L431RCTx_FLASH.ld new file mode 100644 index 00000000..3d07935e --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/STM32L431RCTx_FLASH.ld @@ -0,0 +1,203 @@ +/* +****************************************************************************** +** + +** File : LinkerScript.ld +** +** Author : Auto-generated by Ac6 System Workbench +** +** Abstract : Linker script for STM32L431RCTx series +** 256Kbytes FLASH and 64Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed “as is,” without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20010000; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K +FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(8); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(8); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(8); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(8); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(8); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(8); + } >FLASH + + .ARM.extab : + { + . = ALIGN(8); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(8); + } >FLASH + .ARM : { + . = ALIGN(8); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(8); + } >FLASH + + .preinit_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(8); + } >FLASH + + .init_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(8); + } >FLASH + .fini_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(8); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(8); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(8); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/startup_stm32l431xx.s b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/startup_stm32l431xx.s new file mode 100644 index 00000000..d8f45f45 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_farm_ai_demo/startup_stm32l431xx.s @@ -0,0 +1,474 @@ +/** + ****************************************************************************** + * @file startup_stm32l431xx.s + * @author MCD Application Team + * @brief STM32L431xx devices vector table for GCC toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address, + * - Configure the clock system + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M4 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m4 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + +.equ BootRAM, 0xF1E0F85F +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + ldr sp, =_estack /* Atollic update: set stack pointer */ + +/* Copy the data segment initializers from flash to SRAM */ + movs r1, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r3, =_sidata + ldr r3, [r3, r1] + str r3, [r0, r1] + adds r1, r1, #4 + +LoopCopyDataInit: + ldr r0, =_sdata + ldr r3, =_edata + adds r2, r0, r1 + cmp r2, r3 + bcc CopyDataInit + ldr r2, =_sbss + b LoopFillZerobss +/* Zero fill the bss segment. */ +FillZerobss: + movs r3, #0 + str r3, [r2], #4 + +LoopFillZerobss: + ldr r3, = _ebss + cmp r2, r3 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + +LoopForever: + b LoopForever + +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex-M4. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack + .word Reset_Handler + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + .word WWDG_IRQHandler + .word PVD_PVM_IRQHandler + .word TAMP_STAMP_IRQHandler + .word RTC_WKUP_IRQHandler + .word FLASH_IRQHandler + .word RCC_IRQHandler + .word EXTI0_IRQHandler + .word EXTI1_IRQHandler + .word EXTI2_IRQHandler + .word EXTI3_IRQHandler + .word EXTI4_IRQHandler + .word DMA1_Channel1_IRQHandler + .word DMA1_Channel2_IRQHandler + .word DMA1_Channel3_IRQHandler + .word DMA1_Channel4_IRQHandler + .word DMA1_Channel5_IRQHandler + .word DMA1_Channel6_IRQHandler + .word DMA1_Channel7_IRQHandler + .word ADC1_IRQHandler + .word CAN1_TX_IRQHandler + .word CAN1_RX0_IRQHandler + .word CAN1_RX1_IRQHandler + .word CAN1_SCE_IRQHandler + .word EXTI9_5_IRQHandler + .word TIM1_BRK_TIM15_IRQHandler + .word TIM1_UP_TIM16_IRQHandler + .word TIM1_TRG_COM_IRQHandler + .word TIM1_CC_IRQHandler + .word TIM2_IRQHandler + .word 0 + .word 0 + .word I2C1_EV_IRQHandler + .word I2C1_ER_IRQHandler + .word I2C2_EV_IRQHandler + .word I2C2_ER_IRQHandler + .word SPI1_IRQHandler + .word SPI2_IRQHandler + .word USART1_IRQHandler + .word USART2_IRQHandler + .word USART3_IRQHandler + .word EXTI15_10_IRQHandler + .word RTC_Alarm_IRQHandler + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word SDMMC1_IRQHandler + .word 0 + .word SPI3_IRQHandler + .word 0 + .word 0 + .word TIM6_DAC_IRQHandler + .word TIM7_IRQHandler + .word DMA2_Channel1_IRQHandler + .word DMA2_Channel2_IRQHandler + .word DMA2_Channel3_IRQHandler + .word DMA2_Channel4_IRQHandler + .word DMA2_Channel5_IRQHandler + .word 0 + .word 0 + .word 0 + .word COMP_IRQHandler + .word LPTIM1_IRQHandler + .word LPTIM2_IRQHandler + .word 0 + .word DMA2_Channel6_IRQHandler + .word DMA2_Channel7_IRQHandler + .word LPUART1_IRQHandler + .word QUADSPI_IRQHandler + .word I2C3_EV_IRQHandler + .word I2C3_ER_IRQHandler + .word SAI1_IRQHandler + .word 0 + .word SWPMI1_IRQHandler + .word TSC_IRQHandler + .word 0 + .word 0 + .word RNG_IRQHandler + .word FPU_IRQHandler + .word CRS_IRQHandler + + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_PVM_IRQHandler + .thumb_set PVD_PVM_IRQHandler,Default_Handler + + .weak TAMP_STAMP_IRQHandler + .thumb_set TAMP_STAMP_IRQHandler,Default_Handler + + .weak RTC_WKUP_IRQHandler + .thumb_set RTC_WKUP_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Channel1_IRQHandler + .thumb_set DMA1_Channel1_IRQHandler,Default_Handler + + .weak DMA1_Channel2_IRQHandler + .thumb_set DMA1_Channel2_IRQHandler,Default_Handler + + .weak DMA1_Channel3_IRQHandler + .thumb_set DMA1_Channel3_IRQHandler,Default_Handler + + .weak DMA1_Channel4_IRQHandler + .thumb_set DMA1_Channel4_IRQHandler,Default_Handler + + .weak DMA1_Channel5_IRQHandler + .thumb_set DMA1_Channel5_IRQHandler,Default_Handler + + .weak DMA1_Channel6_IRQHandler + .thumb_set DMA1_Channel6_IRQHandler,Default_Handler + + .weak DMA1_Channel7_IRQHandler + .thumb_set DMA1_Channel7_IRQHandler,Default_Handler + + .weak ADC1_IRQHandler + .thumb_set ADC1_IRQHandler,Default_Handler + + .weak CAN1_TX_IRQHandler + .thumb_set CAN1_TX_IRQHandler,Default_Handler + + .weak CAN1_RX0_IRQHandler + .thumb_set CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_TIM15_IRQHandler + .thumb_set TIM1_BRK_TIM15_IRQHandler,Default_Handler + + .weak TIM1_UP_TIM16_IRQHandler + .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_IRQHandler + .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTC_Alarm_IRQHandler + .thumb_set RTC_Alarm_IRQHandler,Default_Handler + + .weak SDMMC1_IRQHandler + .thumb_set SDMMC1_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak TIM6_DAC_IRQHandler + .thumb_set TIM6_DAC_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Channel1_IRQHandler + .thumb_set DMA2_Channel1_IRQHandler,Default_Handler + + .weak DMA2_Channel2_IRQHandler + .thumb_set DMA2_Channel2_IRQHandler,Default_Handler + + .weak DMA2_Channel3_IRQHandler + .thumb_set DMA2_Channel3_IRQHandler,Default_Handler + + .weak DMA2_Channel4_IRQHandler + .thumb_set DMA2_Channel4_IRQHandler,Default_Handler + + .weak DMA2_Channel5_IRQHandler + .thumb_set DMA2_Channel5_IRQHandler,Default_Handler + + .weak COMP_IRQHandler + .thumb_set COMP_IRQHandler,Default_Handler + + .weak LPTIM1_IRQHandler + .thumb_set LPTIM1_IRQHandler,Default_Handler + + .weak LPTIM2_IRQHandler + .thumb_set LPTIM2_IRQHandler,Default_Handler + + .weak DMA2_Channel6_IRQHandler + .thumb_set DMA2_Channel6_IRQHandler,Default_Handler + + .weak DMA2_Channel7_IRQHandler + .thumb_set DMA2_Channel7_IRQHandler,Default_Handler + + .weak LPUART1_IRQHandler + .thumb_set LPUART1_IRQHandler,Default_Handler + + .weak QUADSPI_IRQHandler + .thumb_set QUADSPI_IRQHandler,Default_Handler + + .weak I2C3_EV_IRQHandler + .thumb_set I2C3_EV_IRQHandler,Default_Handler + + .weak I2C3_ER_IRQHandler + .thumb_set I2C3_ER_IRQHandler,Default_Handler + + .weak SAI1_IRQHandler + .thumb_set SAI1_IRQHandler,Default_Handler + + .weak SWPMI1_IRQHandler + .thumb_set SWPMI1_IRQHandler,Default_Handler + + .weak TSC_IRQHandler + .thumb_set TSC_IRQHandler,Default_Handler + + .weak RNG_IRQHandler + .thumb_set RNG_IRQHandler,Default_Handler + + .weak FPU_IRQHandler + .thumb_set FPU_IRQHandler,Default_Handler + + .weak CRS_IRQHandler + .thumb_set CRS_IRQHandler,Default_Handler +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/Makefile b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/Makefile new file mode 100644 index 00000000..86edb590 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/Makefile @@ -0,0 +1,60 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +export QTOP + +#################################################################### + + +export BP=TencentOS_tiny_EVB_MX_Plus + +TREE_LIB_ENABLE=1 +lib= +subdirs = + +LSRCS += $(QTOP)/examples/hello_world/hello_world.c +LSRCS += $(wildcard *.s) + +all:: + make -C ${QTOP}/arch BP=${BP} + make -C ${QTOP}/board/TencentOS_tiny_EVB_MX_Plus/BSP BP=${BP} + make -C ${QTOP}/components/connectivity/Eclipse-Paho-MQTT BP=${BP} + make -C ${QTOP}/devices BP=${BP} + make -C ${QTOP}/kernel BP=${BP} + make -C ${QTOP}/net/at BP=${BP} + make -C ${QTOP}/net/sal_module_wrapper BP=${BP} + make -C ${QTOP}/net/socket_wrapper BP=${BP} + make -C ${QTOP}/net/tencent_firmware_module_wrapper BP=${BP} + make -C ${QTOP}/osal BP=${BP} + make -C ${QTOP}/platform BP=${BP} +#exec = +LD_A_FILES += $(LIBDIR)/libarch.a +LD_A_FILES += $(LIBDIR)/libkernel.a +#LD_A_FILES += $(LIBDIR)/lib$(notdir $(CUR_DIR)).a +LD_A_FILES += $(LIBDIR)/libcmsis_os.a +LD_A_FILES += $(LIBDIR)/libvendor_bsp.a +LD_A_FILES += $(LIBDIR)/libBSP.a +LD_A_LISTS += -lc -lm -lnosys +LD_L_LISTS += -specs=nosys.specs -T$(CUR_DIR)/STM32L431RCTx_FLASH.ld -Wl,-Map=$(LIBDIR)/$(notdir $(CUR_DIR)).map,--cref -Wl,--gc-sections +include ${QTOP}/qmk/generic/Make.exec + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/STM32L431RCTx_FLASH.ld b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/STM32L431RCTx_FLASH.ld new file mode 100644 index 00000000..3d07935e --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/STM32L431RCTx_FLASH.ld @@ -0,0 +1,203 @@ +/* +****************************************************************************** +** + +** File : LinkerScript.ld +** +** Author : Auto-generated by Ac6 System Workbench +** +** Abstract : Linker script for STM32L431RCTx series +** 256Kbytes FLASH and 64Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed “as is,” without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20010000; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K +FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(8); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(8); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(8); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(8); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(8); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(8); + } >FLASH + + .ARM.extab : + { + . = ALIGN(8); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(8); + } >FLASH + .ARM : { + . = ALIGN(8); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(8); + } >FLASH + + .preinit_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(8); + } >FLASH + + .init_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(8); + } >FLASH + .fini_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(8); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(8); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(8); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/startup_stm32l431xx.s b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/startup_stm32l431xx.s new file mode 100644 index 00000000..d8f45f45 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_hello_world/startup_stm32l431xx.s @@ -0,0 +1,474 @@ +/** + ****************************************************************************** + * @file startup_stm32l431xx.s + * @author MCD Application Team + * @brief STM32L431xx devices vector table for GCC toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address, + * - Configure the clock system + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M4 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m4 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + +.equ BootRAM, 0xF1E0F85F +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + ldr sp, =_estack /* Atollic update: set stack pointer */ + +/* Copy the data segment initializers from flash to SRAM */ + movs r1, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r3, =_sidata + ldr r3, [r3, r1] + str r3, [r0, r1] + adds r1, r1, #4 + +LoopCopyDataInit: + ldr r0, =_sdata + ldr r3, =_edata + adds r2, r0, r1 + cmp r2, r3 + bcc CopyDataInit + ldr r2, =_sbss + b LoopFillZerobss +/* Zero fill the bss segment. */ +FillZerobss: + movs r3, #0 + str r3, [r2], #4 + +LoopFillZerobss: + ldr r3, = _ebss + cmp r2, r3 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + +LoopForever: + b LoopForever + +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex-M4. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack + .word Reset_Handler + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + .word WWDG_IRQHandler + .word PVD_PVM_IRQHandler + .word TAMP_STAMP_IRQHandler + .word RTC_WKUP_IRQHandler + .word FLASH_IRQHandler + .word RCC_IRQHandler + .word EXTI0_IRQHandler + .word EXTI1_IRQHandler + .word EXTI2_IRQHandler + .word EXTI3_IRQHandler + .word EXTI4_IRQHandler + .word DMA1_Channel1_IRQHandler + .word DMA1_Channel2_IRQHandler + .word DMA1_Channel3_IRQHandler + .word DMA1_Channel4_IRQHandler + .word DMA1_Channel5_IRQHandler + .word DMA1_Channel6_IRQHandler + .word DMA1_Channel7_IRQHandler + .word ADC1_IRQHandler + .word CAN1_TX_IRQHandler + .word CAN1_RX0_IRQHandler + .word CAN1_RX1_IRQHandler + .word CAN1_SCE_IRQHandler + .word EXTI9_5_IRQHandler + .word TIM1_BRK_TIM15_IRQHandler + .word TIM1_UP_TIM16_IRQHandler + .word TIM1_TRG_COM_IRQHandler + .word TIM1_CC_IRQHandler + .word TIM2_IRQHandler + .word 0 + .word 0 + .word I2C1_EV_IRQHandler + .word I2C1_ER_IRQHandler + .word I2C2_EV_IRQHandler + .word I2C2_ER_IRQHandler + .word SPI1_IRQHandler + .word SPI2_IRQHandler + .word USART1_IRQHandler + .word USART2_IRQHandler + .word USART3_IRQHandler + .word EXTI15_10_IRQHandler + .word RTC_Alarm_IRQHandler + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word SDMMC1_IRQHandler + .word 0 + .word SPI3_IRQHandler + .word 0 + .word 0 + .word TIM6_DAC_IRQHandler + .word TIM7_IRQHandler + .word DMA2_Channel1_IRQHandler + .word DMA2_Channel2_IRQHandler + .word DMA2_Channel3_IRQHandler + .word DMA2_Channel4_IRQHandler + .word DMA2_Channel5_IRQHandler + .word 0 + .word 0 + .word 0 + .word COMP_IRQHandler + .word LPTIM1_IRQHandler + .word LPTIM2_IRQHandler + .word 0 + .word DMA2_Channel6_IRQHandler + .word DMA2_Channel7_IRQHandler + .word LPUART1_IRQHandler + .word QUADSPI_IRQHandler + .word I2C3_EV_IRQHandler + .word I2C3_ER_IRQHandler + .word SAI1_IRQHandler + .word 0 + .word SWPMI1_IRQHandler + .word TSC_IRQHandler + .word 0 + .word 0 + .word RNG_IRQHandler + .word FPU_IRQHandler + .word CRS_IRQHandler + + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_PVM_IRQHandler + .thumb_set PVD_PVM_IRQHandler,Default_Handler + + .weak TAMP_STAMP_IRQHandler + .thumb_set TAMP_STAMP_IRQHandler,Default_Handler + + .weak RTC_WKUP_IRQHandler + .thumb_set RTC_WKUP_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Channel1_IRQHandler + .thumb_set DMA1_Channel1_IRQHandler,Default_Handler + + .weak DMA1_Channel2_IRQHandler + .thumb_set DMA1_Channel2_IRQHandler,Default_Handler + + .weak DMA1_Channel3_IRQHandler + .thumb_set DMA1_Channel3_IRQHandler,Default_Handler + + .weak DMA1_Channel4_IRQHandler + .thumb_set DMA1_Channel4_IRQHandler,Default_Handler + + .weak DMA1_Channel5_IRQHandler + .thumb_set DMA1_Channel5_IRQHandler,Default_Handler + + .weak DMA1_Channel6_IRQHandler + .thumb_set DMA1_Channel6_IRQHandler,Default_Handler + + .weak DMA1_Channel7_IRQHandler + .thumb_set DMA1_Channel7_IRQHandler,Default_Handler + + .weak ADC1_IRQHandler + .thumb_set ADC1_IRQHandler,Default_Handler + + .weak CAN1_TX_IRQHandler + .thumb_set CAN1_TX_IRQHandler,Default_Handler + + .weak CAN1_RX0_IRQHandler + .thumb_set CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_TIM15_IRQHandler + .thumb_set TIM1_BRK_TIM15_IRQHandler,Default_Handler + + .weak TIM1_UP_TIM16_IRQHandler + .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_IRQHandler + .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTC_Alarm_IRQHandler + .thumb_set RTC_Alarm_IRQHandler,Default_Handler + + .weak SDMMC1_IRQHandler + .thumb_set SDMMC1_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak TIM6_DAC_IRQHandler + .thumb_set TIM6_DAC_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Channel1_IRQHandler + .thumb_set DMA2_Channel1_IRQHandler,Default_Handler + + .weak DMA2_Channel2_IRQHandler + .thumb_set DMA2_Channel2_IRQHandler,Default_Handler + + .weak DMA2_Channel3_IRQHandler + .thumb_set DMA2_Channel3_IRQHandler,Default_Handler + + .weak DMA2_Channel4_IRQHandler + .thumb_set DMA2_Channel4_IRQHandler,Default_Handler + + .weak DMA2_Channel5_IRQHandler + .thumb_set DMA2_Channel5_IRQHandler,Default_Handler + + .weak COMP_IRQHandler + .thumb_set COMP_IRQHandler,Default_Handler + + .weak LPTIM1_IRQHandler + .thumb_set LPTIM1_IRQHandler,Default_Handler + + .weak LPTIM2_IRQHandler + .thumb_set LPTIM2_IRQHandler,Default_Handler + + .weak DMA2_Channel6_IRQHandler + .thumb_set DMA2_Channel6_IRQHandler,Default_Handler + + .weak DMA2_Channel7_IRQHandler + .thumb_set DMA2_Channel7_IRQHandler,Default_Handler + + .weak LPUART1_IRQHandler + .thumb_set LPUART1_IRQHandler,Default_Handler + + .weak QUADSPI_IRQHandler + .thumb_set QUADSPI_IRQHandler,Default_Handler + + .weak I2C3_EV_IRQHandler + .thumb_set I2C3_EV_IRQHandler,Default_Handler + + .weak I2C3_ER_IRQHandler + .thumb_set I2C3_ER_IRQHandler,Default_Handler + + .weak SAI1_IRQHandler + .thumb_set SAI1_IRQHandler,Default_Handler + + .weak SWPMI1_IRQHandler + .thumb_set SWPMI1_IRQHandler,Default_Handler + + .weak TSC_IRQHandler + .thumb_set TSC_IRQHandler,Default_Handler + + .weak RNG_IRQHandler + .thumb_set RNG_IRQHandler,Default_Handler + + .weak FPU_IRQHandler + .thumb_set FPU_IRQHandler,Default_Handler + + .weak CRS_IRQHandler + .thumb_set CRS_IRQHandler,Default_Handler +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/Makefile b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/Makefile new file mode 100644 index 00000000..ac6b094e --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/Makefile @@ -0,0 +1,68 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +export QTOP + +#################################################################### + + +export BP=TencentOS_tiny_EVB_MX_Plus + +TREE_LIB_ENABLE=1 +lib= +subdirs = + +LSRCS += $(QTOP)/examples/tencent_os_mqtt/mqtt_example.c +LSRCS += $(wildcard *.s) + +all:: + make -C ${QTOP}/arch BP=${BP} + make -C ${QTOP}/board/TencentOS_tiny_EVB_MX_Plus/BSP BP=${BP} + make -C ${QTOP}/components/connectivity/Eclipse-Paho-MQTT BP=${BP} + make -C ${QTOP}/devices BP=${BP} + make -C ${QTOP}/kernel BP=${BP} + make -C ${QTOP}/net/at BP=${BP} + make -C ${QTOP}/net/sal_module_wrapper BP=${BP} + make -C ${QTOP}/net/socket_wrapper BP=${BP} + make -C ${QTOP}/net/tencent_firmware_module_wrapper BP=${BP} + make -C ${QTOP}/osal BP=${BP} + make -C ${QTOP}/platform BP=${BP} +#exec = +LD_A_FILES += $(LIBDIR)/libarch.a +LD_A_FILES += $(LIBDIR)/libkernel.a +LD_A_FILES += $(LIBDIR)/lib$(notdir $(CUR_DIR)).a +LD_A_FILES += $(LIBDIR)/libcmsis_os.a +LD_A_FILES += $(LIBDIR)/libvendor_bsp.a +LD_A_FILES += $(LIBDIR)/libhal.a +LD_A_FILES += $(LIBDIR)/libBSP.a +LD_A_FILES += $(LIBDIR)/libEclipse-Paho-MQTT.a +LD_A_FILES += $(LIBDIR)/libesp8266_tencent_firmware.a +LD_A_FILES += $(LIBDIR)/libesp8266.a +LD_A_FILES += $(LIBDIR)/libat.a +LD_A_FILES += $(LIBDIR)/libtencent_firmware_module_wrapper.a +LD_A_FILES += $(LIBDIR)/libsal_module_wrapper.a +LD_A_FILES += $(LIBDIR)/libsocket_wrapper.a +LD_A_LISTS += -lc -lm -lnosys +LD_L_LISTS += -specs=nosys.specs -T$(CUR_DIR)/STM32L431RCTx_FLASH.ld -Wl,-Map=$(LIBDIR)/$(notdir $(CUR_DIR)).map,--cref -Wl,--gc-sections +include ${QTOP}/qmk/generic/Make.exec + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/STM32L431RCTx_FLASH.ld b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/STM32L431RCTx_FLASH.ld new file mode 100644 index 00000000..3d07935e --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/STM32L431RCTx_FLASH.ld @@ -0,0 +1,203 @@ +/* +****************************************************************************** +** + +** File : LinkerScript.ld +** +** Author : Auto-generated by Ac6 System Workbench +** +** Abstract : Linker script for STM32L431RCTx series +** 256Kbytes FLASH and 64Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed “as is,” without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20010000; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K +FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(8); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(8); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(8); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(8); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(8); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(8); + } >FLASH + + .ARM.extab : + { + . = ALIGN(8); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(8); + } >FLASH + .ARM : { + . = ALIGN(8); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(8); + } >FLASH + + .preinit_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(8); + } >FLASH + + .init_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(8); + } >FLASH + .fini_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(8); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(8); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(8); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/startup_stm32l431xx.s b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/startup_stm32l431xx.s new file mode 100644 index 00000000..d8f45f45 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/startup_stm32l431xx.s @@ -0,0 +1,474 @@ +/** + ****************************************************************************** + * @file startup_stm32l431xx.s + * @author MCD Application Team + * @brief STM32L431xx devices vector table for GCC toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address, + * - Configure the clock system + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M4 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m4 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + +.equ BootRAM, 0xF1E0F85F +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + ldr sp, =_estack /* Atollic update: set stack pointer */ + +/* Copy the data segment initializers from flash to SRAM */ + movs r1, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r3, =_sidata + ldr r3, [r3, r1] + str r3, [r0, r1] + adds r1, r1, #4 + +LoopCopyDataInit: + ldr r0, =_sdata + ldr r3, =_edata + adds r2, r0, r1 + cmp r2, r3 + bcc CopyDataInit + ldr r2, =_sbss + b LoopFillZerobss +/* Zero fill the bss segment. */ +FillZerobss: + movs r3, #0 + str r3, [r2], #4 + +LoopFillZerobss: + ldr r3, = _ebss + cmp r2, r3 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + +LoopForever: + b LoopForever + +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex-M4. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack + .word Reset_Handler + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + .word WWDG_IRQHandler + .word PVD_PVM_IRQHandler + .word TAMP_STAMP_IRQHandler + .word RTC_WKUP_IRQHandler + .word FLASH_IRQHandler + .word RCC_IRQHandler + .word EXTI0_IRQHandler + .word EXTI1_IRQHandler + .word EXTI2_IRQHandler + .word EXTI3_IRQHandler + .word EXTI4_IRQHandler + .word DMA1_Channel1_IRQHandler + .word DMA1_Channel2_IRQHandler + .word DMA1_Channel3_IRQHandler + .word DMA1_Channel4_IRQHandler + .word DMA1_Channel5_IRQHandler + .word DMA1_Channel6_IRQHandler + .word DMA1_Channel7_IRQHandler + .word ADC1_IRQHandler + .word CAN1_TX_IRQHandler + .word CAN1_RX0_IRQHandler + .word CAN1_RX1_IRQHandler + .word CAN1_SCE_IRQHandler + .word EXTI9_5_IRQHandler + .word TIM1_BRK_TIM15_IRQHandler + .word TIM1_UP_TIM16_IRQHandler + .word TIM1_TRG_COM_IRQHandler + .word TIM1_CC_IRQHandler + .word TIM2_IRQHandler + .word 0 + .word 0 + .word I2C1_EV_IRQHandler + .word I2C1_ER_IRQHandler + .word I2C2_EV_IRQHandler + .word I2C2_ER_IRQHandler + .word SPI1_IRQHandler + .word SPI2_IRQHandler + .word USART1_IRQHandler + .word USART2_IRQHandler + .word USART3_IRQHandler + .word EXTI15_10_IRQHandler + .word RTC_Alarm_IRQHandler + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word SDMMC1_IRQHandler + .word 0 + .word SPI3_IRQHandler + .word 0 + .word 0 + .word TIM6_DAC_IRQHandler + .word TIM7_IRQHandler + .word DMA2_Channel1_IRQHandler + .word DMA2_Channel2_IRQHandler + .word DMA2_Channel3_IRQHandler + .word DMA2_Channel4_IRQHandler + .word DMA2_Channel5_IRQHandler + .word 0 + .word 0 + .word 0 + .word COMP_IRQHandler + .word LPTIM1_IRQHandler + .word LPTIM2_IRQHandler + .word 0 + .word DMA2_Channel6_IRQHandler + .word DMA2_Channel7_IRQHandler + .word LPUART1_IRQHandler + .word QUADSPI_IRQHandler + .word I2C3_EV_IRQHandler + .word I2C3_ER_IRQHandler + .word SAI1_IRQHandler + .word 0 + .word SWPMI1_IRQHandler + .word TSC_IRQHandler + .word 0 + .word 0 + .word RNG_IRQHandler + .word FPU_IRQHandler + .word CRS_IRQHandler + + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_PVM_IRQHandler + .thumb_set PVD_PVM_IRQHandler,Default_Handler + + .weak TAMP_STAMP_IRQHandler + .thumb_set TAMP_STAMP_IRQHandler,Default_Handler + + .weak RTC_WKUP_IRQHandler + .thumb_set RTC_WKUP_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Channel1_IRQHandler + .thumb_set DMA1_Channel1_IRQHandler,Default_Handler + + .weak DMA1_Channel2_IRQHandler + .thumb_set DMA1_Channel2_IRQHandler,Default_Handler + + .weak DMA1_Channel3_IRQHandler + .thumb_set DMA1_Channel3_IRQHandler,Default_Handler + + .weak DMA1_Channel4_IRQHandler + .thumb_set DMA1_Channel4_IRQHandler,Default_Handler + + .weak DMA1_Channel5_IRQHandler + .thumb_set DMA1_Channel5_IRQHandler,Default_Handler + + .weak DMA1_Channel6_IRQHandler + .thumb_set DMA1_Channel6_IRQHandler,Default_Handler + + .weak DMA1_Channel7_IRQHandler + .thumb_set DMA1_Channel7_IRQHandler,Default_Handler + + .weak ADC1_IRQHandler + .thumb_set ADC1_IRQHandler,Default_Handler + + .weak CAN1_TX_IRQHandler + .thumb_set CAN1_TX_IRQHandler,Default_Handler + + .weak CAN1_RX0_IRQHandler + .thumb_set CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_TIM15_IRQHandler + .thumb_set TIM1_BRK_TIM15_IRQHandler,Default_Handler + + .weak TIM1_UP_TIM16_IRQHandler + .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_IRQHandler + .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTC_Alarm_IRQHandler + .thumb_set RTC_Alarm_IRQHandler,Default_Handler + + .weak SDMMC1_IRQHandler + .thumb_set SDMMC1_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak TIM6_DAC_IRQHandler + .thumb_set TIM6_DAC_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Channel1_IRQHandler + .thumb_set DMA2_Channel1_IRQHandler,Default_Handler + + .weak DMA2_Channel2_IRQHandler + .thumb_set DMA2_Channel2_IRQHandler,Default_Handler + + .weak DMA2_Channel3_IRQHandler + .thumb_set DMA2_Channel3_IRQHandler,Default_Handler + + .weak DMA2_Channel4_IRQHandler + .thumb_set DMA2_Channel4_IRQHandler,Default_Handler + + .weak DMA2_Channel5_IRQHandler + .thumb_set DMA2_Channel5_IRQHandler,Default_Handler + + .weak COMP_IRQHandler + .thumb_set COMP_IRQHandler,Default_Handler + + .weak LPTIM1_IRQHandler + .thumb_set LPTIM1_IRQHandler,Default_Handler + + .weak LPTIM2_IRQHandler + .thumb_set LPTIM2_IRQHandler,Default_Handler + + .weak DMA2_Channel6_IRQHandler + .thumb_set DMA2_Channel6_IRQHandler,Default_Handler + + .weak DMA2_Channel7_IRQHandler + .thumb_set DMA2_Channel7_IRQHandler,Default_Handler + + .weak LPUART1_IRQHandler + .thumb_set LPUART1_IRQHandler,Default_Handler + + .weak QUADSPI_IRQHandler + .thumb_set QUADSPI_IRQHandler,Default_Handler + + .weak I2C3_EV_IRQHandler + .thumb_set I2C3_EV_IRQHandler,Default_Handler + + .weak I2C3_ER_IRQHandler + .thumb_set I2C3_ER_IRQHandler,Default_Handler + + .weak SAI1_IRQHandler + .thumb_set SAI1_IRQHandler,Default_Handler + + .weak SWPMI1_IRQHandler + .thumb_set SWPMI1_IRQHandler,Default_Handler + + .weak TSC_IRQHandler + .thumb_set TSC_IRQHandler,Default_Handler + + .weak RNG_IRQHandler + .thumb_set RNG_IRQHandler,Default_Handler + + .weak FPU_IRQHandler + .thumb_set FPU_IRQHandler,Default_Handler + + .weak CRS_IRQHandler + .thumb_set CRS_IRQHandler,Default_Handler +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/Makefile b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/Makefile new file mode 100644 index 00000000..66110ac5 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/Makefile @@ -0,0 +1,68 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +export QTOP + +#################################################################### + + +export BP=TencentOS_tiny_EVB_MX_Plus + +TREE_LIB_ENABLE=1 +lib= +subdirs = + +LSRCS += $(QTOP)/examples/udp_through_module/udp_through_module.c +LSRCS += $(wildcard *.s) + +all:: + make -C ${QTOP}/arch BP=${BP} + make -C ${QTOP}/board/TencentOS_tiny_EVB_MX_Plus/BSP BP=${BP} + make -C ${QTOP}/components/connectivity/Eclipse-Paho-MQTT BP=${BP} + make -C ${QTOP}/devices BP=${BP} + make -C ${QTOP}/kernel BP=${BP} + make -C ${QTOP}/net/at BP=${BP} + make -C ${QTOP}/net/sal_module_wrapper BP=${BP} + make -C ${QTOP}/net/socket_wrapper BP=${BP} + make -C ${QTOP}/net/tencent_firmware_module_wrapper BP=${BP} + make -C ${QTOP}/osal BP=${BP} + make -C ${QTOP}/platform BP=${BP} +#exec = +LD_A_FILES += $(LIBDIR)/libarch.a +LD_A_FILES += $(LIBDIR)/libkernel.a +LD_A_FILES += $(LIBDIR)/lib$(notdir $(CUR_DIR)).a +LD_A_FILES += $(LIBDIR)/libcmsis_os.a +LD_A_FILES += $(LIBDIR)/libvendor_bsp.a +LD_A_FILES += $(LIBDIR)/libhal.a +LD_A_FILES += $(LIBDIR)/libBSP.a +LD_A_FILES += $(LIBDIR)/libEclipse-Paho-MQTT.a +LD_A_FILES += $(LIBDIR)/libesp8266_tencent_firmware.a +LD_A_FILES += $(LIBDIR)/libesp8266.a +LD_A_FILES += $(LIBDIR)/libat.a +LD_A_FILES += $(LIBDIR)/libtencent_firmware_module_wrapper.a +LD_A_FILES += $(LIBDIR)/libsal_module_wrapper.a +LD_A_FILES += $(LIBDIR)/libsocket_wrapper.a +LD_A_LISTS += -lc -lm -lnosys +LD_L_LISTS += -specs=nosys.specs -T$(CUR_DIR)/STM32L431RCTx_FLASH.ld -Wl,-Map=$(LIBDIR)/$(notdir $(CUR_DIR)).map,--cref -Wl,--gc-sections +include ${QTOP}/qmk/generic/Make.exec + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/STM32L431RCTx_FLASH.ld b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/STM32L431RCTx_FLASH.ld new file mode 100644 index 00000000..3d07935e --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/STM32L431RCTx_FLASH.ld @@ -0,0 +1,203 @@ +/* +****************************************************************************** +** + +** File : LinkerScript.ld +** +** Author : Auto-generated by Ac6 System Workbench +** +** Abstract : Linker script for STM32L431RCTx series +** 256Kbytes FLASH and 64Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed “as is,” without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2014 Ac6

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of Ac6 nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = 0x20010000; /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K +FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(8); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(8); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(8); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(8); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(8); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(8); + } >FLASH + + .ARM.extab : + { + . = ALIGN(8); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(8); + } >FLASH + .ARM : { + . = ALIGN(8); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(8); + } >FLASH + + .preinit_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(8); + } >FLASH + + .init_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(8); + } >FLASH + .fini_array : + { + . = ALIGN(8); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(8); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(8); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(8); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/startup_stm32l431xx.s b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/startup_stm32l431xx.s new file mode 100644 index 00000000..d8f45f45 --- /dev/null +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_udp_through_module/startup_stm32l431xx.s @@ -0,0 +1,474 @@ +/** + ****************************************************************************** + * @file startup_stm32l431xx.s + * @author MCD Application Team + * @brief STM32L431xx devices vector table for GCC toolchain. + * This module performs: + * - Set the initial SP + * - Set the initial PC == Reset_Handler, + * - Set the vector table entries with the exceptions ISR address, + * - Configure the clock system + * - Branches to main in the C library (which eventually + * calls main()). + * After Reset the Cortex-M4 processor is in Thread mode, + * priority is Privileged, and the Stack is set to Main. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + + .syntax unified + .cpu cortex-m4 + .fpu softvfp + .thumb + +.global g_pfnVectors +.global Default_Handler + +/* start address for the initialization values of the .data section. +defined in linker script */ +.word _sidata +/* start address for the .data section. defined in linker script */ +.word _sdata +/* end address for the .data section. defined in linker script */ +.word _edata +/* start address for the .bss section. defined in linker script */ +.word _sbss +/* end address for the .bss section. defined in linker script */ +.word _ebss + +.equ BootRAM, 0xF1E0F85F +/** + * @brief This is the code that gets called when the processor first + * starts execution following a reset event. Only the absolutely + * necessary set is performed, after which the application + * supplied main() routine is called. + * @param None + * @retval : None +*/ + + .section .text.Reset_Handler + .weak Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + ldr sp, =_estack /* Atollic update: set stack pointer */ + +/* Copy the data segment initializers from flash to SRAM */ + movs r1, #0 + b LoopCopyDataInit + +CopyDataInit: + ldr r3, =_sidata + ldr r3, [r3, r1] + str r3, [r0, r1] + adds r1, r1, #4 + +LoopCopyDataInit: + ldr r0, =_sdata + ldr r3, =_edata + adds r2, r0, r1 + cmp r2, r3 + bcc CopyDataInit + ldr r2, =_sbss + b LoopFillZerobss +/* Zero fill the bss segment. */ +FillZerobss: + movs r3, #0 + str r3, [r2], #4 + +LoopFillZerobss: + ldr r3, = _ebss + cmp r2, r3 + bcc FillZerobss + +/* Call the clock system intitialization function.*/ + bl SystemInit +/* Call static constructors */ + bl __libc_init_array +/* Call the application's entry point.*/ + bl main + +LoopForever: + b LoopForever + +.size Reset_Handler, .-Reset_Handler + +/** + * @brief This is the code that gets called when the processor receives an + * unexpected interrupt. This simply enters an infinite loop, preserving + * the system state for examination by a debugger. + * + * @param None + * @retval : None +*/ + .section .text.Default_Handler,"ax",%progbits +Default_Handler: +Infinite_Loop: + b Infinite_Loop + .size Default_Handler, .-Default_Handler +/****************************************************************************** +* +* The minimal vector table for a Cortex-M4. Note that the proper constructs +* must be placed on this to ensure that it ends up at physical address +* 0x0000.0000. +* +******************************************************************************/ + .section .isr_vector,"a",%progbits + .type g_pfnVectors, %object + .size g_pfnVectors, .-g_pfnVectors + + +g_pfnVectors: + .word _estack + .word Reset_Handler + .word NMI_Handler + .word HardFault_Handler + .word MemManage_Handler + .word BusFault_Handler + .word UsageFault_Handler + .word 0 + .word 0 + .word 0 + .word 0 + .word SVC_Handler + .word DebugMon_Handler + .word 0 + .word PendSV_Handler + .word SysTick_Handler + .word WWDG_IRQHandler + .word PVD_PVM_IRQHandler + .word TAMP_STAMP_IRQHandler + .word RTC_WKUP_IRQHandler + .word FLASH_IRQHandler + .word RCC_IRQHandler + .word EXTI0_IRQHandler + .word EXTI1_IRQHandler + .word EXTI2_IRQHandler + .word EXTI3_IRQHandler + .word EXTI4_IRQHandler + .word DMA1_Channel1_IRQHandler + .word DMA1_Channel2_IRQHandler + .word DMA1_Channel3_IRQHandler + .word DMA1_Channel4_IRQHandler + .word DMA1_Channel5_IRQHandler + .word DMA1_Channel6_IRQHandler + .word DMA1_Channel7_IRQHandler + .word ADC1_IRQHandler + .word CAN1_TX_IRQHandler + .word CAN1_RX0_IRQHandler + .word CAN1_RX1_IRQHandler + .word CAN1_SCE_IRQHandler + .word EXTI9_5_IRQHandler + .word TIM1_BRK_TIM15_IRQHandler + .word TIM1_UP_TIM16_IRQHandler + .word TIM1_TRG_COM_IRQHandler + .word TIM1_CC_IRQHandler + .word TIM2_IRQHandler + .word 0 + .word 0 + .word I2C1_EV_IRQHandler + .word I2C1_ER_IRQHandler + .word I2C2_EV_IRQHandler + .word I2C2_ER_IRQHandler + .word SPI1_IRQHandler + .word SPI2_IRQHandler + .word USART1_IRQHandler + .word USART2_IRQHandler + .word USART3_IRQHandler + .word EXTI15_10_IRQHandler + .word RTC_Alarm_IRQHandler + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word 0 + .word SDMMC1_IRQHandler + .word 0 + .word SPI3_IRQHandler + .word 0 + .word 0 + .word TIM6_DAC_IRQHandler + .word TIM7_IRQHandler + .word DMA2_Channel1_IRQHandler + .word DMA2_Channel2_IRQHandler + .word DMA2_Channel3_IRQHandler + .word DMA2_Channel4_IRQHandler + .word DMA2_Channel5_IRQHandler + .word 0 + .word 0 + .word 0 + .word COMP_IRQHandler + .word LPTIM1_IRQHandler + .word LPTIM2_IRQHandler + .word 0 + .word DMA2_Channel6_IRQHandler + .word DMA2_Channel7_IRQHandler + .word LPUART1_IRQHandler + .word QUADSPI_IRQHandler + .word I2C3_EV_IRQHandler + .word I2C3_ER_IRQHandler + .word SAI1_IRQHandler + .word 0 + .word SWPMI1_IRQHandler + .word TSC_IRQHandler + .word 0 + .word 0 + .word RNG_IRQHandler + .word FPU_IRQHandler + .word CRS_IRQHandler + + +/******************************************************************************* +* +* Provide weak aliases for each Exception handler to the Default_Handler. +* As they are weak aliases, any function with the same name will override +* this definition. +* +*******************************************************************************/ + + .weak NMI_Handler + .thumb_set NMI_Handler,Default_Handler + + .weak HardFault_Handler + .thumb_set HardFault_Handler,Default_Handler + + .weak MemManage_Handler + .thumb_set MemManage_Handler,Default_Handler + + .weak BusFault_Handler + .thumb_set BusFault_Handler,Default_Handler + + .weak UsageFault_Handler + .thumb_set UsageFault_Handler,Default_Handler + + .weak SVC_Handler + .thumb_set SVC_Handler,Default_Handler + + .weak DebugMon_Handler + .thumb_set DebugMon_Handler,Default_Handler + + .weak PendSV_Handler + .thumb_set PendSV_Handler,Default_Handler + + .weak SysTick_Handler + .thumb_set SysTick_Handler,Default_Handler + + .weak WWDG_IRQHandler + .thumb_set WWDG_IRQHandler,Default_Handler + + .weak PVD_PVM_IRQHandler + .thumb_set PVD_PVM_IRQHandler,Default_Handler + + .weak TAMP_STAMP_IRQHandler + .thumb_set TAMP_STAMP_IRQHandler,Default_Handler + + .weak RTC_WKUP_IRQHandler + .thumb_set RTC_WKUP_IRQHandler,Default_Handler + + .weak FLASH_IRQHandler + .thumb_set FLASH_IRQHandler,Default_Handler + + .weak RCC_IRQHandler + .thumb_set RCC_IRQHandler,Default_Handler + + .weak EXTI0_IRQHandler + .thumb_set EXTI0_IRQHandler,Default_Handler + + .weak EXTI1_IRQHandler + .thumb_set EXTI1_IRQHandler,Default_Handler + + .weak EXTI2_IRQHandler + .thumb_set EXTI2_IRQHandler,Default_Handler + + .weak EXTI3_IRQHandler + .thumb_set EXTI3_IRQHandler,Default_Handler + + .weak EXTI4_IRQHandler + .thumb_set EXTI4_IRQHandler,Default_Handler + + .weak DMA1_Channel1_IRQHandler + .thumb_set DMA1_Channel1_IRQHandler,Default_Handler + + .weak DMA1_Channel2_IRQHandler + .thumb_set DMA1_Channel2_IRQHandler,Default_Handler + + .weak DMA1_Channel3_IRQHandler + .thumb_set DMA1_Channel3_IRQHandler,Default_Handler + + .weak DMA1_Channel4_IRQHandler + .thumb_set DMA1_Channel4_IRQHandler,Default_Handler + + .weak DMA1_Channel5_IRQHandler + .thumb_set DMA1_Channel5_IRQHandler,Default_Handler + + .weak DMA1_Channel6_IRQHandler + .thumb_set DMA1_Channel6_IRQHandler,Default_Handler + + .weak DMA1_Channel7_IRQHandler + .thumb_set DMA1_Channel7_IRQHandler,Default_Handler + + .weak ADC1_IRQHandler + .thumb_set ADC1_IRQHandler,Default_Handler + + .weak CAN1_TX_IRQHandler + .thumb_set CAN1_TX_IRQHandler,Default_Handler + + .weak CAN1_RX0_IRQHandler + .thumb_set CAN1_RX0_IRQHandler,Default_Handler + + .weak CAN1_RX1_IRQHandler + .thumb_set CAN1_RX1_IRQHandler,Default_Handler + + .weak CAN1_SCE_IRQHandler + .thumb_set CAN1_SCE_IRQHandler,Default_Handler + + .weak EXTI9_5_IRQHandler + .thumb_set EXTI9_5_IRQHandler,Default_Handler + + .weak TIM1_BRK_TIM15_IRQHandler + .thumb_set TIM1_BRK_TIM15_IRQHandler,Default_Handler + + .weak TIM1_UP_TIM16_IRQHandler + .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler + + .weak TIM1_TRG_COM_IRQHandler + .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler + + .weak TIM1_CC_IRQHandler + .thumb_set TIM1_CC_IRQHandler,Default_Handler + + .weak TIM2_IRQHandler + .thumb_set TIM2_IRQHandler,Default_Handler + + .weak I2C1_EV_IRQHandler + .thumb_set I2C1_EV_IRQHandler,Default_Handler + + .weak I2C1_ER_IRQHandler + .thumb_set I2C1_ER_IRQHandler,Default_Handler + + .weak I2C2_EV_IRQHandler + .thumb_set I2C2_EV_IRQHandler,Default_Handler + + .weak I2C2_ER_IRQHandler + .thumb_set I2C2_ER_IRQHandler,Default_Handler + + .weak SPI1_IRQHandler + .thumb_set SPI1_IRQHandler,Default_Handler + + .weak SPI2_IRQHandler + .thumb_set SPI2_IRQHandler,Default_Handler + + .weak USART1_IRQHandler + .thumb_set USART1_IRQHandler,Default_Handler + + .weak USART2_IRQHandler + .thumb_set USART2_IRQHandler,Default_Handler + + .weak USART3_IRQHandler + .thumb_set USART3_IRQHandler,Default_Handler + + .weak EXTI15_10_IRQHandler + .thumb_set EXTI15_10_IRQHandler,Default_Handler + + .weak RTC_Alarm_IRQHandler + .thumb_set RTC_Alarm_IRQHandler,Default_Handler + + .weak SDMMC1_IRQHandler + .thumb_set SDMMC1_IRQHandler,Default_Handler + + .weak SPI3_IRQHandler + .thumb_set SPI3_IRQHandler,Default_Handler + + .weak TIM6_DAC_IRQHandler + .thumb_set TIM6_DAC_IRQHandler,Default_Handler + + .weak TIM7_IRQHandler + .thumb_set TIM7_IRQHandler,Default_Handler + + .weak DMA2_Channel1_IRQHandler + .thumb_set DMA2_Channel1_IRQHandler,Default_Handler + + .weak DMA2_Channel2_IRQHandler + .thumb_set DMA2_Channel2_IRQHandler,Default_Handler + + .weak DMA2_Channel3_IRQHandler + .thumb_set DMA2_Channel3_IRQHandler,Default_Handler + + .weak DMA2_Channel4_IRQHandler + .thumb_set DMA2_Channel4_IRQHandler,Default_Handler + + .weak DMA2_Channel5_IRQHandler + .thumb_set DMA2_Channel5_IRQHandler,Default_Handler + + .weak COMP_IRQHandler + .thumb_set COMP_IRQHandler,Default_Handler + + .weak LPTIM1_IRQHandler + .thumb_set LPTIM1_IRQHandler,Default_Handler + + .weak LPTIM2_IRQHandler + .thumb_set LPTIM2_IRQHandler,Default_Handler + + .weak DMA2_Channel6_IRQHandler + .thumb_set DMA2_Channel6_IRQHandler,Default_Handler + + .weak DMA2_Channel7_IRQHandler + .thumb_set DMA2_Channel7_IRQHandler,Default_Handler + + .weak LPUART1_IRQHandler + .thumb_set LPUART1_IRQHandler,Default_Handler + + .weak QUADSPI_IRQHandler + .thumb_set QUADSPI_IRQHandler,Default_Handler + + .weak I2C3_EV_IRQHandler + .thumb_set I2C3_EV_IRQHandler,Default_Handler + + .weak I2C3_ER_IRQHandler + .thumb_set I2C3_ER_IRQHandler,Default_Handler + + .weak SAI1_IRQHandler + .thumb_set SAI1_IRQHandler,Default_Handler + + .weak SWPMI1_IRQHandler + .thumb_set SWPMI1_IRQHandler,Default_Handler + + .weak TSC_IRQHandler + .thumb_set TSC_IRQHandler,Default_Handler + + .weak RNG_IRQHandler + .thumb_set RNG_IRQHandler,Default_Handler + + .weak FPU_IRQHandler + .thumb_set FPU_IRQHandler,Default_Handler + + .weak CRS_IRQHandler + .thumb_set CRS_IRQHandler,Default_Handler +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/TencentOS_tiny_EVB_MX_Plus/GCC/hello_world/Makefile b/board/TencentOS_tiny_EVB_MX_Plus/GCC/hello_world/Makefile index be74136f..eede8d2f 100644 --- a/board/TencentOS_tiny_EVB_MX_Plus/GCC/hello_world/Makefile +++ b/board/TencentOS_tiny_EVB_MX_Plus/GCC/hello_world/Makefile @@ -247,4 +247,4 @@ clean: ####################################### -include $(wildcard $(BUILD_DIR)/*.d) -# *** EOF *** \ No newline at end of file +# *** EOF *** diff --git a/components/Makefile b/components/Makefile new file mode 100644 index 00000000..821b1c51 --- /dev/null +++ b/components/Makefile @@ -0,0 +1,33 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/Bluetooth_5.0/Makefile b/components/connectivity/Bluetooth_5.0/Makefile new file mode 100644 index 00000000..e9635436 --- /dev/null +++ b/components/connectivity/Bluetooth_5.0/Makefile @@ -0,0 +1,50 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -std=c99 +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/controller/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/drivers/native/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/nimble/controller/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/ext/tinycrypt/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/NimBLE_1_2_0/porting/nimble/include +CFGFLAGS += -I$(CUR_DIR)/porting/TencentOS_tiny/include +CFGFLAGS += -I$(CUR_DIR)/porting/TencentOS_tiny/include/nrf52832 + +LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/ext +LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/nimble + +LSRCS_EXCLUDE_FILES = $(wildcard 3rdparty/NimBLE_1_2_0/nimble/controller/test/src/*.c) +LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf52/*) +LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf51/*) + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/Eclipse-Paho-MQTT/Makefile b/components/connectivity/Eclipse-Paho-MQTT/Makefile new file mode 100644 index 00000000..6418ce60 --- /dev/null +++ b/components/connectivity/Eclipse-Paho-MQTT/Makefile @@ -0,0 +1,42 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(realpath $(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/3rdparty/include +CFGFLAGS += -I$(CUR_DIR)/wrapper/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +LSRCS_DIR += 3rdparty/src +LSRCS_DIR += wrapper/src + + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/Modbus/Makefile b/components/connectivity/Modbus/Makefile new file mode 100644 index 00000000..b524bbde --- /dev/null +++ b/components/connectivity/Modbus/Makefile @@ -0,0 +1,42 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -std=c99 +CFGFLAGS += -I$(CUR_DIR)/porting/TencentOS_Tiny +CFGFLAGS += -I$(CUR_DIR)/3rdparty/freemodbus-v1.6/modbus/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/freemodbus-v1.6/modbus/rtu +CFGFLAGS += -I$(CUR_DIR)/3rdparty/freemodbus-v1.6/modbus/ascii + +LSRCS_DIRS += 3rdparty/freemodbus-v1.6/modbus + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/iotkit-embedded-3.0.1/Makefile b/components/connectivity/iotkit-embedded-3.0.1/Makefile new file mode 100644 index 00000000..d77f237a --- /dev/null +++ b/components/connectivity/iotkit-embedded-3.0.1/Makefile @@ -0,0 +1,42 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +#CFGFLAGS += -std=c99 + +#LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/ext +#LSRCS_DIRS += 3rdparty/NimBLE_1_2_0/nimble + +#LSRCS_EXCLUDE_FILES = $(wildcard 3rdparty/NimBLE_1_2_0/nimble/controller/test/src/*.c) +#LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf52/*) +#LSRCS_EXCLUDE_FILES += $(wildcard 3rdparty/NimBLE_1_2_0/nimble/drivers/nrf51/*) + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/mqttclient/Makefile b/components/connectivity/mqttclient/Makefile new file mode 100644 index 00000000..63ba849e --- /dev/null +++ b/components/connectivity/mqttclient/Makefile @@ -0,0 +1,39 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +SUBDIRS_FIND=$(patsubst ./%,%,$(shell find . -type d)) +CFGFLAGS += -std=c99 +CFGFLAGS += -DSALOF_USING_TENCENTOS +CFGFLAGS += $(addprefix -I$(CUR_DIR)/, $(SUBDIRS_FIND)) + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk b/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk index b1d20107..df487b7e 100644 --- a/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk +++ b/components/connectivity/qcloud-iot-hub-sdk/3rdparty/tools/build_scripts/parse_make_settings.mk @@ -1,4 +1,4 @@ -include $(SCRIPT_DIR)/internal_make_funcs.mk +-include $(SCRIPT_DIR)/internal_make_funcs.mk SETTING_VARS := \ BUILD_TYPE \ diff --git a/components/connectivity/qcloud-iot-hub-sdk/Makefile b/components/connectivity/qcloud-iot-hub-sdk/Makefile new file mode 100644 index 00000000..ec00b1d1 --- /dev/null +++ b/components/connectivity/qcloud-iot-hub-sdk/Makefile @@ -0,0 +1,50 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(realpath $(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/3rdparty/include +CFGFLAGS += -I$(CUR_DIR)/3rdparty/include/exports +CFGFLAGS += -I$(CUR_DIR)/3rdparty/platform/at_device/esp8266 +CFGFLAGS += -I$(CUR_DIR)/3rdparty/sdk_src/internal_inc +CFGFLAGS += -I$(CUR_DIR)/3rdparty/external_libs/mbedtls/include +#CFGFLAGS += -Werror +CFGFLAGS += -Wall -Wno-error=sign-compare -Wno-error=format -Os -pthread -DFORCE_SSL_VERIFY + +#包含需要排除plaform/os的.c源码文件, 故自定义LSRC +LSRCS_EXCLUDE := $(sort $(shell find 3rdparty/platform/os -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.cc" -o -name "*.C")) +LSRCS_EXCLUDE += $(sort $(shell find 3rdparty/samples -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.cc" -o -name "*.C")) + +#SCRIPT_DIR=$(CUR_DIR)/3rdparty/tools/build_scripts/ +#include $(CUR_DIR)/3rdparty/make.settings +#include $(CUR_DIR)/3rdparty/tools/build_scripts/parse_make_settings.mk + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/elfloader/Makefile b/components/elfloader/Makefile new file mode 100644 index 00000000..0b79cebc --- /dev/null +++ b/components/elfloader/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/components/fs/vfs/include +CFGFLAGS += -I$(CUR_DIR)/common/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/encoding/Makefile b/components/encoding/Makefile new file mode 100644 index 00000000..32b57aa0 --- /dev/null +++ b/components/encoding/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/base64/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/fs/Makefile b/components/fs/Makefile new file mode 100644 index 00000000..13187206 --- /dev/null +++ b/components/fs/Makefile @@ -0,0 +1,37 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/components/fs/fatfs/wrapper/include +CFGFLAGS += -I$(QTOP)/components/fs/vfs/include +CFGFLAGS += -I$(QTOP)/components/fs/kv/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/gui/Makefile b/components/gui/Makefile new file mode 100644 index 00000000..41d59def --- /dev/null +++ b/components/gui/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/LittlevGL/3rdparty + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/ota/Makefile b/components/ota/Makefile new file mode 100644 index 00000000..49553cd6 --- /dev/null +++ b/components/ota/Makefile @@ -0,0 +1,47 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/common/lzma/wrapper +CFGFLAGS += -I$(CUR_DIR)/common/lzma/3rdparty +CFGFLAGS += -I$(CUR_DIR)/common/flash +CFGFLAGS += -I$(CUR_DIR)/common/partition +CFGFLAGS += -I$(CUR_DIR)/common/crc +CFGFLAGS += -I$(CUR_DIR)/common/image +CFGFLAGS += -I$(CUR_DIR)/common/env +CFGFLAGS += -I$(CUR_DIR)/common/info +CFGFLAGS += -I$(CUR_DIR)/common/diff +CFGFLAGS += -I$(CUR_DIR)/recovery/include +CFGFLAGS += -I$(CUR_DIR)/download/include +CFGFLAGS += -I$(QTOP)/components/fs/kv/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/security/Makefile b/components/security/Makefile new file mode 100644 index 00000000..00d8023f --- /dev/null +++ b/components/security/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/mbedtls/3rdparty/include +CFGFLAGS += -I$(CUR_DIR)/mbedtls/3rdparty/include/mbedtls +CFGFLAGS += -I$(CUR_DIR)/mbedtls/wrapper/include +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/shell/Makefile b/components/shell/Makefile new file mode 100644 index 00000000..65811f3b --- /dev/null +++ b/components/shell/Makefile @@ -0,0 +1,33 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/utils/JSON/Makefile b/components/utils/JSON/Makefile new file mode 100644 index 00000000..69305393 --- /dev/null +++ b/components/utils/JSON/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/components/utils/Makefile b/components/utils/Makefile new file mode 100644 index 00000000..821b1c51 --- /dev/null +++ b/components/utils/Makefile @@ -0,0 +1,33 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/Makefile b/devices/Makefile new file mode 100644 index 00000000..dab511e5 --- /dev/null +++ b/devices/Makefile @@ -0,0 +1,32 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + diff --git a/devices/air724/Makefile b/devices/air724/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/air724/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/bc26/Makefile b/devices/bc26/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/bc26/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/bc35_28_95/Makefile b/devices/bc35_28_95/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/bc35_28_95/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/bc35_28_95_lwm2m/Makefile b/devices/bc35_28_95_lwm2m/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/bc35_28_95_lwm2m/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/ec20/Makefile b/devices/ec20/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/ec20/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/esp8266/Makefile b/devices/esp8266/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/esp8266/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/esp8266_tencent_firmware/Makefile b/devices/esp8266_tencent_firmware/Makefile new file mode 100644 index 00000000..23f9c5de --- /dev/null +++ b/devices/esp8266_tencent_firmware/Makefile @@ -0,0 +1,38 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper +CFGFLAGS += -I$(QTOP)/net/tencent_firmware_module_wrapper +CFGFLAGS += -std=c99 + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/m26/Makefile b/devices/m26/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/m26/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/m5310a/Makefile b/devices/m5310a/Makefile new file mode 100644 index 00000000..365baa81 --- /dev/null +++ b/devices/m5310a/Makefile @@ -0,0 +1,37 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper +CFGFLAGS += -std=c99 + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/m6312/Makefile b/devices/m6312/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/m6312/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/nrf24l01/Makefile b/devices/nrf24l01/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/devices/nrf24l01/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/sim7600ce/Makefile b/devices/sim7600ce/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/sim7600ce/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/devices/sim800a/Makefile b/devices/sim800a/Makefile new file mode 100644 index 00000000..0ae50fff --- /dev/null +++ b/devices/sim800a/Makefile @@ -0,0 +1,36 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/doc/qmk/01. Intro_Qmk_A_Makefile_Framework_For_TencentOS.md b/doc/qmk/01. Intro_Qmk_A_Makefile_Framework_For_TencentOS.md new file mode 100644 index 00000000..06c31b01 --- /dev/null +++ b/doc/qmk/01. Intro_Qmk_A_Makefile_Framework_For_TencentOS.md @@ -0,0 +1,333 @@ +# Qmk(Quick Makefile) + +## 1. 介绍 + +### Qmk 是什么 + +qmk, 是TecentOS的一个Makefile编译框架。 + +### Qmk 的特点 +- 使用简单,任意目录均可make,支持帮助`make help`; +- 支持Makefile调试,任何 目录`make BP= dm`打印Makefile 的所有变量值。 +- 支持编译调试, `make V=1`,`Make V=2`。 +- 支持宏扩展调试。`make E=1`。 +- 目录分离。源码,编译产物目录分离。 +- 入门简单,新源码目录 Makefile 拷贝即可使用; +- 多架构支持。支持多种 MCU ARCH、多种CC工具链; +- 模板化。多种场景的Makefile拷贝即用; +- 配置化。board-pack提供mcu/arch/bsp等编译时参数、目录的配置; +- 耦合低。跟源码目录结构的耦合低; +- 子目录单独make支持。支持子目录编译.a静态库; + + +## TencentOS的make编译 +### TencentOS的整体make +```shell +# 进入board目录支持qmk的board +cd board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK + +# 本目录编译 +make + +# 查看帮助 +make help +``` +TencentOS的整体编译过程是: +- 先编译静态库 + +3. 从`board/`下的顶级Makefile开始,该Makefile 确定了BP 。 +3. Makefile 通过 `make -C BP=`访问各个目录,BP用于选择`qmk/board-pack`下的一个`bp.xxx`作为编译参数集合。 +3. `make -C BP=` 进入 `arch/` `kernel/` `platform/vendor_bsp`等需要的目录。 +3. make进入各个目录,根据`BP`,生成对应的`.a`静态库,如访问 `arch/`, 生成`libarch.a`,具备编译哪些arch/下的源码文件由`board-pack`确定。 +3. make递归访问其他源码目录,目录的`节点Makefile`通过BP渲染`include Make.tpl`模板生成。 +3. 依据目录的`节点Makefile`,生成`libxxx.a` 。 +3. 各个源码目录节点,依次生成`.a`静态库文件,均位于 `build/`目录下 。 + +- 再链接 +3. make 回到 `board/`的顶级Makefile。 +3. 需要链接生成`elf`的目录通过`include Make.exec` 。 +3. 编译本目录及其子目录下所有源文件,生成`.o`文件。 +3. 根据 `LD_A_FILES`和`LD_L_LISTS`进行链接。 +3. 整体链接完成,生成文件位于`build/`目录下。 + +### TecentOS的子目录make +```shell +# 进入某包含Makefile的目录 +cd kernel/ + +# 本目录编译,使用Linux_Posix作为Board-Pack +make BP=Linux_Posix +# 本目录编译,使用TencentOS_tiny_EVB_MX_Plus作为Board-Pack +make BP=TencentOS_tiny_EVB_MX_Plus + +# 查看帮助 +make help +``` +单目录的编译过程是: +3. make访问本目录,读取本目录Makefile,根据命令行`make BP=xxx`的BP,选择`mk/board-pack`。 +3. 根据BP选择的构建参数。 +3. 使用ar进行打包,.a 文件放在`build/`目录。 +3. 构建完成。 + +## Qmk 的概念 +### generic-Makefile(mk/generic) +`qmk/generic/Make.tpl` 属于这类。 +又称全局通用型Makefile模板。位于 `mk/generic)`。 + +要求对所有board、所有gcc-toolchain、cpu、arch、bsp适用。 +所以一般只包含通用的规则。 + + +### boardpack-Makefile(mk/board-pack) +`board-pack/bp.TencentOS_tiny_EVB_MX_Plus` 属于这类。 + +又称板级Makefile模板。是一个硬件产品工程开发过程中在编译时的参数抽象文件。 + +位于mk/board-pack 的 bp.${BP},属于board配置型Makefile,需要确定工具链,mcu,arch、board、bsp等方面的编译时参数集合。 +嵌入式应用开发工程师主要修改这部分Makefile。 + + +### srctree-Makefile +`kernel/Makefile` `arch/Makefile` 都属于这类。 +又称节点Makefile,位于各个源码目录的 Makefile。多个board都适用的Makefile,属于源码节点配置型Makefile。 + + + +不能包含arch,board级别的编译参数。 +### link-Makefile +`board/TencentOS_tiny_EVB_MX_Plus/GCC-QMK/app_tencent_os_mqtt/Makefile` 属于这类。 + + + +## Qmk 的使用 + +### 当前目录所有.c,编译成一个.a库 +`这类Makefile编写参考 osal/posix/Makefile`。 +复制粘贴 以下 Makefile 内容到源码目录 Makefile。 +无需修改。 +> +>3. 注意`TREE_LIB_ENABLE=0`,,cc和ar时,只搜索当前目录源码,不包含子目录; +> +>3. 注意`lib=`,表示链接后的库名使用目录名; +>3. 有特别的CFLAG请根据情况配置 `CFGFLAGS`。 +>3. 注意板级的编译参数请配置到pack-Makefile,否则会导致其他pack编译报错. + + +```Makefile +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/include + +include ${QTOP}/qmk/generic/Make.tpl + +``` + +### 某目录及其子目录的所有.c,编译成一个.a库 +`这类Makefile编写参考 kernel/Makefile`。 +复制粘贴 以下 Makefile 内容到源码目录 Makefile。 +无需修改。 +有特别的CFLAG请根据情况配置 `CFGFLAGS`。 +> +>3. 注意`TREE_LIB_ENABLE=1`,cc和ar时,会递归搜索源码,包含当前目录及其子目录。 +> +>3. 注意`lib=`,表示链接后的库名使用目录名; +>3. 注意板级的编译参数请配置到pack-Makefile,否则会导致其他pack编译报错. +> + + +```Makefile +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + +include ${QTOP}/qmk/generic/Make.tpl +``` + + +### 当前目录进入所有子目录、进入指定目录编译 +`这类Makefile编写参考 platform/Makefile`。 +复制粘贴 以下 Makefile 内容到源码目录 Makefile。 +无需修改。 +有特别的CFLAG请根据情况配置 `CFGFLAGS`。 +>注意` subdirs=`为空,默认会进入所有子目录。 +> 如果需要指定子目录请给`subdirs`赋值。 +> + +```Makefile +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + +``` + +### 新增一个 board-pack,支持新的board + +参考 `mk/board-pack/`下的各个文件。 + +参考 `qmk/board-pack/bp.TencentOS_tiny_EVB_MX_Plus`。 + +board-pack 是对 board 在编译时的一个抽象。 +一个board 确定了 MCU、 arch、工具链,把这些编译时参数写成一个bp.xxx。 + +新整一个board-pack的步骤: +- qmk/board-pack/目录下,新建一个bp.xxx. +- 在bp.xxx定义以下变量: + + 注意 CFGFLAGS 需要包括 cpu、arch、board 等类型的FLAG。 + 赋值建议用`+=`,不允许用 `:=`。注意 可以引用`QTOP`,`BLDROOT`变量,不建议引用其他`qmk/generic/`模板的变量。 + +| Makefile变量名 | 变量赋值举例 | 变量说明 | +| :-------- | ------ | :--------------------- | +| CROSS_COMPILE | CROSS_COMPILE =arm-none-eabi- | 工具链前缀 | +| CC | CC = $(CROSS_COMPILE)gcc | 工具链 | +| CXX | CXX = $(CROSS_COMPILE)g++ | 工具链 | +| LD | LD = $(CROSS_COMPILE)ld | 工具链 | +| ARFLAGS | ARFLAGS = -rc | 工具链 | +| STRIP | STRIP = $(CROSS_COMPILE)strip| 工具链 | +| CFGFLAGS | 参考`bp.TencentOS_tiny_EVB_MX_Plus` | 对CFLAGS、CXXFLAGS 进行增加 | +| ARCH_LSRCS | 参考`bp.TencentOS_tiny_EVB_MX_Plus` | board-pack对应的arch/源码,`make -C arch/时需要编译的源码,绝对路径,或相对于QTOP的相对路径 | +| BSP_LSRCS | 参考`bp.TencentOS_tiny_EVB_MX_Plus` | board-pack对应的board/bsp源码 | +| PLATFORM_VENDOR_BSP_LSRCS | 参考`bp.TencentOS_tiny_EVB_MX_Plus` | board-pack对应的vendor_bsp 源码,`make -C platform/vendor_bsp时需要编译的源码 | +| PLATFORM_VENDOR_BSP_LSRCS | 参考`bp.TencentOS_tiny_EVB_MX_Plus` | board-pack对应的vendor_bsp 源码,`make -C platform/vendor_bsp时需要编译的源码 | +| PLATFORM_HAL_LSRCS | 参考`bp.TencentOS_tiny_EVB_MX_Plus` | board-pack对应的 hal 源码,`make -C platform/hal时 | + +## Qmk 的模板的内置变量 + +| 变量名 |赋值| 变量值说明 | 值举例 | +| :-------- |:------|:------ |:------- | +|AR |bp中赋值| 工具链 | "arm-none-eabi-ar"| +|ARCH_LSRCS|bp中赋值| 进入arch/需要编译的源码,绝对路径或相对于QTOP的源码路径 | "/root/democode/TencentOS-tiny/arch/arm/arm-v7m/cortex-m4/gcc/port_c.c /root/democode/TencentOS-tiny/arch/arm/arm-v7m/cortex-m4/gcc/port_s.S /root/democode/TencentOS-tiny/arch/arm/arm-v7m/common/tos_fault.c /root/democode/TencentOS-tiny/arch/arm/arm-v7m/common/tos_cpu.c /root/democode/TencentOS-tiny/arch/arm/arm-v7m/cortex-m4/gcc/port_c.c /root/democode/TencentOS-tiny/arch/arm/arm-v7m/cortex-m4/gcc/port_s.S /root/democode/TencentOS-tiny/arch/arm/arm-v7m/common/tos_fault.c /root/democode/TencentOS-tiny/arch/arm/arm-v7m/common/tos_cpu.c "| +|ARFLAGS |bp中赋值 | 工具链参数|ar 参数,含义见`ar --help`| "-rc"| +|BLDDIR |禁止赋值|标识.o等编译产物所在的目录,跟源码LOCALDIR有关| "/root/democode/TencentOS-tiny/build/TencentOS_tiny_EVB_MX_Plus.arm-none-eabi-gcc.tos/arch"| +|BLDROOT |禁止赋值 | 标识编译产物位置目录。| "/root/democode/TencentOS-tiny/build/TencentOS_tiny_EVB_MX_Plus.arm-none-eabi-gcc.tos"| +|BLD_SUFFIX|禁止赋值 |编译产物位置目录的后缀名 | | ".tos"| +|BOBJS |禁止赋值 | 所有OBJ集合,绝对路径 | "/root/democode/TencentOS-tiny/build/TencentOS_tiny_EVB_MX_Plus.arm-none-eabi-gcc.tos/arch/arm/arm-v7m/cortex-m4/gcc/port_c.o /root/democode/TencentOS-tiny/build/TencentOS_tiny_EVB_MX_Plus.arm-none-eabi-gcc.tos/arch/arm/arm-v7m/cortex-m4/gcc/port_s.o /root/democode/TencentOS-tiny/build/TencentOS_tiny_EVB_MX_Plus.arm-none-eabi-gcc.tos/arch/arm/arm-v7m/common/tos_fault.o /root/democode/TencentOS-tiny/build/TencentOS_tiny_EVB_MX_Plus.arm-none-eabi-gcc.tos/arch/arm/arm-v7m/common/tos_cpu.o"| +|CC | bp中赋值 |"arm-none-eabi-gcc"| +|CROSS_COMPILE | 工具链 | "arm-none-eabi-"| +|CURDIR |禁止赋值|标识当前Makefile 所在的目录 | "/root/democode/TencentOS-tiny/arch"| +|CUR_DIR |禁止赋值|标识当前Makefile 所在的目录 | "/root/democode/TencentOS-tiny/arch"| +|CUR_MK_NODE_DIR |禁止赋值|标识当前Makefile 所在的目录 | "/root/democode/TencentOS-tiny/arch"| +|CXX |bp中赋值| "arm-none-eabi-g++"| +|LD |bp中赋值| "arm-none-eabi-ld"| +|LDFLAGS |bp中赋值 | " "| +|LOBJS |禁止赋值|OBJ文件集合,相对路径,相对于当前Makefile目录 | "arm/arm-v7m/cortex-m4/gcc/port_c.o arm/arm-v7m/cortex-m4/gcc/port_s.o arm/arm-v7m/common/tos_fault.o arm/arm-v7m/common/tos_cpu.o"| +|LOCALDIR |禁止赋值|源码目录位置,相对路径,相对于QTOP | "arch"| +|LSRCS |禁止在bp中赋值,可以在src-Makefile赋值|编译源代码文件集合,相对路径,相对于当前Makefile目录,或者绝对路径 | "arm/arm-v7m/cortex-m4/gcc/port_c.c arm/arm-v7m/cortex-m4/gcc/port_s.S arm/arm-v7m/common/tos_fault.c arm/arm-v7m/common/tos_cpu.c "| +|QTOP |禁止赋值|源码一级目录| "/root/democode/TencentOS-tiny"| +|RANLIB |bp中赋值 | "arm-none-eabi-ranlib"| +|STRIP |bp中赋值| "arm-none-eabi-strip"| +|TREE_LIB_ENABLE |src-Makefile赋值,非0 表示编译所有子目录源码| LSRCS是否把子目录源码 | "0"| +|lib |不建议赋值|`.a`库名变量,默认目录名| "libarch"| +|targetlib |禁止赋值| "/root/democode/TencentOS-tiny/build/TencentOS_tiny_EVB_MX_Plus.arm-none-eabi-gcc.tos/libarch.a"| + + +## qmk的 make 命令行参数 +```cookie +make help +``` +### make V=1 E=1 +```cookie +# verbose打印编译时的命令 +make V=1 +# 调试头文件包含,宏扩展时很有用,会在生成`.o`文件的同时生成`.i`预处理文件 +make E=1 +``` +```cookie +# verbose打印链接时的库搜索过程 +make V=2 +make V=3 +``` +## 调试Makefile +```cookie +#进入含Makefile的目录 +make BP=TencentOS_tiny_EVB_MX_Plus dm +``` + +## Qmk 后续 diff --git a/kernel/Makefile b/kernel/Makefile new file mode 100644 index 00000000..db366f9c --- /dev/null +++ b/kernel/Makefile @@ -0,0 +1,38 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/Makefile b/net/Makefile new file mode 100644 index 00000000..49c966c6 --- /dev/null +++ b/net/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=n +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + +include ${QTOP}/qmk/generic/Make.subdirs + diff --git a/net/at/Makefile b/net/at/Makefile new file mode 100644 index 00000000..a82c0e54 --- /dev/null +++ b/net/at/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=1 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/lora_module_wrapper/Makefile b/net/lora_module_wrapper/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/net/lora_module_wrapper/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/lwip/Makefile b/net/lwip/Makefile new file mode 100644 index 00000000..0664dcae --- /dev/null +++ b/net/lwip/Makefile @@ -0,0 +1,38 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=y +lib= +subdirs= + +CFGFLAGS += -I${CUR_DIR}/3rdparty/src/include +CFGFLAGS += -I${CUR_DIR}/port/include + + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/sal_module_wrapper/Makefile b/net/sal_module_wrapper/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/net/sal_module_wrapper/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/socket_wrapper/Makefile b/net/socket_wrapper/Makefile new file mode 100644 index 00000000..9dac0911 --- /dev/null +++ b/net/socket_wrapper/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I${QTOP}/net/sal_module_wrapper + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/net/tencent_firmware_module_wrapper/Makefile b/net/tencent_firmware_module_wrapper/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/net/tencent_firmware_module_wrapper/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/osal/Makefile b/osal/Makefile new file mode 100644 index 00000000..c6108ff5 --- /dev/null +++ b/osal/Makefile @@ -0,0 +1,31 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs = cmsis_os + + +include ${QTOP}/qmk/generic/Make.tpl diff --git a/osal/cmsis_os/Makefile b/osal/cmsis_os/Makefile new file mode 100644 index 00000000..c5126dc4 --- /dev/null +++ b/osal/cmsis_os/Makefile @@ -0,0 +1,34 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/osal/posix/Makefile b/osal/posix/Makefile new file mode 100644 index 00000000..d692b25f --- /dev/null +++ b/osal/posix/Makefile @@ -0,0 +1,35 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + +CFGFLAGS += -I$(CUR_DIR)/include + +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/platform/Makefile b/platform/Makefile new file mode 100644 index 00000000..dab511e5 --- /dev/null +++ b/platform/Makefile @@ -0,0 +1,32 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -e qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= + + +include ${QTOP}/qmk/generic/Make.tpl + diff --git a/platform/hal/Makefile b/platform/hal/Makefile new file mode 100644 index 00000000..84b75b68 --- /dev/null +++ b/platform/hal/Makefile @@ -0,0 +1,47 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= +ifneq (help,$(findstring help,$(MAKECMDGOALS))) + +ifeq (, $(strip ${BP})) +$(error when compile arch/, must specify BP obviously , see `make help`) +endif + +include ${QTOP}/qmk/board-pack/bp.${BP} + +ifeq (,$(strip ${PLATFORM_HAL_LSRCS})) +$(error when compile arch/, must specify PLATFORM_HAL_LSRCS on your bp.${BP} , see `make help`) +endif +endif + +# arch src should be specify by bp +LSRCS := $(subst $(QTOP)/$(LOCALDIR)/,, ${PLATFORM_HAL_LSRCS}) +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/platform/vendor_bsp/Makefile b/platform/vendor_bsp/Makefile new file mode 100644 index 00000000..c5546e2d --- /dev/null +++ b/platform/vendor_bsp/Makefile @@ -0,0 +1,47 @@ +################################################################### +#automatic detection QTOP and LOCALDIR +CUR_DIR := $(patsubst %/,%,$(dir $(realpath $(firstword $(MAKEFILE_LIST))))) +TRYQTOP := $(shell if [ -n "$$QTOP" ] ; then\ + echo $$QTOP;\ + else\ + cd $(CUR_DIR); while /usr/bin/test ! -d qmk ; do \ + dir=`cd ../;pwd`; \ + if [ "$$dir" = "/" ] ; then \ + echo Cannot find QTOP in $(firstword $(MAKEFILE_LIST)) 1>&2; \ + exit 1; \ + fi ; \ + cd $$dir; \ + done ; \ + pwd; \ + fi) +QTOP ?= $(realpath ${TRYQTOP}) + +ifeq ($(QTOP),) +$(error Please run this in a tree) +endif +LOCALDIR = $(patsubst %/,%,$(subst $(realpath $(QTOP))/,,$(CUR_DIR))) + +#################################################################### + + +TREE_LIB_ENABLE=0 +lib= +subdirs= +ifneq (help,$(findstring help,$(MAKECMDGOALS))) + +ifeq (, $(strip ${BP})) +$(error when compile arch/, must specify BP obviously, see `make help`) +endif + +include ${QTOP}/qmk/board-pack/bp.${BP} + +ifeq (,$(strip ${PLATFORM_VENDOR_BSP_LSRCS})) +$(error when compile arch/, must specify PLATFORM_VENDOR_BSP_LSRCS on your bp.${BP}, see `make help`) +endif +endif + +# arch src should be specify by bp +LSRCS := $(subst $(QTOP)/$(LOCALDIR)/,, ${PLATFORM_VENDOR_BSP_LSRCS}) +include ${QTOP}/qmk/generic/Make.tpl + + diff --git a/qmk/board-pack/bp.Linux_Posix b/qmk/board-pack/bp.Linux_Posix new file mode 100644 index 00000000..84b7915a --- /dev/null +++ b/qmk/board-pack/bp.Linux_Posix @@ -0,0 +1,80 @@ +# toolchain +uname := $(shell uname -s) +ifeq ($(filter-out Linux Darwin,$(uname)),) + ifeq ($(shell uname -m),x86_64) + CROSS_COMPILE = + CC = $(CROSS_COMPILE)gcc + CXX = $(CROSS_COMPILE)g++ + LD = $(CROSS_COMPILE)ld + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + else + CROSS_COMPILE = + CC = $(CROSS_COMPILE)gcc -m32 + CXX = $(CROSS_COMPILE)g++ -m32 + LD = $(CROSS_COMPILE)ld -melf_i386 + AR = $(CROSS_COMPILE)ar + ARFLAGS = -rc + STRIP = $(CROSS_COMPILE)strip + RANLIB = $(CROSS_COMPILE)ranlib + endif +endif + +# arch +CFGFLAGS += -I${QTOP}/arch/linux/common/include/ +CFGFLAGS += -I${QTOP}/arch/linux/posix/gcc + + + +ARCH_LSRCS += $(wildcard ${QTOP}/arch/linux/posix/gcc/*.c) +ARCH_LSRCS += $(wildcard ${QTOP}/arch/linux/common/*.c) + +CFGFLAGS += -O0 -Wall -g2 -ggdb + +CFGFLAGS += -I${QTOP}/board/Linux_Posix/hello_world/inc +CFGFLAGS += -I${QTOP}/osal/cmsis_os +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + + + +# kernel + +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + +# CMSIS + +CFGFLAGS += -I${QTOP}/osal/cmsis_os + + +#net + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +# components + +CFGFLAGS += -I$(QTOP)/components/connectivity/Modbus/3rdparty/freemodbus-v1.6/modbus/include +CFGFLAGS += -I$(QTOP)/components/shell/include +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/mqttclient +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/mqtt +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/common +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/platform/TencentOS-tiny +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/network +CFGFLAGS += -I$(QTOP)/components/fs/kv/include +CFGFLAGS += -I$(QTOP)/components/ota/common/flash +CFGFLAGS += -I$(QTOP)/components/connectivity/Eclipse-Paho-MQTT/wrapper/include +CFGFLAGS += -I$(QTOP)/components/utils/JSON/include + +# devices + + +# examples +CFGFLAGS += -I$(QTOP)/examples/event_driven_at_module/at_evtdrv/include diff --git a/qmk/board-pack/bp.TencentOS_tiny_EVB_MX_Plus b/qmk/board-pack/bp.TencentOS_tiny_EVB_MX_Plus new file mode 100644 index 00000000..00b97d86 --- /dev/null +++ b/qmk/board-pack/bp.TencentOS_tiny_EVB_MX_Plus @@ -0,0 +1,107 @@ +CROSS_COMPILE =arm-none-eabi- +CC = $(CROSS_COMPILE)gcc +CXX = $(CROSS_COMPILE)g++ +LD = $(CROSS_COMPILE)ld +AR = $(CROSS_COMPILE)ar +ARFLAGS = -rc +STRIP = $(CROSS_COMPILE)strip +RANLIB = $(CROSS_COMPILE)ranlib + +# debug + +CFGFLAGS += -g -gdwarf-2 + +# cpu +################################### +# cpu/fpu/float-abi + +CFGFLAGS += -mcpu=cortex-m4 +CFGFLAGS += -mfpu=fpv4-sp-d16 +CFGFLAGS += -mfloat-abi=hard -mthumb + +# Device +CFGFLAGS += -DUSE_HAL_DRIVER -DSTM32L431xx +CFGFLAGS += -Wall -fdata-sections -ffunction-sections + + + +# arch +CFGFLAGS += -I$(QTOP)/arch/arm/arm-v7m/common/include +CFGFLAGS += -I$(QTOP)/arch/arm/arm-v7m/cortex-m4/gcc + +ARCH_LSRCS += $(wildcard ${QTOP}/arch/arm/arm-v7m/cortex-m4/gcc/*.c) +ARCH_LSRCS += $(wildcard ${QTOP}/arch/arm/arm-v7m/cortex-m4/gcc/*.s) +ARCH_LSRCS += $(wildcard ${QTOP}/arch/arm/arm-v7m/cortex-m4/gcc/*.S) +ARCH_LSRCS += $(wildcard ${QTOP}/arch/arm/arm-v7m/common/*.c) +ARCH_LSRCS += $(wildcard ${QTOP}/arch/arm/arm-v7m/common/*.s) +ARCH_LSRCS += $(wildcard ${QTOP}/arch/arm/arm-v7m/common/*.S) + +# Board TOS + +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/TOS-CONFIG + +# CMSIS +CFGFLAGS += -I${QTOP}/osal/cmsis_os + + +#board BSP +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Inc +CFGFLAGS += -I$(QTOP)/platform/vendor_bsp/st/STM32L4xx_HAL_Driver/Inc +CFGFLAGS += -I$(QTOP)/platform/vendor_bsp/st/STM32L4xx_HAL_Driver/Inc/Legacy +CFGFLAGS += -I$(QTOP)/platform/vendor_bsp/st/CMSIS/Device/ST/STM32L4xx/Include +CFGFLAGS += -I$(QTOP)/platform/vendor_bsp/st/CMSIS/Include +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/DHT11 +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/BH1750 +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/OLED + + +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/PM25 +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/Modbus_Port +CFGFLAGS += -I$(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware/E53_IA1 + +BSP_LSRCS += $(shell find $(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Src -name "*.c" -o -name "*.s") +BSP_LSRCS += $(shell find $(QTOP)/board/TencentOS_tiny_EVB_MX_Plus/BSP/Hardware -name "*.c" -o -name "*.s") + +#platform/vendor_bsp + +PLATFORM_VENDOR_BSP_LSRCS += $(shell find $(QTOP)/platform/vendor_bsp/st/STM32L4xx_HAL_Driver/Src -name "*.c" -o -name "*.s") +PLATFORM_HAL_LSRCS += $(shell find $(QTOP)/platform/hal/st/stm32l4xx -name "*.c" -o -name "*.s") + + +# kernel + +CFGFLAGS += -I${QTOP}/kernel/core/include +CFGFLAGS += -I${QTOP}/kernel/evtdrv/include +CFGFLAGS += -I${QTOP}/kernel/hal/include +CFGFLAGS += -I${QTOP}/kernel/pm/include + +# CMSIS + +CFGFLAGS += -I${QTOP}/osal/cmsis_os + + +#net + +CFGFLAGS += -I$(QTOP)/net/at/include +CFGFLAGS += -I$(QTOP)/net/sal_module_wrapper + +# components + +CFGFLAGS += -I$(QTOP)/components/connectivity/Modbus/3rdparty/freemodbus-v1.6/modbus/include +CFGFLAGS += -I$(QTOP)/components/shell/include +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/mqttclient +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/mqtt +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/common +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/platform/TencentOS-tiny +CFGFLAGS += -I$(QTOP)/components/connectivity/mqttclient/network +CFGFLAGS += -I$(QTOP)/components/fs/kv/include +CFGFLAGS += -I$(QTOP)/components/ota/common/flash +CFGFLAGS += -I$(QTOP)/components/connectivity/Eclipse-Paho-MQTT/wrapper/include +CFGFLAGS += -I$(QTOP)/components/utils/JSON/include + +# devices + +CFGFLAGS += -I$(QTOP)/devices/esp8266 + +# examples +CFGFLAGS += -I$(QTOP)/examples/event_driven_at_module/at_evtdrv/include diff --git a/qmk/generic/Make.debug b/qmk/generic/Make.debug new file mode 100644 index 00000000..9c58b2e4 --- /dev/null +++ b/qmk/generic/Make.debug @@ -0,0 +1,50 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +# aim for debug makefile +######################################################################## + + + + + +ifeq ($(MAKELEVEL),0) + + +# Standard definitions for true and false. true is any non-empty +# string, false is an empty string. These are intended for use with +# $(if). + +true := T +false := + +# ---------------------------------------------------------------------------- +# Function: not +# Arguments: 1: A boolean value +# Returns: Returns the opposite of the arg. (true -> false, false -> true) +# ---------------------------------------------------------------------------- +not = $(if $1,$(false),$(true)) + +# ---------------------------------------------------------------------------- +# Function: seq +# Arguments: 1: A string to compare against... +# 2: ...this string +# Returns: Returns $(true) if the two strings are identical +# ---------------------------------------------------------------------------- +seq = $(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),$(false),$(true)) + +ifeq (dm,$(findstring dm,$(MAKECMDGOALS))) +$(info ###################All pre-defined and user-defined variable's Key:) +$(info $(shell echo -e '\e[1;33m $(sort $(.VARIABLES)) \e[m')) + +$(info ###################All user-defined Variables:) +$(foreach v, $(sort $(.VARIABLES)),$(if $(call seq,$(origin ${v}),file), $(eval VV:=$(value ${v})) $(info $(shell echo -e '\e[1;33m ${v} \e[m = "$(VV)"' )))) +dm: + @true +endif + + + +PHONY: dm + +endif \ No newline at end of file diff --git a/qmk/generic/Make.depend b/qmk/generic/Make.depend new file mode 100644 index 00000000..f68c644a --- /dev/null +++ b/qmk/generic/Make.depend @@ -0,0 +1,46 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +ifeq (,$(findstring clean,$(MAKECMDGOALS))) +ifneq (help,$(findstring help,$(MAKECMDGOALS))) + +all:: + @true +# +# Attempt to build the depend files. If it fails, the depend file is +# removed so that it is not included in later builds. +# +#${BLDDIR}/%.P : %.c ${BLDDIR}/.tree +# @$(ECHO) "[$(BP)] DEP ${LOCALDIR}/$<" + +#${BLDDIR}/%.P : %.cc ${BLDDIR}/.tree +# @$(ECHO) "[$(BP)] DEP ${LOCALDIR}/$<" + + +# +# If there are C or C++ files in this directory, include the +# depend files for them. +# +ifeq ($(findstring _COMPILER,$(MAKECMDGOALS))$(findstring variable,$(MAKECMDGOALS)),) +ifneq ($(strip ${LSRCS}),) +ifneq (,$(findstring .o,$(MAKECMDGOALS))) +-include $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.P)) $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.sig)) +else +-include $(addprefix ${BLDDIR}/,$(addsuffix .P,$(basename $(LSRCS)))) +-include $(addprefix ${BLDDIR}/,$(addsuffix .sig,$(basename $(LSRCS)))) +endif +endif +endif + +endif # help +endif # !CLEANING + +clean_d:: +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] CLEAN DEPS ${LOCALDIR}" +endif + $Q$(RM) $(BOBJS:.o=.P) + +clean:: clean_d diff --git a/qmk/generic/Make.exec b/qmk/generic/Make.exec new file mode 100644 index 00000000..027a1b87 --- /dev/null +++ b/qmk/generic/Make.exec @@ -0,0 +1,67 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +######################################################################## + +# Make rules/targets for handling user application + +.SECONDARY:: ${LD_O_FILES} + +include $(QTOP)/qmk/generic/Make.tpl + +ifeq (,$(strip $(exec))) +exec = $(shell basename $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))) +endif + +OUTDIR = ${BLDDIR}/out + +targetexec = ${OUTDIR}/${exec}.elf + +all:: ${OUTDIR}/.tree ${targetexec} + +$(info $(wildcard $(BLDROOT)/%.a) ) + +ifeq (,$(LD_O_FILES)) +LD_O_FILES = $(sort $(BOBJS)) +endif +ifeq (2,$(V)) +LD_INFO_OPTS := -Wl,--warn-common -Wl,--verbose +endif +ifeq (3,$(V)) +LD_INFO_OPTS := -Wl,--warn-common -Wl,-Map,${OUTDIR}/${exec}.map -Wl,--verbose +endif + +_LD_START_GROUP := -Wl,--start-group +_LD_END_GROUP := -Wl,--end-group + +ifeq (,$(strip ${OBJCOPY})) +OBJCOPY=$(subst strip,objcopy,$(STRIP)) +endif + +$(targetexec): $(OUTDIR)/.tree ${LD_O_FILES} + @/bin/rm -f $@ # Prevent core dump if currently running + @$(ECHO) "[$(BP)] LINK $@" # This is needed for error parsing + $(Q)/bin/ls $(BLDROOT) + $(Q)$(CC) \ + $(patsubst -I%,,${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS}) \ + -o $@ -L${BLDROOT} \ + $(_LD_START_GROUP) $(LD_O_FILES) $(LD_A_FILES) $(_LD_END_GROUP) $(LD_L_LISTS) $(LD_INFO_OPTS) + $(Q)$(STRIP) --strip-debug $@ -o $(OUTDIR)/$(basename $(notdir $@)).strip + $(Q)$(OBJCOPY) -O binary -S $@ $(OUTDIR)/$(basename $(notdir $@)).bin + $(Q)$(OBJCOPY) -O ihex $@ $(OUTDIR)/$(basename $(notdir $@)).hex + $(CP) $(OUTDIR)/$(basename $(notdir $@)).* $(BLDROOT)/ + @$(ECHO) -e "[$(BP)] INFO [$(BP)] INFO \e[1;32mLINK OK,OK,OK!!!\e[m" + @$(ECHO) -e "\e[1;32m$$(/bin/ls $(BLDROOT)/$(basename $(notdir $@)).*)\e[m" + + +install:: all + +clean:: + $(Q)$(RM) ${BOBJS} + $(Q)$(RM) $(filter %.a ,$(LD_A_FILES)) + $(Q)$(RM) $(OUTDIR)/$(basename $(notdir ${targetexec})).* + $(Q)$(RM) $(BLDROOT)/$(basename $(notdir ${targetexec})).* + +distclean:: clean + +.PHONY: $(targetexec) + diff --git a/qmk/generic/Make.lib b/qmk/generic/Make.lib new file mode 100644 index 00000000..77806d3f --- /dev/null +++ b/qmk/generic/Make.lib @@ -0,0 +1,52 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +.SECONDARY:: ${BOBJS} + +ifndef lib +lib = lib$(shell basename ${LOCALDIR}) +endif +targetlib = ${BLDROOT}/${lib}.a + + +${BLDROOT}/%.a: ${BOBJS} +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] ARLIB $(subst $(QTOP)/,,$@)" +endif + $Q$(RM) $@ + $Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS}) + +# if objs is not empty, let make .a +ifneq (,$(strip ${BOBJS})) +all:: ${BLDDIR}/.tree ${targetlib} + +$(targetlib): ${BOBJS} +ifneq (,${BOBJS}) +ifeq (@,$(Q)) + @$(ECHOE) "[$(BP)] ARLIB \e[1;32m$(subst $(QTOP)/,,$@) \e[m" +endif + $Q$(RM) $@ + $Q$(AR) ${ARFLAGS} $@ $(sort ${BOBJS}) +endif + +install:: all +clean:: +ifeq (@,$(Q)) + $Q$(ECHO) "[$(BP)] ClEAN OBJS ${LOCALDIR}" +endif + $Q$(RM) ${BOBJS} +ifdef EEEE + $Q$(RM) ${BOBJS:.o=.i} +endif + $Q$(RM) ${targetlib} + +distclean:: clean + +endif + + + + + diff --git a/qmk/generic/Make.subdirs b/qmk/generic/Make.subdirs new file mode 100644 index 00000000..b4305163 --- /dev/null +++ b/qmk/generic/Make.subdirs @@ -0,0 +1,39 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + + + +.PHONY: ${subdirs} + + + +# only not treelib will do recursive subdir make +ifneq (,$(filter n no NO 0,$(TREE_LIB_ENABLE))) # no +# only have subdir, will do recursive subdir make +ifeq (,$(strip $(subdirs))) +subdirs = $(sort $(dir $(wildcard */Makefile))) +endif + +ifneq (,$(strip ${subdirs})) +# target +all:: ${subdirs} + @true + +${subdirs}:: +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] SUBDIR $(LOCALDIR)/$@ " +endif + $Q$(MAKE) -C $@ BP=${BP} + + +# target +clean clean_d install:: +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] $@ $(LOCALDIR)" +endif + @(for name in $(subdirs); do $(MAKE) -C $$name $@; done) + +endif +endif \ No newline at end of file diff --git a/qmk/generic/Make.tools b/qmk/generic/Make.tools new file mode 100644 index 00000000..d294bff7 --- /dev/null +++ b/qmk/generic/Make.tools @@ -0,0 +1,63 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +SYSOK = 0 +ifneq "$(SYSNAME)" "" +SYSOK = 1 # already set from environment +endif + + + +# unix or unix-type type hosts +ifeq "$(SYSOK)" "0" +SYSNAME := $(shell uname -s) + +ifeq "$(SYSNAME)" "Linux" +SYSOK = 1 +SED = /bin/sed +COMPRESS = /usr/bin/compress +GZIP = /usr/bin/gzip +TEST = /usr/bin/test +PERL = $(shell which perl) +LN = /bin/ln +TOUCH = /bin/touch +endif + + +ifeq "$(SYSNAME)" "Darwin" +SYSOK = 1 +SED = /usr/bin/sed +COMPRESS = /usr/bin/compress +GZIP = /usr/bin/gzip +LZMA = LZMA_NOT_DEFINED +TEST = /bin/test +PERL = $(shell which perl) +LN = /bin/ln +TOUCH = /usr/bin/touch +endif + +ifeq (MSYS_NT,$(findstring MSYS_NT,$(SYSNAME))) +SYSOK = 1 +SED = /usr/bin/sed +COMPRESS = /usr/bin/compress +GZIP = /usr/bin/gzip +LZMA = LZMA_NOT_DEFINED +TEST = /bin/test +PERL = $(shell which perl) +LN = /bin/ln +TOUCH = /usr/bin/touch +endif + +endif + +# +# Platform Independent +# +RM = /bin/rm -rf +CP = /bin/cp +MKDIR = /bin/mkdir -p +MAKEDEP = /bin/echo +ECHO = /bin/echo -e +ECHOE = /bin/echo -e \ No newline at end of file diff --git a/qmk/generic/Make.tpl b/qmk/generic/Make.tpl new file mode 100644 index 00000000..5b40566d --- /dev/null +++ b/qmk/generic/Make.tpl @@ -0,0 +1,289 @@ +# QMK for TencentOS +# @author Jimmin.huang jimmin@163.com +# Makefile template +######################################################################## + +export QTOP +ALOWED_MAKE_VERSIONS :=3.82 +ifeq ($(MAKELEVEL),0) +ifeq ($(filter $(ALOWED_MAKE_VERSIONS),$(MAKE_VERSION)),) +#$(info Make $(MAKE_VERSION) not be tested, use one of $(ALOWED_MAKE_VERSIONS)) +$(info QMK for TOS) +endif +endif +ifeq ($(MAKELEVEL),0) +ifeq (help,$(findstring help,$(MAKECMDGOALS))) +NO_QMK_DEPS=1 +endif +endif +# the top Makefile node that include this file +CUR_MK_NODE_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + +######################################################################## +# +# Set a default BP if one is not set. + + +SUPPORT-BP := $(sort $(subst $(QTOP)/qmk/board-pack/bp.,, $(wildcard $(QTOP)/qmk/board-pack/bp.*))) + + +ifndef BP + uname := $(shell uname -s) + ifeq ($(filter-out Linux Darwin,$(uname)),) + BP=Linux_Posix + endif + ifndef BP + BP=native + $(info Can't determine BP, `make help` see usage ) + endif + $(info assume default BP=${BP} ) +endif + +BP := ${BP} +export BP + + +# +# By default, turn off the "changing directory" message. +# +MAKEFLAGS += --no-print-directory + +# +# Use gmake by default +# +include ${QTOP}/qmk/generic/Make.tools + +include ${QTOP}/qmk/board-pack/bp.${BP} + + + +######################################################################## + +INCFLAGS = -I${QTOP}/arch/header -I${CUR_MK_NODE_DIR} -I${CUR_MK_NODE_DIR}/include -I${CUR_MK_NODE_DIR}/inc +INCFLAGS += -DBP=\"$(BP)\" -DFILE_NAME=\"$(subst $(dir $<),,$<)\" + +CFGFLAGS += ${INCFLAGS} +# STD_{C|CXX}FLAGS - Standard flags used by ALL compilations +# CFGFLAGS - Configuration flags used by ALL compilations + +CFLAGS += ${STD_CFLAGS} ${CFGFLAGS} $(ADD_CFLAGS) $(GLOBAL_CFLAGS) +CXXFLAGS += ${STD_CXXFLAGS} ${CFGFLAGS} $(ADD_CFLAGS) $(GLOBAL_CFLAGS) +LDFLAGS += ${STD_LDFLAGS} ${CFGLDFLAGS} $(ADD_LDFLAGS) $(GLOBAL_LDFLAGS) + + + + +V ?= 0 +# use to control printing of compilation lines +ifeq (0,$(V)) +#no VERBOSE +Q:=@ +else +# VERBOSE +Q:= +endif + +# +# Default location to place binaries and make depend files for building +# purposes. +# + +ifndef QTOPBUILD +QTOPBUILD :=build +endif +ifeq (,$(BLD_SUFFIX)) +BLD_SUFFIX := .tos +endif + +BLDROOT = ${QTOP}/${QTOPBUILD}/$(if ${BLDCONFIG},${BLDCONFIG}/)${BP}.$(notdir $(firstword $(CC)))${BLD_SUFFIX} + + +ifdef LOCALDIR +BLDDIR = ${BLDROOT}/${LOCALDIR} +else +BLDDIR = ${BLDROOT} +endif + +LIBDIR = ${BLDROOT} + + + +# +# In each directory, build a list of local sources, objects, and headers +# +ifeq (,$(strip ${LSRCS})) # LSRCS +ifeq (,$(filter n no NO 0,$(TREE_LIB_ENABLE))) # TREE_LIB_ENABLE yes + +ifeq (,$(strip ${LSRCS_DIRS})) # LSRCS_DIRS +LSRCS_ALL = $(patsubst ./%,%, $(sort $(shell find . -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.S" -o -name "*.cc"))) +else +LSRCS_ALL = $(patsubst ./%,%, $(sort $(shell find ${LSRCS_DIRS} -name "*.c" -o -name "*.cpp" -o -name "*.s" -o -name "*.S" -o -name "*.cc"))) +endif # LSRCS_DIRS + +else # TREE_LIB_ENABLE +LSRCS_ALL = $(patsubst ./%,%,$(sort $(wildcard *.c *.cpp *.s *.S *.cc *.C))) # only include src in this dir. +endif # TREE_LIB_ENABLE + +endif # LSRCS + +ifneq (,$(strip ${LSRCS_EXCLUDE_FILES})) +$(info "ignore LSRCS_EXCLUDE_FILES source files: ${LSRCS_EXCLUDE_FILES}") +endif + +ifndef LSRCS +LSRCS = $(filter-out $(patsubst ./%,%,${LSRCS_EXCLUDE_FILES}),${LSRCS_ALL}) +else + +$(info [$(BP)] INFO LSRCS defined by user, use `make V=1` verbose print ) + +ifneq (0,$(V)) +$(info LSRCS=$(LSRCS)") +endif + +endif + +LOBJS = $(patsubst $(QTOP)/%,%,$(addsuffix .o, $(basename ${LSRCS}))) +BOBJS = $(addprefix ${BLDDIR}/,${LOBJS}) + +# +# Rule to create object file (build) directory +# + +.PHONY: all install clean + +.PRECIOUS: ${BLDDIR}/.tree $(EXECDIR) + +%/.tree: + @$(ECHO) "[$(BP)] MKDIR $(dir $@)" + $Q($(MKDIR) $(dir $@); $(TOUCH) $@) + +# Rule allowing build through CPP only, creates .i file from .c file. + +%.i: %.c + @$Q$(ECHO) "[$(BP)] EEEE ${LOCALDIR}/$<" + $Q$(CC) -E ${CFLAGS} $< | $(SED) -e '/^ *$$/d' -e p -e d > $@ + +# Rule allowing build through source only, creates .s file from .c file. + +%.s: %.c + $Q$(CC) -S ${CFLAGS} $< + + +NO_QMK_DEPS = 1 + +# allow disabling of dependency file generation +# enable partial recompilation through use of included +# dependency makefiles +# +ifdef NO_QMK_DEPS +zDEPS_OPT = -MMD -MP -MF'$(@:%.o=%.d)' -Wa,-a,-ad,-alms='$(@:%.o=%.lst)' +endif # ifndef NO_QMK_DEPS + + +# No dependency files, faster compile times +# no partial compile support +zDEPS_SED = +zDEPS_CPY = +zDEPS_CMD = /bin/true + +define zdo +$(eval C := $1) +$Q$C +endef + + +# +# Default Build rules for .c --> .o, leaving the binary in BLDDIR/X.o, +# even if file not built from directory of source. +# +${BLDDIR}/%.o: $(QTOP)/%.c + $Q$(MKDIR) $(dir $@) + $Q$(RM) -f $@ +ifdef E + @$Q$(ECHO) '[$(BP)] EEEE ${LOCALDIR}/$<' + $Q$(CC) -E ${CFLAGS} $(EXTRA_CFLAGS) $< | $(SED) -e '/^ *$$/d' -e p -e d > $(@:.o=.i) +endif +ifdef S + @$Q$(ECHO) "[$(BP)] SSSS ${LOCALDIR}/$<" + $Q$(CC) -S ${CFLAGS} $< +endif + @$Q$(ECHO) "[$(BP)] CCCC $<" + $Q$(call zdo,$$(CC) $$(zDEPS_OPT) $$(CFLAGS) $$(EXTRA_CFLAGS) -o $$@ -c $$(realpath $$<)) && ($(zDEPS_CMD)) + +${BLDDIR}/%.o: %.c + $Q$(MKDIR) $(dir $@) + $Q$(RM) -f $@ +ifdef E + @$Q$(ECHO) "[$(BP)] EEEE ${LOCALDIR}/$<" + $Q$(CC) -E ${CFLAGS} $(EXTRA_CFLAGS) $< | $(SED) -e '/^ *$$/d' -e p -e d > $(@:.o=.i) +endif + @$Q$(ECHO) "[$(BP)] CCCC ${LOCALDIR}/$<" + $Q$(call zdo,$$(CC) $$(zDEPS_OPT) $$(CFLAGS) $$(EXTRA_CFLAGS) -o $$@ -c $$(realpath $$<)) && ($(zDEPS_CMD)) + +${BLDDIR}/%.o: %.s + $Q$(MKDIR) $(dir $@) + $Q$(ECHO) "[$(BP)] ASAS ${LOCALDIR}/$<" +# $Q$(MKDIR) $(BLDDIR)/ +# $Q$(MKDIR) $(dir $@) + $Q$(RM) -f $@ + $Q$(CC) ${CFLAGS} ${EXTRA_CFLAGS} -o $@ -c $(realpath $<) + +${BLDDIR}/%.o: %.S + $Q$(MKDIR) $(dir $@) + $Q$(ECHO) "[$(BP)] ASAS ${LOCALDIR}/$<" + $Q$(RM) -f $@ + $Q$(CC) ${CFLAGS} ${EXTRA_CFLAGS} -o $@ -c $(realpath $<) + +${BLDDIR}/%.o: %.cpp + $Q$(MKDIR) $(dir $@) +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] CCCC ${LOCALDIR}/$<" +endif + $Q$(CXX) ${CXXFLAGS} -o $@ -c $(realpath $<) + +${BLDDIR}/%.o: %.cc + $Q$(MKDIR) $(dir $@) +ifeq (@,$(Q)) + @$(ECHO) "[$(BP)] CCCC ${LOCALDIR}/$<" +endif + $Q$(CXX) ${CXXFLAGS} -o $@ -c $(realpath $<) + +# +# Cause "make foo.o" in any subdirectory to put the object in the build +# directory instead of the local directory. +# +%.o: ${BLDDIR}/%.o + @ + +# +# Targets for build +# +ifeq ($(MAKELEVEL),0) +ifeq (help,$(findstring help,$(MAKECMDGOALS))) +.PHONY: help +help: + $Q$(ECHO) "Usage:" + $Q$(ECHO) -e "\t make help" + $Q$(ECHO) -e "make for specified board-pack" + $Q$(foreach v, $(SUPPORT-BP), $(call zdo, $$(ECHO) -e "\t make BP=$$(v)") ) + $Q$(ECHO) -e "\t BP dir are: $(QTOP)/qmk/board-pack/" + $Q$(ECHO) -e "Clean build" + $Q$(ECHO) -e "\t make clean all" + $Q$(ECHO) -e "Debug build, verbose print, generate preprocess .i for .c" + $Q$(ECHO) -e "\t make V=1 " + $Q$(ECHO) -e "\t make E=1 " + $Q$(ECHO) -e "Debug Makefile" + $Q$(ECHO) -e "\t make dm" +endif +endif + + + +include ${QTOP}/qmk/generic/Make.lib +include ${QTOP}/qmk/generic/Make.subdirs +include ${QTOP}/qmk/generic/Make.depend + + +include ${QTOP}/qmk/generic/Make.debug + +