Skip to content

Commit 8501011

Browse files
authored
Merge pull request #68 from cruise2018/master
fix:bootloader
2 parents 00b184d + 790a443 commit 8501011

File tree

10 files changed

+65
-42
lines changed

10 files changed

+65
-42
lines changed

components/at/Readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22

33
为了让at框架和硬件做解耦,特优化或者说是更新以前的版本,让AT框架的本质回归到AT。
44

5-
#### 安装配置
5+
#### 编译配置
66

77
在使用at框架之前,需要系统的配置文件配置LOSCFG_ENABLE_AT。
88

9+
如果使用KEIL以及IAR等工具,建议在target_config.h文件中进行配置
910
```
1011
如在target_config.h中配置
1112
#define LOSCFG_ENABLE_AT 1
1213
```
1314

14-
然后可以安装AT框架了。
15+
如果使用MAKE,则建议在makefile文件中直接包含AT组件目录下的at.mk即可
16+
17+
#### 组件安装
18+
安装该组件必须调用los_at_init进行初始化,需要使用者提供相关的AT通道设备
1519

1620
```
1721
bool_t los_at_init(const char *devname); //install the at module

components/at/at.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@
4040
#if LOSCFG_ENABLE_AT
4141

4242
//these defines could be moved to the configuration of the at module
43-
#define cn_at_oob_len 6 //only allow 6 oob command monitor here,you could configure it more
43+
#define cn_at_oob_len 6 //only allow 6 oob command monitor here,you could configure it more
4444
#define cn_at_resp_maxlen 768 //PROSING THAT COULD GET THE MOST REPSLENGTH
4545

46-
4746
//at control block here
4847
struct at_cmd
4948
{

components/at/at.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,23 @@
4040
#include <stdio.h>
4141
#include <osport.h>
4242

43-
#include <los_config.h>
4443

4544
typedef s32_t (*fnoob)(u8_t *data,s32_t datalen);
4645

47-
#if LOSCFG_ENABLE_AT
46+
#if LOSCFG_ENABLE_AT
4847
bool_t los_at_init(const char *devname); //install the at frame work,which binded to the device
4948

5049
bool_t at_oobregister(fnoob func,const char *index); //register a out of band data dealer
5150
s32_t at_command(u8_t *cmd, s32_t cmdlen,const char *index,u8_t *respbuf,s32_t respbuflen,u32_t timeout); //send at command and receive response
52-
bool_t at_workmode(bool_t passby,fnoob func); //use to set the at module work as the passer by
51+
bool_t at_workmode(bool_t passby,fnoob func); //use to set the at module work as the passer by
52+
5353
#else
5454

5555
#define los_at_init(name) false
5656
#define at_oobregister(x,y) false
5757
#define at_command(a,b,c,d,e,f) 0
5858
#define at_workmode(x,y) false
5959

60-
6160
#endif
6261

6362

components/at/at.mk

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
################################################################################
2+
# this is used for compile the at modules
3+
# make sure that this module depends on the driver module
4+
# make sure driver module is enabled
5+
################################################################################
6+
7+
AT_MODULE_SRC = \
8+
${wildcard $(TOP_DIR)/components/at/*.c}
9+
C_SOURCES += $(AT_MODULE_SRC)
10+
11+
AT_MODULE_INC = \
12+
-I $(TOP_DIR)/components/at
13+
14+
C_INCLUDES += $(AT_MODULE_INC)
15+
16+
17+
AT_MODULE_DEF = \
18+
-D LOSCFG_ENABLE_AT=1
19+
20+
C_DEFS += $(AT_MODULE_DEF)
21+

targets/IoTClub-BearPi/GCC/Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ include $(TOP_DIR)/components/huawei_cdp/lwm2m/oc_lwm2m_agent.mk
8585
endif
8686

8787

88+
WITH_AT_MODULE = yes
89+
###############LOAD AT MODULE###################################################
90+
#load the at if enabled
91+
ifeq ($(WITH_AT_MODULE), yes)
92+
93+
include $(TOP_DIR)/components/at/at.mk
94+
95+
endif
96+
97+
8898
######################################
8999
# source
90100
######################################
@@ -117,10 +127,7 @@ UTIL_SRC = \
117127
$(TOP_DIR)/components/lib/libc/malloc.c
118128
C_SOURCES += $(UTIL_SRC)
119129

120-
#AT FRAMEWORK
121-
AT_SRC = \
122-
${wildcard $(TOP_DIR)/components/at/*.c}
123-
C_SOURCES += $(AT_SRC)
130+
124131
#driver hal
125132
DIRVERHAL_SRC = \
126133
$(TOP_DIR)/drivers/third_party/ST/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \
@@ -243,7 +250,6 @@ ARCH_INC = \
243250

244251
COMPONENTS_INC = \
245252
-I $(TOP_DIR)/components/osport \
246-
-I $(TOP_DIR)/components/at \
247253
-I $(TOP_DIR)/components/shell \
248254
-I $(TOP_DIR)/components/driver
249255
C_INCLUDES += $(COMPONENTS_INC)

targets/IoTClub-BearPi/OS_CONFIG/target_config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ extern "C" {
379379
//component enable options
380380

381381
#define LOSCFG_ENABLE_SHELL 1
382-
#define LOSCFG_ENABLE_AT 1
383382
#define LOSCFG_ENABLE_VFS 1
384383
#define LOSCFG_ENABLE_DRIVER 1
385384

targets/STM32F429IGTx_FIRE/GCC/Makefile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,8 @@ HAL_DRIVER_SRC = \
124124
HARDWARE_SRC = \
125125
${wildcard $(TOP_DIR)/targets/STM32F429IGTx_FIRE/Hardware/Src/*.c}
126126
C_SOURCES += $(HARDWARE_SRC)
127-
128-
ifeq ($(USE_BOOTLOADER), no)
129-
HAL_DRIVER_SRC_NO_BOOTLOADER = \
130-
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
131-
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
132-
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c \
133-
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c
134-
C_SOURCES += $(HAL_DRIVER_SRC_NO_BOOTLOADER)
127+
128+
135129
KERNEL_SRC = \
136130
${wildcard $(TOP_DIR)/kernel/*.c} \
137131
${wildcard $(TOP_DIR)/kernel/base/core/*.c} \
@@ -155,6 +149,15 @@ ARCH_SRC = \
155149
${wildcard $(TOP_DIR)/arch/arm/arm-m/armv7-m/*.c} \
156150
${wildcard $(TOP_DIR)/arch/arm/arm-m/armv7-m/gcc/*.c}
157151
C_SOURCES += $(ARCH_SRC)
152+
153+
ifeq ($(USE_BOOTLOADER), no)
154+
HAL_DRIVER_SRC_NO_BOOTLOADER = \
155+
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
156+
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
157+
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c \
158+
$(TOP_DIR)/drivers/third_party/ST/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c
159+
C_SOURCES += $(HAL_DRIVER_SRC_NO_BOOTLOADER)
160+
158161

159162
ifeq ($(WITH_LWIP), yes)
160163
LWIP_SRC = \
@@ -565,7 +568,6 @@ LITEOS_CMSIS = \
565568
-I $(TOP_DIR)/osdepends/liteos/cmsis
566569
C_INCLUDES += $(LITEOS_CMSIS)
567570

568-
ifeq ($(USE_BOOTLOADER), no)
569571
OS_CONFIG_INC = \
570572
-I $(TOP_DIR)/targets/STM32F429IGTx_FIRE/OS_CONFIG
571573
C_INCLUDES += $(OS_CONFIG_INC)
@@ -579,7 +581,8 @@ ARCH_INC = \
579581
-I $(TOP_DIR)/arch/arm/arm-m/include \
580582
-I $(TOP_DIR)/arch/arm/arm-m/armv7-m
581583
C_INCLUDES += $(ARCH_INC)
582-
584+
585+
ifeq ($(USE_BOOTLOADER), no)
583586

584587
ifeq ($(WITH_LWIP), yes)
585588
LWIP_INC = \

targets/STM32F429IGTx_FIRE/GCC/config_demos/config_bootloader.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ WITH_LWIP := no
3333
# (NB_NEUL95_NO_ATINY: nb without agenttiny)
3434
# (NB_NEUL95: nb with agenttiny)
3535
#######################################
36-
WITH_AT_FRAMEWORK := yes
36+
WITH_AT_FRAMEWORK := no
3737
ifeq ($(WITH_AT_FRAMEWORK), yes)
3838
#ESP8266 # SIM900A # NB_NEUL95 # NB_NEUL95_NO_ATINY
3939
NETWORK_TYPE := NB_NEUL95
@@ -80,7 +80,7 @@ LWM2M_WITH_LOGS := no
8080
#######################################
8181
# Agenttiny log
8282
#######################################
83-
ATINY_DEBUG := yes
83+
ATINY_DEBUG := no
8484

8585
#######################################
8686
# File System

targets/STM32F429IGTx_FIRE/Src/board.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#define OTA_COPY_BUF_SIZE 0x1000
6161

6262

63+
6364
#ifdef __CC_ARM
6465
__asm void boot_app(uint32_t stack,uint32_t pc)
6566
{
@@ -77,7 +78,6 @@ __attribute__((noreturn)) __attribute__((naked)) void boot_app(uint32_t stack,ui
7778
}
7879
#endif
7980

80-
typedef void (*jump_func)(void);
8181

8282
static int prv_spi2inner_copy(uint32_t addr_source, int32_t image_len)
8383
{
@@ -169,15 +169,7 @@ int board_jump2app(void)
169169

170170
if ((pc & OTA_PC_MASK) == OTA_FLASH_BASE)
171171
{
172-
if ((stack & OTA_STACK_MASK) == OTA_MEMORY_BASE)
173-
{
174-
boot_app(stack,pc);
175-
}
176-
else
177-
{
178-
OTA_LOG("stack value(%lx) of the image is ilegal", stack);
179-
return OTA_ERRNO_ILEGAL_STACK;
180-
}
172+
boot_app(stack,pc);
181173
}
182174
else
183175
{
@@ -233,4 +225,4 @@ int board_rollback_copy(int32_t image_len)
233225
}
234226

235227
return 0;
236-
}
228+
}

targets/STM32F429IGTx_FIRE/Src/bootloader_recover.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
#include "board.h"
4444
#include "ota/recover_image.h"
4545

46-
void SysTick_Handler(void)
47-
{
48-
HAL_IncTick();
49-
}
46+
//void SysTick_Handler(void)
47+
//{
48+
// HAL_IncTick();
49+
//}
5050

5151
void _Error_Handler(char *file, int line)
5252
{
@@ -249,4 +249,4 @@ int main(void)
249249
ret = jump(oldbin_size);
250250

251251
return ret;
252-
}
252+
}

0 commit comments

Comments
 (0)