Skip to content

Commit

Permalink
refacetor code
Browse files Browse the repository at this point in the history
  • Loading branch information
epcbtech committed Jan 8, 2023
1 parent 964572d commit 07b8552
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 35 deletions.
25 changes: 17 additions & 8 deletions application/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,20 +207,13 @@ $(OBJECTS_DIR)/%.o: %.s
$(Print) AS $@
@$(AS) $(CFLAGS) -o $@ $<

asm: $(TARGET)
$(Print) disassemble-all $(<:.axf=.asm)
@$(OBJDUMP) -D $(<) >> $(<:.axf=.asm)

sym: $(TARGET)
$(Print) export object name $(<:.axf=.sym)
$(OBJNM) --size-sort --print-size $(<) >> $(<:.axf=.sym)

.PHONY: help
help:
$(Print) "[make flash dev=/dev/tty*] burn firmware via ak bootloader"
$(Print) " Note: This option is needed install ak-flash. Link download & install: https://github.com/epcbtech/ak-flash"
$(Print) " Example: make flash dev=/dev/ttyUSB0"
$(Print) "[make flash] burn firmware via st-link"
$(Print) "[make com dev=/dev/tty*] console AK Embedded Base Kit"
$(Print) "[make debug gdb=ddd] gdb debug using ddd"
$(Print) "[make debug] gdb debug"
$(Print) "[make clean] clean build project folder"
Expand All @@ -236,6 +229,14 @@ else
$(PROGRAMER_PATH)/STM32_Programmer.sh -c port=SWD -w $(TARGET:.axf=.bin) $(APP_START_ADDR_VAL) -rst
endif

.PHONY: com
com:
ifdef dev
minicom -D $(dev) -b 115200
else
$(Print) "Example: make com dev=/dev/ttyUSB0"
endif

.PHONY: debug
debug: all
xterm -e openocd -f $(OPENOCD_PATH)/tcl/board/stm32ldiscovery.cfg &
Expand All @@ -251,3 +252,11 @@ endif
clean:
$(Print) CLEAN $(OBJECTS_DIR) folder
@rm -rf $(OBJECTS_DIR)

asm: $(TARGET)
$(Print) disassemble-all $(<:.axf=.asm)
@$(OBJDUMP) -D $(<) >> $(<:.axf=.asm)

sym: $(TARGET)
$(Print) export object name $(<:.axf=.sym)
$(OBJNM) --size-sort --print-size $(<) >> $(<:.axf=.sym)
2 changes: 1 addition & 1 deletion application/sources/app/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ void app_start_timer() {
/* start timer to toggle life led */
timer_set(AC_TASK_LIFE_ID, AC_LIFE_SYSTEM_CHECK, AC_LIFE_TASK_TIMER_LED_LIFE_INTERVAL, TIMER_PERIODIC);
timer_set(AC_TASK_FW_ID, FW_CHECKING_REQ, FW_UPDATE_REQ_INTERVAL, TIMER_ONE_SHOT);
timer_set(AC_TASK_DISPLAY_ID, AC_DISPLAY_INITIAL, AC_DISPLAY_INITIAL_INTERVAL, TIMER_ONE_SHOT);
}

/* init state machine for tasks
Expand All @@ -365,7 +366,6 @@ void app_task_init() {
SCREEN_CTOR(&scr_mng_app, scr_startup_handle, &scr_startup);

task_post_pure_msg(AC_TASK_RF24_IF_ID, AC_RF24_IF_INIT_NETWORK);
task_post_pure_msg(AC_TASK_DISPLAY_ID, AC_DISPLAY_INITIAL);
task_post_pure_msg(AC_TASK_UART_IF_ID, AC_UART_IF_INIT);
}

Expand Down
3 changes: 2 additions & 1 deletion application/sources/app/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ enum {
*/
/*****************************************************************************/
/* define timer */
#define AC_DISPLAY_INITIAL_INTERVAL (300)
#define AC_DISPLAY_STARTUP_INTERVAL (2000)
#define AC_DISPLAY_LOGO_INTERVAL (10000)
#define AC_DISPLAY_SHOW_IDLE_BALL_MOVING_UPDATE_INTERAL (150)
Expand Down Expand Up @@ -181,7 +182,7 @@ enum {
*/
/*****************************************************************************/
#define APP_MAGIC_NUMBER 0xAABBCCDD
#define APP_VER {0, 0, 0, 2}
#define APP_VER {0, 0, 0, 3}

typedef struct {
uint32_t magic_number;
Expand Down
26 changes: 3 additions & 23 deletions application/sources/app/app_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
#define __APP_IF_H__
#include <stdint.h>

/*****************************************************************************/
/* task GW_SYS define.
*/
/*****************************************************************************/
/* define timer */
/* define signal */
enum {
GW_SYS_WATCH_DOG_REPORT_REQ = AK_USER_DEFINE_SIG,
};

/*****************************************************************************/
/* task GW_RF24 define.
*/
Expand Down Expand Up @@ -79,8 +69,8 @@ enum {
*/
/*****************************************************************************/
/* define timer */
#define GW_TIMER_FIRMWARE_PACKED_TIMEOUT_INTERVAL (300) /* 300ms */
#define GW_TIMER_FIRMWARE_GET_FIRMWARE_INFO_TIMEOUT (2000) /* 2s */
#define GW_TIMER_FIRMWARE_PACKED_TIMEOUT_INTERVAL (10000) /* 10s */
#define GW_TIMER_FIRMWARE_GET_FIRMWARE_INFO_TIMEOUT (10000) /* 10s */
#define GW_TIMER_FIRMWARE_DEV_INTERNAL_UPDATE_TIMEOUT (180000) /* 3' */

/* define signal */
Expand Down Expand Up @@ -109,17 +99,7 @@ enum {
/* define signal */
enum {
GW_DEBUG_1 = AK_USER_DEFINE_SIG,
GW_DEBUG_2,
GW_DEBUG_3,
GW_DEBUG_4,
GW_DEBUG_5,
GW_DEBUG_6,
GW_DEBUG_7,
GW_DEBUG_8,
GW_DEBUG_9,
GW_DEBUG_10,
GW_DEBUG_11,
GW_DEBUG_12,
};


#endif //__APP_IF_H__
4 changes: 2 additions & 2 deletions application/sources/platform/stm32l/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ void reset_handler() {
/* MUST BE disable interrupt */
__disable_irq();

volatile uint32_t *pSrc = &_ldata;
volatile uint32_t *pDest = &_data;
volatile uint32_t *pSrc = &_ldata;
volatile uint32_t *pDest = &_data;
volatile unsigned i, cnt;

/* init system */
Expand Down
Binary file modified hardware/bin/ak-base-kit-stm32l151-application.bin
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 07b8552

Please sign in to comment.