From efb3c5965f943bb4103c5e3d4ca029e615cdb137 Mon Sep 17 00:00:00 2001 From: SummerGift <459994202@qq.com> Date: Sat, 18 Nov 2017 11:43:42 +0800 Subject: [PATCH 1/3] update .config --- firmware/.config | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/firmware/.config b/firmware/.config index 226fe5d..d7defcd 100644 --- a/firmware/.config +++ b/firmware/.config @@ -106,7 +106,7 @@ CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096 CONFIG_RT_DFS_ELM_REENTRANT=y CONFIG_RT_USING_DFS_DEVFS=y CONFIG_RT_USING_DFS_NET=y -# CONFIG_HAVE_SYS_SELECT_H is not set +CONFIG_HAVE_SYS_SELECT_H=y # CONFIG_HAVE_SYS_SOCKET_H is not set # CONFIG_RT_USING_DFS_ROMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set @@ -137,6 +137,11 @@ CONFIG_RT_SFUD_USING_FLASH_INFO_TABLE=y # CONFIG_RT_USING_ENC28J60 is not set # CONFIG_RT_USING_SPI_WIFI is not set CONFIG_RT_USING_WDT=y +CONFIG_RT_USING_WIFI=y + +# +# Using USB +# # CONFIG_RT_USING_USB_HOST is not set # CONFIG_RT_USING_USB_DEVICE is not set @@ -243,12 +248,12 @@ CONFIG_LWIP_SO_RCVBUF=1 # # Marvell WiFi # -# CONFIG_PKG_USING_MARVELLWIFI is not set +# CONFIG_PKG_USING_WLANMARVELL is not set # # Wiced WiFi # -# CONFIG_PKG_USING_WLAN_WICED is not set +# CONFIG_PKG_USING_WLANWICED is not set # # security packages @@ -289,7 +294,6 @@ CONFIG_RT_USING_DSP=y CONFIG_RT_USING_ISP=y CONFIG_RT_USING_SADC=y CONFIG_RT_USING_PWM=y -CONFIG_RT_USING_WIFI=y CONFIG_SOC_FH8620=y CONFIG_FH_USING_ADVAPI_MD=y CONFIG_FH_USING_ADVAPI_ISP=y From d16076c1cb38adf93615ea70e12f1e2abec04b3a Mon Sep 17 00:00:00 2001 From: SummerGift <459994202@qq.com> Date: Sat, 18 Nov 2017 11:44:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9C=A8env=E4=B8=8B?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=93=BE=E6=8E=A5=E5=87=BA=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firmware/Libraries/inc/fh_i2c.h | 22 ++++++------ firmware/Libraries/inc/fh_mmc.h | 32 +++++++++-------- firmware/Libraries/inc/fh_wdt.h | 4 +-- firmware/link.ld | 62 ++++++++++++++++++++++++++------- firmware/rtconfig.h | 11 +++--- firmware/rtconfig.py | 8 ++--- 6 files changed, 91 insertions(+), 48 deletions(-) diff --git a/firmware/Libraries/inc/fh_i2c.h b/firmware/Libraries/inc/fh_i2c.h index 0ee522a..1ba4af2 100644 --- a/firmware/Libraries/inc/fh_i2c.h +++ b/firmware/Libraries/inc/fh_i2c.h @@ -184,20 +184,20 @@ struct fh_i2c_obj }; void I2C_Init(struct fh_i2c_obj *i2c_obj); -inline void I2C_Enable(struct fh_i2c_obj *i2c_obj, int enable); -inline void I2C_SetSlaveAddress(struct fh_i2c_obj *i2c_obj, rt_uint16_t addr); -inline UINT32 I2C_GetTransmitFifoLevel(struct fh_i2c_obj *i2c_obj); -inline UINT32 I2C_GetReceiveFifoLevel(struct fh_i2c_obj *i2c_obj); -inline UINT32 I2C_SetTransmitThreshold(struct fh_i2c_obj *i2c_obj, int txtl); +extern inline void I2C_Enable(struct fh_i2c_obj *i2c_obj, int enable); +extern inline void I2C_SetSlaveAddress(struct fh_i2c_obj *i2c_obj, rt_uint16_t addr); +extern inline UINT32 I2C_GetTransmitFifoLevel(struct fh_i2c_obj *i2c_obj); +extern inline UINT32 I2C_GetReceiveFifoLevel(struct fh_i2c_obj *i2c_obj); +extern inline UINT32 I2C_SetTransmitThreshold(struct fh_i2c_obj *i2c_obj, int txtl); int I2C_HandleTxAbort(struct fh_i2c_obj *i2c_obj); UINT32 I2C_ClearAndGetInterrupts(struct fh_i2c_obj *i2c_obj); -inline void I2C_SetInterruptMask(struct fh_i2c_obj *i2c_obj, UINT32 mask); -inline UINT32 I2C_GetInterruptMask(struct fh_i2c_obj *i2c_obj); -inline void I2C_SetDataCmd(struct fh_i2c_obj *i2c_obj, UINT32 reg); -inline UINT8 I2C_GetData(struct fh_i2c_obj *i2c_obj); +extern inline void I2C_SetInterruptMask(struct fh_i2c_obj *i2c_obj, UINT32 mask); +extern inline UINT32 I2C_GetInterruptMask(struct fh_i2c_obj *i2c_obj); +extern inline void I2C_SetDataCmd(struct fh_i2c_obj *i2c_obj, UINT32 reg); +extern inline UINT8 I2C_GetData(struct fh_i2c_obj *i2c_obj); int I2C_WaitMasterIdle(struct fh_i2c_obj *i2c_obj); int I2C_WaitSlaveIdle(struct fh_i2c_obj *i2c_obj); int I2C_WaitDeviceIdle(struct fh_i2c_obj *i2c_obj); -inline int I2C_Abort(struct fh_i2c_obj *i2c_obj); +extern inline int I2C_Abort(struct fh_i2c_obj *i2c_obj); -#endif /* FH_I2C_H_ */ +#endif /* FH_I2C_H_ */ \ No newline at end of file diff --git a/firmware/Libraries/inc/fh_mmc.h b/firmware/Libraries/inc/fh_mmc.h index cebcbc7..e1c8076 100644 --- a/firmware/Libraries/inc/fh_mmc.h +++ b/firmware/Libraries/inc/fh_mmc.h @@ -204,20 +204,21 @@ struct fh_mmc_obj MMC_DMA_Descriptors *descriptors; void (*mmc_reset)(struct fh_mmc_obj *); }; -inline void MMC_SetBlockSize(struct fh_mmc_obj *mmc_obj, rt_uint32_t size); -inline void MMC_SetByteCount(struct fh_mmc_obj *mmc_obj, rt_uint32_t bytes); -inline rt_uint32_t MMC_GetWaterlevel(struct fh_mmc_obj *mmc_obj); -inline rt_uint32_t MMC_GetResponse(struct fh_mmc_obj *mmc_obj, int resp_num); -inline rt_uint32_t MMC_GetRegCmd(struct fh_mmc_obj *mmc_obj); -inline rt_uint32_t MMC_GetRegCtrl(struct fh_mmc_obj *mmc_obj); -inline rt_uint32_t MMC_SetInterruptMask(struct fh_mmc_obj *mmc_obj, +extern inline void MMC_SetBlockSize(struct fh_mmc_obj *mmc_obj, rt_uint32_t size); +extern inline void MMC_SetByteCount(struct fh_mmc_obj *mmc_obj, rt_uint32_t bytes); +extern inline rt_uint32_t MMC_GetWaterlevel(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_GetResponse(struct fh_mmc_obj *mmc_obj, int resp_num); +extern inline rt_uint32_t MMC_GetRegCmd(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_GetRegCtrl(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_SetInterruptMask(struct fh_mmc_obj *mmc_obj, rt_uint32_t mask); -inline rt_uint32_t MMC_GetInterruptMask(struct fh_mmc_obj *mmc_obj); -inline rt_uint32_t MMC_ClearRawInterrupt(struct fh_mmc_obj *mmc_obj, +extern inline rt_uint32_t MMC_GetInterruptMask(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_GetUnmaskedInterrupt(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_ClearRawInterrupt(struct fh_mmc_obj *mmc_obj, rt_uint32_t interrupts); -inline rt_uint32_t MMC_GetRawInterrupt(struct fh_mmc_obj *mmc_obj); -inline rt_uint32_t MMC_GetStatus(struct fh_mmc_obj *mmc_obj); -inline rt_uint32_t MMC_GetCardStatus(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_GetRawInterrupt(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_GetStatus(struct fh_mmc_obj *mmc_obj); +extern inline rt_uint32_t MMC_GetCardStatus(struct fh_mmc_obj *mmc_obj); void MMC_Init(struct fh_mmc_obj *mmc_obj); int MMC_ResetFifo(struct fh_mmc_obj *mmc_obj); @@ -225,14 +226,15 @@ int MMC_SetCardWidth(struct fh_mmc_obj *mmc_obj, int width); int MMC_UpdateClockRegister(struct fh_mmc_obj *mmc_obj, int div); int MMC_SendCommand(struct fh_mmc_obj *mmc_obj, rt_uint32_t cmd, rt_uint32_t arg, rt_uint32_t flags); +extern inline rt_uint32_t MMC_IsDataStateBusy(struct fh_mmc_obj *mmc_obj); int MMC_WriteData(struct fh_mmc_obj *mmc_obj, rt_uint32_t *buf, rt_uint32_t size); int MMC_ReadData(struct fh_mmc_obj *mmc_obj, rt_uint32_t *buf, rt_uint32_t size); -inline void MMC_StartDma(struct fh_mmc_obj *mmc_obj); -inline void MMC_StopDma(struct fh_mmc_obj *mmc_obj); +extern inline void MMC_StartDma(struct fh_mmc_obj *mmc_obj); +extern inline void MMC_StopDma(struct fh_mmc_obj *mmc_obj); void MMC_InitDescriptors(struct fh_mmc_obj *mmc_obj, rt_uint32_t *buf, rt_uint32_t size); -#endif /* FH_MMC_H_ */ +#endif /* FH_MMC_H_ */ \ No newline at end of file diff --git a/firmware/Libraries/inc/fh_wdt.h b/firmware/Libraries/inc/fh_wdt.h index 0347039..b091b5f 100644 --- a/firmware/Libraries/inc/fh_wdt.h +++ b/firmware/Libraries/inc/fh_wdt.h @@ -57,10 +57,10 @@ struct fh_wdt_obj }; void WDT_Enable(struct fh_wdt_obj *wdt_obj, int enable); -inline int WDT_IsEnable(struct fh_wdt_obj *wdt_obj); +extern inline int WDT_IsEnable(struct fh_wdt_obj *wdt_obj); void WDT_SetTopValue(struct fh_wdt_obj *wdt_obj, int top); void WDT_SetCtrl(struct fh_wdt_obj *wdt_obj, UINT32 reg); void WDT_Kick(struct fh_wdt_obj *wdt_obj); unsigned int WDT_GetCurrCount(struct fh_wdt_obj *wdt_obj); -#endif /* FH_WDT_H_ */ +#endif /* FH_WDT_H_ */ \ No newline at end of file diff --git a/firmware/link.ld b/firmware/link.ld index 58f7f47..e080f62 100644 --- a/firmware/link.ld +++ b/firmware/link.ld @@ -12,6 +12,7 @@ SECTIONS { *(.init) *(.text) + KEEP(*(.fini)) *(.gnu.linkonce.t*) /* section information for finsh shell */ @@ -49,14 +50,19 @@ SECTIONS .ctors : { PROVIDE(__ctors_start__ = .); - KEEP(*(SORT(.ctors.*))) - KEEP(*(.ctors)) - /* new GCC version uses .init_array */ - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE(__ctors_end__ = .); + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + PROVIDE(__ctors_end__ = .); } + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } + /* The .ARM.exidx section is used for C++ exception handling. */ /* .ARM.exidx is sorted, so has to go in its own output section. */ __exidx_start = .; @@ -72,8 +78,11 @@ SECTIONS .dtors : { PROVIDE(__dtors_start__ = .); - KEEP(*(SORT(.dtors.*))) - KEEP(*(.dtors)) + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) PROVIDE(__dtors_end__ = .); } @@ -81,8 +90,33 @@ SECTIONS __data_start = .; .data : { - *(.data) - *(.data.*) + *(vtable) + *(.data*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ *(.gnu.linkonce.d*) } __data_end = .; @@ -92,7 +126,11 @@ SECTIONS . = ALIGN(4); __bss_start = .; - .bss : { *(.bss) } + .bss : + { + *(.bss*) + *(COMMON) + } __bss_end = .; /* stabs debugging sections. */ @@ -110,4 +148,4 @@ SECTIONS .debug_aranges 0 : { *(.debug_aranges) } _end = .; -} +} \ No newline at end of file diff --git a/firmware/rtconfig.h b/firmware/rtconfig.h index 682819c..8eeb854 100644 --- a/firmware/rtconfig.h +++ b/firmware/rtconfig.h @@ -98,7 +98,7 @@ #define RT_DFS_ELM_REENTRANT #define RT_USING_DFS_DEVFS #define RT_USING_DFS_NET -/* HAVE_SYS_SELECT_H is not set */ +#define HAVE_SYS_SELECT_H /* HAVE_SYS_SOCKET_H is not set */ /* RT_USING_DFS_ROMFS is not set */ /* RT_USING_DFS_RAMFS is not set */ @@ -128,6 +128,10 @@ /* RT_USING_ENC28J60 is not set */ /* RT_USING_SPI_WIFI is not set */ #define RT_USING_WDT +#define RT_USING_WIFI + +/* Using USB */ + /* RT_USING_USB_HOST is not set */ /* RT_USING_USB_DEVICE is not set */ @@ -219,11 +223,11 @@ /* Marvell WiFi */ -/* PKG_USING_MARVELLWIFI is not set */ +/* PKG_USING_WLANMARVELL is not set */ /* Wiced WiFi */ -/* PKG_USING_WLAN_WICED is not set */ +/* PKG_USING_WLANWICED is not set */ /* security packages */ @@ -259,7 +263,6 @@ #define RT_USING_ISP #define RT_USING_SADC #define RT_USING_PWM -#define RT_USING_WIFI #define SOC_FH8620 #define FH_USING_ADVAPI_MD #define FH_USING_ADVAPI_ISP diff --git a/firmware/rtconfig.py b/firmware/rtconfig.py index f3fd567..b3f1a9c 100644 --- a/firmware/rtconfig.py +++ b/firmware/rtconfig.py @@ -10,7 +10,7 @@ PLATFORM = 'gcc' LD_NAME = 'link' -EXEC_PATH = r'arm-2014.05/bin' +EXEC_PATH = r'env\tools\gnu_gcc\arm_gcc\mingw\bin' if os.getenv('RTT_EXEC_PATH'): EXEC_PATH = os.getenv('RTT_EXEC_PATH') @@ -39,14 +39,14 @@ CFLAGS += ' -fno-strict-aliasing ' CFLAGS += ' -Wno-address ' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__ASSEMBLY__' - LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map='+ OUTPUT_NAME +'.map,-cref,-u,_start -T' + LD_NAME +'.ld' + LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map='+ OUTPUT_NAME +'.map,-cref,-u,_start -T' + LD_NAME +'.ld' CPATH = '' LPATH = '' if BUILD == 'debug': CFLAGS += ' -O0 -gdwarf-2 ' AFLAGS += ' -gdwarf-2' else: - CFLAGS += ' -O2' + CFLAGS += ' -Os' CXXFLAGS = CFLAGS POST_ACTION = OBJCPY + ' -O binary $TARGET '+ OUTPUT_NAME +'.bin\n' + SIZE + ' $TARGET \n' @@ -55,4 +55,4 @@ M_CXXFLAGS = CXXFLAGS.replace('-O0 -gdwarf-2', '-O2') + ' -mlong-calls -fPIC' M_LFLAGS = DEVICE + CXXFLAGS + ' -Wl,--gc-sections,-z,max-page-size=0x4' +\ ' -shared -fPIC -nostartfiles -static-libgcc' - M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n' + M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n' \ No newline at end of file From d4d64a433011c790f522ba3bdaf98639be93cb97 Mon Sep 17 00:00:00 2001 From: SummerGift <459994202@qq.com> Date: Sat, 18 Nov 2017 12:54:27 +0800 Subject: [PATCH 3/3] update firmware/Kconfig --- firmware/Kconfig | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/firmware/Kconfig b/firmware/Kconfig index d4b650b..91ab91c 100644 --- a/firmware/Kconfig +++ b/firmware/Kconfig @@ -27,23 +27,23 @@ config RT_USING_UART2 default y config RT_USING_GC1024 - bool "Using GC1024 sensor" + bool "Enable GC1024 sensor" default y config RT_USING_FH_DMA - bool "Using Fullhan DMA" + bool "Enable Fullhan DMA" default y config RT_USING_DMA_MEM - bool "DMA memory management" + bool "Enable DMA memory management" default y config RT_USING_FH_ACW - bool "Using Fullhan ACW driver" + bool "Enable Fullhan ACW driver" default y config CONFIG_CHIP_FH8620 - bool "Fullhan FH8620 chip" + bool "Enable Fullhan FH8620 chip" default y config CONFIG_BOARD_IOTCAM @@ -55,15 +55,15 @@ config CONFIG_PLAT_V2 default y config RT_USING_DSP - bool "DSP" + bool "Enable DSP" default y config RT_USING_ISP - bool "ISP" + bool "Enable ISP" default y config RT_USING_SFUD - bool "SFUD" + bool "Enable SFUD" default y if RT_USING_SFUD @@ -79,36 +79,32 @@ config RT_USING_SFUD endif config RT_USING_SADC - bool "SADC driver" + bool "Enable SADC driver" default y config RT_USING_PWM - bool "PWM driver" + bool "Enable PWM driver" default y -config RT_USING_WIFI - bool "Support WiFi" - default y - - if RT_USING_WIFI - config SOC_FH8620 - bool "Enable SOC_FH8620" - default y - help - please use online packages iot/wifi/wiced also - endif +if RT_USING_WIFI + config SOC_FH8620 + bool "Enable SOC_FH8620" + default y + help + please use online packages iot/wifi/wiced also +endif config FH_USING_ADVAPI_MD - bool "Advance MD API" + bool "Enable Advance MD API" default y config FH_USING_ADVAPI_ISP - bool "Advance ISP API" + bool "Enable Advance ISP API" default y config FH_USING_RTSP - bool "RTSP protocol" + bool "Enable RTSP protocol" default y if FH_USING_RTSP