800*320工程文件+初始demo提交
This commit is contained in:
173
SW/examples/application/bootloader/Inc/FreeRTOSConfig.h
Normal file
173
SW/examples/application/bootloader/Inc/FreeRTOSConfig.h
Normal file
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* FreeRTOS V202112.00
|
||||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
See http://www.freertos.org/a00110.html for an explanation of the
|
||||
definitions contained in this file.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* http://www.freertos.org/a00110.html
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#include "app_config.h"
|
||||
|
||||
extern uint32_t SystemCoreClock;
|
||||
|
||||
/* Cortex M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
|
||||
/* Constants related to the behaviour or the scheduler. */
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_TIME_SLICING 1
|
||||
#define configMAX_PRIORITIES ( FREERTOS_MAX_PRIORITY )
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_16_BIT_TICKS 0 /* Only for 8 and 16-bit hardware. */
|
||||
|
||||
/* Constants that describe the hardware and memory usage. */
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 128 )
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configMAX_TASK_NAME_LEN ( 12 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 50 * 1024 ) )
|
||||
|
||||
/* Constants that build features in or out. */
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_QUEUE_SETS 1
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
|
||||
/* Constants that define which hook (callback) functions should be used. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 1
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||
|
||||
/* Constants provided for debugging and optimisation assistance. */
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
|
||||
/* Software timer definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY ( 3 )
|
||||
#define configTIMER_QUEUE_LENGTH 5
|
||||
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
* to exclude the API function. NOTE: Setting an INCLUDE_ parameter to 0 is
|
||||
* only necessary if the linker does not automatically remove functions that are
|
||||
* not referenced anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskAbortDelay 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTaskGetHandle 1
|
||||
#define INCLUDE_eTaskGetState 1
|
||||
#define INCLUDE_xTaskResumeFromISR 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* This demo makes use of one or more example stats formatting functions. These
|
||||
* format the raw data provided by the uxTaskGetSystemState() function in to
|
||||
* human readable ASCII form. See the notes in the implementation of vTaskList()
|
||||
* within FreeRTOS/Source/tasks.c for limitations. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
||||
/* Dimensions a buffer that can be used by the FreeRTOS+CLI command interpreter.
|
||||
* See the FreeRTOS+CLI documentation for more information:
|
||||
* http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_CLI/ */
|
||||
#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2048
|
||||
|
||||
/* Interrupt priority configuration follows...................... */
|
||||
|
||||
/* Use the system definition, if there is one. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 3 /* 8 priority levels. */
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
* function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
* routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT
|
||||
* CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
|
||||
* HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values). */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
* to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
* See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << ( 8 - configPRIO_BITS ) )
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* Constants related to the generation of run time stats. */
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
extern volatile unsigned int CPU_RunTime;
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() CPU_RunTime
|
||||
#endif
|
||||
|
||||
/* Enable static allocation. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
14
SW/examples/application/bootloader/Inc/app_at.h
Normal file
14
SW/examples/application/bootloader/Inc/app_at.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef _APP_AT_H
|
||||
#define _APP_AT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "driver_uart.h"
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length);
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
#endif // _APP_AT_H
|
19
SW/examples/application/bootloader/Inc/app_ble.h
Normal file
19
SW/examples/application/bootloader/Inc/app_ble.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _APP_BLE_H
|
||||
#define _APP_BLE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "gap_api.h"
|
||||
|
||||
void app_ble_init(void);
|
||||
|
||||
void app_ble_advertising_start(uint8_t adv_chn);
|
||||
void app_ble_advertising_stop(uint8_t adv_chn);
|
||||
|
||||
void app_ble_scan_start(void);
|
||||
void app_ble_scan_stop(void);
|
||||
|
||||
void app_ble_conn_start(struct gap_ble_addr *addr);
|
||||
void app_ble_conn_stop(void);
|
||||
|
||||
#endif // _APP_BLE_H
|
67
SW/examples/application/bootloader/Inc/app_btdm.h
Normal file
67
SW/examples/application/bootloader/Inc/app_btdm.h
Normal file
@ -0,0 +1,67 @@
|
||||
#ifndef _APP_BTDM_H
|
||||
#define _APP_BTDM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
enum {
|
||||
APP_BTDM_EVT_BLE_CONNECTED,
|
||||
APP_BTDM_EVT_BLE_DISCONNECTED,
|
||||
|
||||
APP_BTDM_EVT_BT_CONNECTED,
|
||||
APP_BTDM_EVT_BT_DISCONNECTED,
|
||||
APP_BTDM_EVT_HF_INCOMING,
|
||||
APP_BTDM_EVT_HF_CALL_ACTIVE,
|
||||
APP_BTDM_EVT_HF_CALL_REMOVE,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STARTED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_STOPPED,
|
||||
APP_BTDM_EVT_A2DP_STREAM_DATA,
|
||||
APP_BTDM_EVT_AVRCP_VOL_CHANGE,
|
||||
APP_BTDM_EVT_AVRCP_NEXT,
|
||||
APP_BTDM_EVT_AVRCP_PREV,
|
||||
APP_BTDM_EVT_AVRCP_PAUSE,
|
||||
APP_BTDM_EVT_AVRCP_FAST_FORWARD,
|
||||
APP_BTDM_EVT_AVRCP_FAST_BACKWARD,
|
||||
APP_BTDM_EVT_SCO_CREATED,
|
||||
APP_BTDM_EVT_SCO_REMOVED,
|
||||
APP_BTDM_EVT_SCO_DATA,
|
||||
};
|
||||
|
||||
enum {
|
||||
APP_BTDM_CODEC_SBC,
|
||||
APP_BTDM_CODEC_AAC,
|
||||
APP_BTDM_CODEC_mSBC,
|
||||
APP_BTDM_CODEC_PCM,
|
||||
APP_BTDM_CODEC_UNKNOWN,
|
||||
};
|
||||
|
||||
struct app_btdm_event_t {
|
||||
uint8_t event;
|
||||
union {
|
||||
struct {
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} a2dp_data;
|
||||
struct {
|
||||
uint8_t codec_type;
|
||||
uint32_t sample_rate;
|
||||
} a2dp_codec;
|
||||
struct {
|
||||
bool valid;
|
||||
uint8_t codec_type;
|
||||
uint8_t *buffer;
|
||||
uint32_t length;
|
||||
} sco_data;
|
||||
struct {
|
||||
void *hf_channel;
|
||||
uint8_t codec_type;
|
||||
} sco_codec;
|
||||
} param;
|
||||
};
|
||||
|
||||
typedef void (*app_btdm_callback_t)(struct app_btdm_event_t *e);
|
||||
|
||||
void app_btdm_start(void);
|
||||
void app_btdm_init(void);
|
||||
|
||||
#endif // _APP_BTDM_H
|
122
SW/examples/application/bootloader/Inc/app_config.h
Normal file
122
SW/examples/application/bootloader/Inc/app_config.h
Normal file
@ -0,0 +1,122 @@
|
||||
#ifndef _APP_CONFIG_H
|
||||
#define _APP_CONFIG_H
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= SYSTEM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> SYSTEM Configuration
|
||||
|
||||
// <o> SYSTEM_CLOCK_SEL
|
||||
// <i> used to define system working clock
|
||||
// <24000000=> 24MHz
|
||||
// <48000000=> 48MHz
|
||||
// <96000000=> 96MHz
|
||||
// <144000000=> 144MHz
|
||||
// <192000000=> 192MHz
|
||||
// <240000000=> 240MHz
|
||||
#define SYSTEM_CLOCK_SEL 24000000
|
||||
|
||||
|
||||
#define BOARD_EVB_FR5090 1
|
||||
#define BOARD_EVB_FR3092E 2
|
||||
#define BOARD_EVB_FR3092E_CM 3
|
||||
// <o> BOARD_SEL
|
||||
// <i> board EVB selection, default: BOARD_EVB_FR5090
|
||||
// <1=> BOARD_EVB_FR5090
|
||||
// <2=> BOARD_EVB_FR3092E
|
||||
// <3=> BOARD_EVB_FR3092E_CM
|
||||
#define BOARD_SEL 3
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= FreeRTOS configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> FreeRTOS Configuration
|
||||
|
||||
// <o> ENABLE_RTOS_MONITOR
|
||||
// <i> check to enable or disable RTOS monitor, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define ENABLE_RTOS_MONITOR 0
|
||||
|
||||
// <o> FREERTOS_MAX_PRIORITY
|
||||
// <i> used to define priority of monitor task
|
||||
// <1-10:1>
|
||||
#define FREERTOS_MAX_PRIORITY 10
|
||||
|
||||
// <o> MONITOR_TASK_PRIORITY
|
||||
// <i> used to define priority of monitor task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define MONITOR_TASK_PRIORITY 1
|
||||
#if MONITOR_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "MONITOR_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> APP_TASK_PRIORITY
|
||||
// <i> used to define priority of app task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define APP_TASK_PRIORITY 2
|
||||
#if APP_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "APP_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> HOST_TASK_PRIORITY
|
||||
// <i> used to define priority of host task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define HOST_TASK_PRIORITY 5
|
||||
#if HOST_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "HOST_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> RPMSG_TASK_PRIORITY
|
||||
// <i> used to define priority of rpmsg task, should not be larger than FREERTOS_MAX_PRIORITY
|
||||
#define RPMSG_TASK_PRIORITY 6
|
||||
#if RPMSG_TASK_PRIORITY > FREERTOS_MAX_PRIORITY
|
||||
#error "RPMSG_TASK_PRIORITY should not be larger than FREERTOS_MAX_PRIORITY"
|
||||
#endif
|
||||
|
||||
// <o> MONITOR_TASK_STACK_SIZE
|
||||
// <i> used to define priority of monitor task
|
||||
#define MONITOR_TASK_STACK_SIZE 128
|
||||
|
||||
// <o> APP_TASK_STACK_SIZE
|
||||
// <i> used to define priority of APP task
|
||||
#define APP_TASK_STACK_SIZE 256
|
||||
|
||||
// <o> HOST_TASK_STACK_SIZE
|
||||
// <i> used to define priority of btdm-host task
|
||||
#define HOST_TASK_STACK_SIZE 2048
|
||||
|
||||
// <o> RPMSG_TASK_STACK_SIZE
|
||||
// <i> used to define priority of RPMSG task
|
||||
#define RPMSG_TASK_STACK_SIZE 2048
|
||||
|
||||
// </h>
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= BTDM configuration ========= */
|
||||
/* ========================================================== */
|
||||
|
||||
// <h> BTDM STACK Configuration
|
||||
|
||||
// <o> BTDM_STACK_ENABLE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <0=> DISABLE
|
||||
// <1=> ENABLE
|
||||
#define BTDM_STACK_ENABLE 1
|
||||
|
||||
// <o> BTDM_STACK_HCI_BAUDRATE
|
||||
// <i> check to enable or disable bluetooth, default: DISABLE
|
||||
// <1500000=> 1500000
|
||||
// <921600=> 921600
|
||||
// <460800=> 460800
|
||||
// <115200=> 115200
|
||||
#define BTDM_STACK_HCI_BAUDRATE 1500000
|
||||
|
||||
// </h>
|
||||
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
#endif // _APP_CONFIG_H
|
112
SW/examples/application/bootloader/Inc/app_ota.h
Normal file
112
SW/examples/application/bootloader/Inc/app_ota.h
Normal file
@ -0,0 +1,112 @@
|
||||
#ifndef APP_OTA_H
|
||||
#define APP_OTA_H
|
||||
#include <stdint.h>
|
||||
#include "fr30xx.h"
|
||||
/******************************************************************************
|
||||
* MACROS (ºê¶¨Òå)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (³£Á¿¶¨Òå)
|
||||
*/
|
||||
#define DOCUMENT_CHECK 1
|
||||
#define BOOT_A_INFO_ADDRESS 0
|
||||
#define BOOT_B_INFO_ADDRESS 0x1000
|
||||
|
||||
#define BOOTLOADER_IMG_RSV_SIZE (220*1024)
|
||||
#define OTA_B_STORAGE_ADDRESS ((4+4)*1024 + BOOTLOADER_IMG_RSV_SIZE)
|
||||
#define IMAGE_INFO_RSV_SIZE 0x2000 //8K
|
||||
#define APP_CODE_INFO_OFFSET 0x148
|
||||
#define IMGAE_INFO_SIZE 0x10
|
||||
#define OTA_BOOT_INFO_ADDRESS (OTA_B_STORAGE_ADDRESS + BOOTLOADER_IMG_RSV_SIZE)
|
||||
#define APP_CODE_STORAGE_ADDRESS (OTA_BOOT_INFO_ADDRESS+IMAGE_INFO_RSV_SIZE)
|
||||
#define RETARGET_APP_CODE_ADDRESS (FLASH_DAC_BASE+APP_CODE_STORAGE_ADDRESS) //APPµØÖ·
|
||||
#define FILE_CODE_ADDRESS_OFFSET IMGAE_INFO_SIZE
|
||||
|
||||
#define FLASH_SIZE 0x200000 // flash 2M
|
||||
#define DSP_CODE_MAX_SIZE (256*1024) // the maximun size of DSP code
|
||||
#define CONTROLLER_CODE_MAX_SIZE (80*1024) // the maximun size of CONTROLLER code
|
||||
#define BOOT_CODE_MAX_SIZE BOOTLOADER_IMG_RSV_SIZE // the maximun size of BOOT
|
||||
#define APP_CODE_MAX_SIZE (FLASH_SIZE-DSP_CODE_MAX_SIZE-CONTROLLER_CODE_MAX_SIZE) // the maximun size of APP
|
||||
|
||||
#define DSP_STORAGE_ADDRESS (FLASH_SIZE-DSP_CODE_MAX_SIZE)
|
||||
#define CONTROLLER_STORAGE_ADDRESS (DSP_STORAGE_ADDRESS-CONTROLLER_CODE_MAX_SIZE)
|
||||
|
||||
#define OTA_START_TIMOUT 5000
|
||||
#define OTA_ADV_TIMEOUT 1000*60*1
|
||||
|
||||
#define OTA_HDR_RESULT_LEN 1
|
||||
#define OTA_HDR_OPCODE_LEN 1
|
||||
#define OTA_HDR_LENGTH_LEN 2
|
||||
|
||||
/*file type*/
|
||||
#define FILE_TYPE_APP 0x01
|
||||
#define FILE_TYPE_CONTROLLER 0x02
|
||||
#define FILE_TYPE_DSP 0x04
|
||||
typedef enum
|
||||
{
|
||||
OTA_CMD_NVDS_TYPE,
|
||||
OTA_CMD_GET_STR_BASE,
|
||||
OTA_CMD_READ_FW_VER, //read firmware version
|
||||
OTA_CMD_PAGE_ERASE,
|
||||
OTA_CMD_CHIP_ERASE,
|
||||
OTA_CMD_WRITE_DATA,
|
||||
OTA_CMD_READ_DATA,
|
||||
OTA_CMD_WRITE_MEM,
|
||||
OTA_CMD_READ_MEM,
|
||||
OTA_CMD_REBOOT,
|
||||
OTA_CMD_START,
|
||||
OTA_CMD_NULL,
|
||||
} ota_cmd_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FILE_BOOT_LOADER =1,
|
||||
FILE_APP,
|
||||
FILE_CONTROLLER,
|
||||
FILE_DSP,
|
||||
}ota_file_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OTA_RSP_SUCCESS,
|
||||
OTA_RSP_ERROR,
|
||||
OTA_RSP_UNKNOWN_CMD,
|
||||
}ota_rsp_t;
|
||||
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (ÀàÐͶ¨Òå)
|
||||
*/
|
||||
struct app_otas_status_t
|
||||
{
|
||||
uint8_t read_opcode;
|
||||
uint8_t length;
|
||||
uint32_t base_addr;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t MSP;
|
||||
volatile uint32_t Reset_Handler;
|
||||
}str_CoreRemapStart_t;
|
||||
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (È«¾Ö±äÁ¿)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* FUNCTION DESCRIPTION
|
||||
*/
|
||||
uint16_t app_otas_read_data(uint8_t *p_data);
|
||||
void app_otas_recv_data(uint8_t conidx,uint8_t *p_data,uint16_t len);
|
||||
void ota_init(void);
|
||||
void ota_deinit(void);
|
||||
void ota_set_imagesize(uint32_t imagesize);
|
||||
uint32_t ota_get_imagesize(void);
|
||||
void platform_reset(void);
|
||||
void ota_check(void);
|
||||
void jump_to_app(void);
|
||||
void check_file_integrity(void);
|
||||
void ota_info_init(void);
|
||||
void ota_boot_start(void);
|
||||
#endif
|
72
SW/examples/application/bootloader/Inc/app_ota_service.h
Normal file
72
SW/examples/application/bootloader/Inc/app_ota_service.h
Normal file
@ -0,0 +1,72 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 2023, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef APP_OTA_SERVICE
|
||||
#define APP_OTA_SERVICE
|
||||
|
||||
/*******************************************************************************
|
||||
* INCLUDES (<28><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MACROS (<28>궨<EFBFBD><EAB6A8>)
|
||||
*/
|
||||
#define OTA_SVC_UUID {0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTA_CHAR_UUID_TX {0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_RX {0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_NOTI {0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_VERSION_INFO {0x03, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTAS_MAX_DATA_SIZE 600
|
||||
#define OTAS_NOTIFY_DATA_SIZE 20
|
||||
|
||||
/*******************************************************************************
|
||||
* CONSTANTS (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OTA_ATT_IDX_SERVICE,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO,
|
||||
OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_NOTI,
|
||||
OTA_ATT_IDX_CHAR_VALUE_NOTI,
|
||||
OTA_ATT_IDX_CHAR_CFG_NOTI,
|
||||
OTA_IDX_CHAR_USER_DESCRIPTION_NOTI,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_TX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_TX,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_RX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_RX,
|
||||
|
||||
OTA_ATT_NB,
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* TYPEDEFS (<28><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* GLOBAL VARIABLES (ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* LOCAL VARIABLES (<28><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* PUBLIC FUNCTIONS (ȫ<>ֺ<EFBFBD><D6BA><EFBFBD>)
|
||||
*/
|
||||
void ota_gatt_add_service(void);
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len);
|
||||
void adv_timeout_TimerStop(void);
|
||||
#endif
|
27
SW/examples/application/bootloader/Inc/app_task.h
Normal file
27
SW/examples/application/bootloader/Inc/app_task.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _APP_TASK_H
|
||||
#define _APP_TASK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "co_list.h"
|
||||
|
||||
#define APP_TASK_EVENT_AT_CMD 0x00
|
||||
#define APP_TASK_EVENT_HOST_INITED 0x01
|
||||
|
||||
struct app_task_event {
|
||||
struct co_list_hdr hdr;
|
||||
|
||||
uint8_t event_type;
|
||||
|
||||
uint16_t param_len;
|
||||
uint8_t param[];
|
||||
};
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high);
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block);
|
||||
|
||||
void app_task_init(void);
|
||||
|
||||
#endif // _APP_TASK_H
|
38
SW/examples/application/bootloader/Inc/fal_cfg.h
Normal file
38
SW/examples/application/bootloader/Inc/fal_cfg.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-05-17 armink the first version
|
||||
*/
|
||||
|
||||
#ifndef _FAL_CFG_H_
|
||||
#define _FAL_CFG_H_
|
||||
|
||||
#define FAL_DEBUG 1
|
||||
#define FAL_PART_HAS_TABLE_CFG
|
||||
#define FAL_USING_SFUD_PORT
|
||||
|
||||
#define NOR_FLASH_DEV_NAME "norflash0"
|
||||
|
||||
/* ===================== Flash device Configuration ========================= */
|
||||
extern const struct fal_flash_dev onchip_flash;
|
||||
//extern struct fal_flash_dev nor_flash0;
|
||||
|
||||
/* flash device table */
|
||||
#define FAL_FLASH_DEV_TABLE \
|
||||
{ \
|
||||
&onchip_flash, \
|
||||
}
|
||||
/* ====================== Partition Configuration ========================== */
|
||||
#ifdef FAL_PART_HAS_TABLE_CFG
|
||||
/* partition table */
|
||||
#define FAL_PART_TABLE \
|
||||
{ \
|
||||
{FAL_PART_MAGIC_WORD, "FlashEnv", "flashdb_onchip", 0x001AC000 - 12*1024, 12*1024, 0}, \
|
||||
}
|
||||
#endif /* FAL_PART_HAS_TABLE_CFG */
|
||||
|
||||
#endif /* _FAL_CFG_H_ */
|
@ -0,0 +1,24 @@
|
||||
|
||||
/*
|
||||
* Auto generated Run-Time-Environment Configuration File
|
||||
* *** Do not modify ! ***
|
||||
*
|
||||
* Project: 'boot_load'
|
||||
* Target: 'Project'
|
||||
*/
|
||||
|
||||
#ifndef RTE_COMPONENTS_H
|
||||
#define RTE_COMPONENTS_H
|
||||
|
||||
|
||||
/*
|
||||
* Define the Device Header File:
|
||||
*/
|
||||
#define CMSIS_device_header "ARMCM33_DSP_FP.h"
|
||||
|
||||
/* Keil.ARM Compiler::Compiler:I/O:STDERR:Breakpoint:1.2.0 */
|
||||
#define RTE_Compiler_IO_STDERR /* Compiler I/O: STDERR */
|
||||
#define RTE_Compiler_IO_STDERR_BKPT /* Compiler I/O: STDERR Breakpoint */
|
||||
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
1923
SW/examples/application/bootloader/MDK-ARM/boot_load.uvguix.LH
Normal file
1923
SW/examples/application/bootloader/MDK-ARM/boot_load.uvguix.LH
Normal file
File diff suppressed because one or more lines are too long
996
SW/examples/application/bootloader/MDK-ARM/boot_load.uvoptx
Normal file
996
SW/examples/application/bootloader/MDK-ARM/boot_load.uvoptx
Normal file
@ -0,0 +1,996 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
|
||||
|
||||
<SchemaVersion>1.0</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Extensions>
|
||||
<cExt>*.c</cExt>
|
||||
<aExt>*.s*; *.src; *.a*</aExt>
|
||||
<oExt>*.obj; *.o</oExt>
|
||||
<lExt>*.lib</lExt>
|
||||
<tExt>*.txt; *.h; *.inc; *.md</tExt>
|
||||
<pExt>*.plm</pExt>
|
||||
<CppX>*.cpp; *.cc; *.cxx</CppX>
|
||||
<nMigrate>0</nMigrate>
|
||||
</Extensions>
|
||||
|
||||
<DaveTm>
|
||||
<dwLowDateTime>0</dwLowDateTime>
|
||||
<dwHighDateTime>0</dwHighDateTime>
|
||||
</DaveTm>
|
||||
|
||||
<Target>
|
||||
<TargetName>Project</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>0</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
<RunAbUc>0</RunAbUc>
|
||||
</OPTTT>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<FlashByte>65535</FlashByte>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
</OPTHX>
|
||||
<OPTLEX>
|
||||
<PageWidth>79</PageWidth>
|
||||
<PageLength>66</PageLength>
|
||||
<TabStop>8</TabStop>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
</OPTLEX>
|
||||
<ListingPage>
|
||||
<CreateCListing>1</CreateCListing>
|
||||
<CreateAListing>1</CreateAListing>
|
||||
<CreateLListing>1</CreateLListing>
|
||||
<CreateIListing>0</CreateIListing>
|
||||
<AsmCond>1</AsmCond>
|
||||
<AsmSymb>1</AsmSymb>
|
||||
<AsmXref>0</AsmXref>
|
||||
<CCond>1</CCond>
|
||||
<CCode>0</CCode>
|
||||
<CListInc>0</CListInc>
|
||||
<CSymb>0</CSymb>
|
||||
<LinkerCodeListing>0</LinkerCodeListing>
|
||||
</ListingPage>
|
||||
<OPTXL>
|
||||
<LMap>1</LMap>
|
||||
<LComments>1</LComments>
|
||||
<LGenerateSymbols>1</LGenerateSymbols>
|
||||
<LLibSym>1</LLibSym>
|
||||
<LLines>1</LLines>
|
||||
<LLocSym>1</LLocSym>
|
||||
<LPubSym>1</LPubSym>
|
||||
<LXref>0</LXref>
|
||||
<LExpSel>0</LExpSel>
|
||||
</OPTXL>
|
||||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>0</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
<sLdApp>1</sLdApp>
|
||||
<sGomain>1</sGomain>
|
||||
<sRbreak>1</sRbreak>
|
||||
<sRwatch>1</sRwatch>
|
||||
<sRmem>1</sRmem>
|
||||
<sRfunc>1</sRfunc>
|
||||
<sRbox>1</sRbox>
|
||||
<tLdApp>1</tLdApp>
|
||||
<tGomain>1</tGomain>
|
||||
<tRbreak>1</tRbreak>
|
||||
<tRwatch>1</tRwatch>
|
||||
<tRmem>1</tRmem>
|
||||
<tRfunc>0</tRfunc>
|
||||
<tRbox>1</tRbox>
|
||||
<tRtrace>1</tRtrace>
|
||||
<sRSysVw>1</sRSysVw>
|
||||
<tRSysVw>1</tRSysVw>
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>13</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
<sDlgPa></sDlgPa>
|
||||
<sIfile></sIfile>
|
||||
<tDll></tDll>
|
||||
<tDllPa></tDllPa>
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2V8M.DLL</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2V8M</Key>
|
||||
<Name>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>0</periodic>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
<viewmode>0</viewmode>
|
||||
<vrSel>0</vrSel>
|
||||
<aSym>0</aSym>
|
||||
<aTbox>0</aTbox>
|
||||
<AscS1>0</AscS1>
|
||||
<AscS2>0</AscS2>
|
||||
<AscS3>0</AscS3>
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>0</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
<TrcWin>0</TrcWin>
|
||||
<newCpu>0</newCpu>
|
||||
<uProt>0</uProt>
|
||||
</DebugFlag>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<bLintAuto>0</bLintAuto>
|
||||
<bAutoGenD>0</bAutoGenD>
|
||||
<LntExFlags>0</LntExFlags>
|
||||
<pMisraName></pMisraName>
|
||||
<pszMrule></pszMrule>
|
||||
<pSingCmds></pSingCmds>
|
||||
<pMultCmds></pMultCmds>
|
||||
<pMisraNamep></pMisraNamep>
|
||||
<pszMrulep></pszMrulep>
|
||||
<pSingCmdsp></pSingCmdsp>
|
||||
<pMultCmdsp></pMultCmdsp>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>1</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\cmsis\core_cm33.h</PathWithFileName>
|
||||
<FilenameWithoutPath>core_cm33.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>appp</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_task.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_task.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_btdm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_btdm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_at.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_at.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_hw.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_hw.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>ota</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_ota_service.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_ota_service.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\app_ota.c</PathWithFileName>
|
||||
<FilenameWithoutPath>app_ota.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>common/btdm</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\btdm_mem.c</PathWithFileName>
|
||||
<FilenameWithoutPath>btdm_mem.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\SWD.c</PathWithFileName>
|
||||
<FilenameWithoutPath>SWD.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\host.c</PathWithFileName>
|
||||
<FilenameWithoutPath>host.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\controller_code.s</PathWithFileName>
|
||||
<FilenameWithoutPath>controller_code.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\btdm\controller_bootloader.c</PathWithFileName>
|
||||
<FilenameWithoutPath>controller_bootloader.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>common/flashdb</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\flashdb\fal_flash_port.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash_port.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\common\flashdb\fdb_app.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_app.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/device</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>system_fr30xx.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\fr30xx.h</PathWithFileName>
|
||||
<FilenameWithoutPath>fr30xx.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>5</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.h</PathWithFileName>
|
||||
<FilenameWithoutPath>system_fr30xx.h</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>6</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\device\fr30xx\armcc\startup_fr30xx.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_fr30xx.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/peripheral</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_cali.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_cali.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_frspim.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_frspim.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_gpio.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_gpio.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_pmu.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_pmu.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_qspi.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_qspi.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_uart.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_uart.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_timer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_timer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_pmu_iwdt.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_pmu_iwdt.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_spi_master.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_spi_master.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_i2c.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_i2c.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>7</GroupNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\peripheral\Src\driver_dma.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_dma.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/btdm</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileType>4</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\btdm\btdm_host.lib</PathWithFileName>
|
||||
<FilenameWithoutPath>btdm_host.lib</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/common</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_log.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_log.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\common\src\co_util.c</PathWithFileName>
|
||||
<FilenameWithoutPath>co_util.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>9</GroupNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\heap\heap.c</PathWithFileName>
|
||||
<FilenameWithoutPath>heap.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/flashdb</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_file.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_file.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>39</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_kvdb.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_kvdb.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>40</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_utils.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fdb_utils.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>41</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>42</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>10</GroupNumber>
|
||||
<FileNumber>43</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_partition.c</PathWithFileName>
|
||||
<FilenameWithoutPath>fal_partition.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>module/freertos</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>44</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\croutine.c</PathWithFileName>
|
||||
<FilenameWithoutPath>croutine.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>45</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\event_groups.c</PathWithFileName>
|
||||
<FilenameWithoutPath>event_groups.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>46</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\list.c</PathWithFileName>
|
||||
<FilenameWithoutPath>list.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>47</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\queue.c</PathWithFileName>
|
||||
<FilenameWithoutPath>queue.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>48</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\stream_buffer.c</PathWithFileName>
|
||||
<FilenameWithoutPath>stream_buffer.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>49</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\tasks.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tasks.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>50</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\timers.c</PathWithFileName>
|
||||
<FilenameWithoutPath>timers.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>51</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\port.c</PathWithFileName>
|
||||
<FilenameWithoutPath>port.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>52</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ\portasm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>portasm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>53</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\portable\MemMang\heap_6.c</PathWithFileName>
|
||||
<FilenameWithoutPath>heap_6.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>54</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\freertos_sleep.c</PathWithFileName>
|
||||
<FilenameWithoutPath>freertos_sleep.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>11</GroupNumber>
|
||||
<FileNumber>55</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\modules\FreeRTOS\cpu_context.s</PathWithFileName>
|
||||
<FilenameWithoutPath>cpu_context.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>driver/bsp</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>56</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\display\driver_display.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_display.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>57</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\touchpad\driver_touchpad.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_touchpad.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>58</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\spi_flash\IC_W25Qxx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>IC_W25Qxx.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>59</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\spi_flash\ext_flash.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ext_flash.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>12</GroupNumber>
|
||||
<FileNumber>60</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\..\components\drivers\bsp\display\driver_sh8601z.c</PathWithFileName>
|
||||
<FilenameWithoutPath>driver_sh8601z.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>1</RteFlg>
|
||||
</Group>
|
||||
|
||||
</ProjectOpt>
|
778
SW/examples/application/bootloader/MDK-ARM/boot_load.uvprojx
Normal file
778
SW/examples/application/bootloader/MDK-ARM/boot_load.uvprojx
Normal file
@ -0,0 +1,778 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
|
||||
|
||||
<SchemaVersion>2.1</SchemaVersion>
|
||||
|
||||
<Header>### uVision Project, (C) Keil Software</Header>
|
||||
|
||||
<Targets>
|
||||
<Target>
|
||||
<TargetName>Project</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>6140000::V6.14::ARMCLANG</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>ARMCM33_DSP_FP</Device>
|
||||
<Vendor>ARM</Vendor>
|
||||
<PackID>ARM.CMSIS.5.7.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x20200000,0x00020000) IROM(0x00000000,0x00200000) IROM2(0x00200000,0x00200000) CPUTYPE("Cortex-M33") FPU3(SFPU) DSP CLOCK(12000000) ESEL ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2V8M(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:ARMCM33_DSP_FP$Device\ARM\ARMCM33\Include\ARMCM33_DSP_FP.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
<Linker></Linker>
|
||||
<OHString></OHString>
|
||||
<InfinionOptionDll></InfinionOptionDll>
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
<LibPath></LibPath>
|
||||
<RegisterFilePath></RegisterFilePath>
|
||||
<DBRegisterFilePath></DBRegisterFilePath>
|
||||
<TargetStatus>
|
||||
<Error>0</Error>
|
||||
<ExitCodeStop>0</ExitCodeStop>
|
||||
<ButtonStop>0</ButtonStop>
|
||||
<NotGenerated>0</NotGenerated>
|
||||
<InvalidFlash>1</InvalidFlash>
|
||||
</TargetStatus>
|
||||
<OutputDirectory>.\Objects\</OutputDirectory>
|
||||
<OutputName>boot_load</OutputName>
|
||||
<CreateExecutable>1</CreateExecutable>
|
||||
<CreateLib>0</CreateLib>
|
||||
<CreateHexFile>0</CreateHexFile>
|
||||
<DebugInformation>1</DebugInformation>
|
||||
<BrowseInformation>1</BrowseInformation>
|
||||
<ListingPath>.\Listings\</ListingPath>
|
||||
<HexFormatSelection>1</HexFormatSelection>
|
||||
<Merge32K>0</Merge32K>
|
||||
<CreateBatchFile>0</CreateBatchFile>
|
||||
<BeforeCompile>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopU1X>0</nStopU1X>
|
||||
<nStopU2X>0</nStopU2X>
|
||||
</BeforeCompile>
|
||||
<BeforeMake>
|
||||
<RunUserProg1>0</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name></UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
<RunUserProg2>0</RunUserProg2>
|
||||
<UserProg1Name>"..\..\..\..\components\tools\keil\post_process.bat" "@L" "#L" "$J"</UserProg1Name>
|
||||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopA1X>0</nStopA1X>
|
||||
<nStopA2X>0</nStopA2X>
|
||||
</AfterMake>
|
||||
<SelectedForBatchBuild>0</SelectedForBatchBuild>
|
||||
<SVCSIdString></SVCSIdString>
|
||||
</TargetCommonOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>0</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>1</IncludeInBuild>
|
||||
<AlwaysBuild>0</AlwaysBuild>
|
||||
<GenerateAssemblyFile>0</GenerateAssemblyFile>
|
||||
<AssembleAssemblyFile>0</AssembleAssemblyFile>
|
||||
<PublicsOnly>0</PublicsOnly>
|
||||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName></SimDllName>
|
||||
<SimDllArguments></SimDllArguments>
|
||||
<SimDlgDll></SimDlgDll>
|
||||
<SimDlgDllArguments></SimDlgDllArguments>
|
||||
<TargetDllName>SARMV8M.DLL</TargetDllName>
|
||||
<TargetDllArguments> -MPU</TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM33</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
<DebugOption>
|
||||
<OPTHX>
|
||||
<HexSelection>1</HexSelection>
|
||||
<HexRangeLowAddress>0</HexRangeLowAddress>
|
||||
<HexRangeHighAddress>0</HexRangeHighAddress>
|
||||
<HexOffset>0</HexOffset>
|
||||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
</DebugOption>
|
||||
<Utilities>
|
||||
<Flash1>
|
||||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4101</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2V8M.DLL</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
<GenerateListings>0</GenerateListings>
|
||||
<asHll>1</asHll>
|
||||
<asAsm>1</asAsm>
|
||||
<asMacX>1</asMacX>
|
||||
<asSyms>1</asSyms>
|
||||
<asFals>1</asFals>
|
||||
<asDbgD>1</asDbgD>
|
||||
<asForm>1</asForm>
|
||||
<ldLst>0</ldLst>
|
||||
<ldmm>1</ldmm>
|
||||
<ldXref>1</ldXref>
|
||||
<BigEnd>0</BigEnd>
|
||||
<AdsALst>1</AdsALst>
|
||||
<AdsACrf>1</AdsACrf>
|
||||
<AdsANop>0</AdsANop>
|
||||
<AdsANot>0</AdsANot>
|
||||
<AdsLLst>1</AdsLLst>
|
||||
<AdsLmap>1</AdsLmap>
|
||||
<AdsLcgr>1</AdsLcgr>
|
||||
<AdsLsym>1</AdsLsym>
|
||||
<AdsLszi>1</AdsLszi>
|
||||
<AdsLtoi>1</AdsLtoi>
|
||||
<AdsLsun>1</AdsLsun>
|
||||
<AdsLven>1</AdsLven>
|
||||
<AdsLsxf>1</AdsLsxf>
|
||||
<RvctClst>0</RvctClst>
|
||||
<GenPPlst>0</GenPPlst>
|
||||
<AdsCpuType>"Cortex-M33"</AdsCpuType>
|
||||
<RvctDeviceName></RvctDeviceName>
|
||||
<mOS>0</mOS>
|
||||
<uocRom>0</uocRom>
|
||||
<uocRam>0</uocRam>
|
||||
<hadIROM>1</hadIROM>
|
||||
<hadIRAM>1</hadIRAM>
|
||||
<hadXRAM>0</hadXRAM>
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>2</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>1</hadIRAM2>
|
||||
<hadIROM2>1</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
<useUlib>1</useUlib>
|
||||
<EndSel>1</EndSel>
|
||||
<uLtcg>0</uLtcg>
|
||||
<nSecure>0</nSecure>
|
||||
<RoSelD>3</RoSelD>
|
||||
<RwSelD>4</RwSelD>
|
||||
<CodeSel>0</CodeSel>
|
||||
<OptFeed>0</OptFeed>
|
||||
<NoZi1>0</NoZi1>
|
||||
<NoZi2>0</NoZi2>
|
||||
<NoZi3>0</NoZi3>
|
||||
<NoZi4>0</NoZi4>
|
||||
<NoZi5>0</NoZi5>
|
||||
<Ro1Chk>0</Ro1Chk>
|
||||
<Ro2Chk>0</Ro2Chk>
|
||||
<Ro3Chk>0</Ro3Chk>
|
||||
<Ir1Chk>1</Ir1Chk>
|
||||
<Ir2Chk>0</Ir2Chk>
|
||||
<Ra1Chk>0</Ra1Chk>
|
||||
<Ra2Chk>0</Ra2Chk>
|
||||
<Ra3Chk>0</Ra3Chk>
|
||||
<Im1Chk>1</Im1Chk>
|
||||
<Im2Chk>0</Im2Chk>
|
||||
<OnChipMemories>
|
||||
<Ocm1>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm1>
|
||||
<Ocm2>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm2>
|
||||
<Ocm3>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm3>
|
||||
<Ocm4>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm4>
|
||||
<Ocm5>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm5>
|
||||
<Ocm6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</Ocm6>
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x200000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</XRAM>
|
||||
<OCR_RVCT1>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT1>
|
||||
<OCR_RVCT2>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT2>
|
||||
<OCR_RVCT3>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT3>
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x60000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x1ffc0000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT5>
|
||||
<OCR_RVCT6>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT6>
|
||||
<OCR_RVCT7>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT7>
|
||||
<OCR_RVCT8>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x0</Size>
|
||||
</OCR_RVCT8>
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0xa0000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20200000</StartAddress>
|
||||
<Size>0x20000</Size>
|
||||
</OCR_RVCT10>
|
||||
</OnChipMemories>
|
||||
<RvctStartVector></RvctStartVector>
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>3</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>3</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>0</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>6</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
<vShortEn>1</vShortEn>
|
||||
<vShortWch>1</vShortWch>
|
||||
<v6Lto>0</v6Lto>
|
||||
<v6WtE>0</v6WtE>
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\..\..\..\components\btdm;..\..\..\..\components\btdm\include;..\..\..\..\components\drivers\cmsis;..\..\..\..\components\drivers\device;..\..\..\..\components\drivers\device\fr30xx;..\..\..\..\components\drivers\peripheral\Inc;..\..\..\..\components\modules\FlashDB\flashdb\inc;..\..\..\..\components\modules\FlashDB\port\fal\inc;..\..\..\..\components\modules\FreeRTOS\include;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure;..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ;..\..\..\common\flashdb;..\Inc;..\..\..\common\btdm;..\..\..\..\components\modules\common\include;..\..\..\..\components\modules\heap;..\..\..\..\components\drivers\bsp\display;..\..\..\..\components\drivers\bsp\touchpad;..\..\..\..\components\drivers\bsp\spi_flash</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
<interw>1</interw>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<thumb>0</thumb>
|
||||
<SplitLS>0</SplitLS>
|
||||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<ClangAsOpt>4</ClangAsOpt>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Aads>
|
||||
<LDads>
|
||||
<umfTarg>0</umfTarg>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<noStLib>0</noStLib>
|
||||
<RepFail>1</RepFail>
|
||||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile>..\..\..\..\components\tools\keil\xip_flash_add_psram.sct</ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
</TargetArmAds>
|
||||
</TargetOption>
|
||||
<Groups>
|
||||
<Group>
|
||||
<GroupName>CMSIS</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>core_cm33.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\cmsis\core_cm33.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>appp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>main.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\main.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_task.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_task.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_btdm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_btdm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_at.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_at.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_hw.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_hw.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>ota</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>app_ota_service.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_ota_service.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_ota.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\app_ota.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_mem.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\btdm_mem.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>SWD.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\SWD.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>host.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\host.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_code.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_code.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>controller_bootloader.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\btdm\controller_bootloader.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>common/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fal_flash_port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fal_flash_port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_app.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\common\flashdb\fdb_app.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/device</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>system_fr30xx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>system_fr30xx.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\system_fr30xx.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>startup_fr30xx.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\device\fr30xx\armcc\startup_fr30xx.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/peripheral</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>driver_cali.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_cali.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_frspim.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_frspim.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_gpio.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_gpio.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_qspi.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_qspi.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_uart.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_uart.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_timer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_timer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_pmu_iwdt.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_pmu_iwdt.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_spi_master.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_spi_master.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_i2c.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_i2c.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_dma.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\peripheral\Src\driver_dma.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/btdm</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>btdm_host.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>..\..\..\..\components\btdm\btdm_host.lib</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/common</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>co_list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_log.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_log.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>co_util.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\common\src\co_util.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>heap.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\heap\heap.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/flashdb</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>fdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_file.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_file.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_kvdb.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_kvdb.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fdb_utils.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\flashdb\src\fdb_utils.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>fal_partition.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FlashDB\port\fal\src\fal_partition.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>module/freertos</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>croutine.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\croutine.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>event_groups.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\event_groups.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>list.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\list.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>queue.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\queue.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>stream_buffer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\stream_buffer.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>tasks.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\tasks.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>port.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>portasm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\ARMv8M\non_secure\portable\GCC\ARM_CM33_NTZ\portasm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>heap_6.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\portable\MemMang\heap_6.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>freertos_sleep.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\freertos_sleep.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>cpu_context.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>..\..\..\..\components\modules\FreeRTOS\cpu_context.s</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>driver/bsp</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>driver_display.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\display\driver_display.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_touchpad.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\touchpad\driver_touchpad.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>IC_W25Qxx.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\spi_flash\IC_W25Qxx.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ext_flash.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\spi_flash\ext_flash.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>driver_sh8601z.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\..\components\drivers\bsp\display\driver_sh8601z.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::Compiler</GroupName>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cbundle="ARM Compiler" Cclass="Compiler" Cgroup="I/O" Csub="STDERR" Cvariant="Breakpoint" Cvendor="Keil" Cversion="1.2.0" condition="ARMCC Cortex-M">
|
||||
<package name="ARM_Compiler" schemaVersion="1.4.9" url="http://www.keil.com/pack/" vendor="Keil" version="1.6.2"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Project"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
</components>
|
||||
<files/>
|
||||
</RTE>
|
||||
|
||||
<LayerInfo>
|
||||
<Layers>
|
||||
<Layer>
|
||||
<LayName><Project Info></LayName>
|
||||
<LayDesc></LayDesc>
|
||||
<LayUrl></LayUrl>
|
||||
<LayKeys></LayKeys>
|
||||
<LayCat></LayCat>
|
||||
<LayLic></LayLic>
|
||||
<LayTarg>0</LayTarg>
|
||||
<LayPrjMark>1</LayPrjMark>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</LayerInfo>
|
||||
|
||||
</Project>
|
BIN
SW/examples/application/bootloader/OTA Boot使用说明.doc
Normal file
BIN
SW/examples/application/bootloader/OTA Boot使用说明.doc
Normal file
Binary file not shown.
BIN
SW/examples/application/bootloader/OTA Boot样例使用说明.doc
Normal file
BIN
SW/examples/application/bootloader/OTA Boot样例使用说明.doc
Normal file
Binary file not shown.
356
SW/examples/application/bootloader/customer_ota/ota.c
Normal file
356
SW/examples/application/bootloader/customer_ota/ota.c
Normal file
@ -0,0 +1,356 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 20203, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
//#include <core_cm33.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
#include "co_util.h"
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
|
||||
#include "ota.h"
|
||||
#include "ota_service.h"
|
||||
|
||||
/******************************************************************************
|
||||
* MACROS (宏定义)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (常量定义)
|
||||
*/
|
||||
#define PMU_REG_FLASH_VDD_CTRL 0xFB
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (类型定义)
|
||||
*/
|
||||
__PACKED_STRUCT ota_ongoing_t{
|
||||
uint8_t type;
|
||||
uint8_t start_flag;
|
||||
uint8_t erase_flag;
|
||||
uint8_t mac_addr[6];
|
||||
};
|
||||
__PACKED_STRUCT ota_file_version_t{
|
||||
uint32_t otaboot_version;
|
||||
uint32_t app_version;
|
||||
uint32_t controller_version;
|
||||
uint32_t dsp_version;
|
||||
};
|
||||
__PACKED_STRUCT file_info_t{
|
||||
uint32_t file_version;
|
||||
uint32_t file_storage_base;
|
||||
uint32_t file_length;
|
||||
uint32_t file_crc;
|
||||
};
|
||||
__PACKED_STRUCT ota_info_t{
|
||||
uint8_t first_check_flag[4];
|
||||
uint8_t file_type; //烧录文件中,所包含的文件类型
|
||||
struct file_info_t boot_file_info;
|
||||
struct file_info_t app_file_info;
|
||||
struct file_info_t controller_file_info;
|
||||
struct file_info_t dsp_file_info;
|
||||
uint8_t controller_flag;
|
||||
struct ota_ongoing_t ota_ongoing;
|
||||
uint32_t rsv[10];
|
||||
};
|
||||
|
||||
__PACKED_STRUCT firmware_version
|
||||
{
|
||||
uint32_t firmware_version;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT storage_baseaddr
|
||||
{
|
||||
uint32_t baseaddr;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT page_erase_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_mem_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_mem_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_data_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_data_rsp
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT ota_start_rsp
|
||||
{
|
||||
uint32_t ota_start;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT ota_finish_rsp
|
||||
{
|
||||
uint32_t ota_finsih_state;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT app_ota_rsp_hdr_t
|
||||
{
|
||||
uint8_t result;
|
||||
uint8_t org_opcode;
|
||||
uint16_t length;
|
||||
__PACKED union
|
||||
{
|
||||
uint8_t nvds_type;
|
||||
struct firmware_version version;
|
||||
struct storage_baseaddr baseaddr;
|
||||
struct page_erase_rsp page_erase;
|
||||
struct write_mem_rsp write_mem;
|
||||
struct read_mem_rsp read_mem;
|
||||
struct write_data_rsp write_data;
|
||||
struct read_data_rsp read_data;
|
||||
struct ota_finish_rsp finsih_rsp;
|
||||
struct ota_start_rsp ota_start;
|
||||
} __attribute__((packed)) rsp;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT page_erase_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_mem_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_mem_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT write_data_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT read_data_cmd
|
||||
{
|
||||
uint32_t base_address;
|
||||
uint16_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT firmware_check
|
||||
{
|
||||
uint32_t firmware_length;
|
||||
uint32_t CRC32_data;
|
||||
} __attribute__((packed));
|
||||
__PACKED_STRUCT app_ota_cmd_hdr_t
|
||||
{
|
||||
uint8_t opcode;
|
||||
uint16_t length;
|
||||
__PACKED union
|
||||
{
|
||||
struct page_erase_cmd page_erase;
|
||||
struct write_mem_cmd write_mem;
|
||||
struct read_mem_cmd read_mem;
|
||||
struct write_data_cmd write_data;
|
||||
struct read_data_cmd read_data;
|
||||
struct firmware_check fir_crc_data;
|
||||
} __attribute__((packed)) cmd;
|
||||
} __attribute__((packed));
|
||||
|
||||
__PACKED_STRUCT otas_send_rsp
|
||||
{
|
||||
uint8_t conidx;
|
||||
uint16_t length;
|
||||
uint8_t *buffer;
|
||||
};
|
||||
/******************************************************************************
|
||||
* LOCAL VARIABLES (局部变量)
|
||||
*/
|
||||
static struct ota_info_t * ota_info;
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (全局变量)
|
||||
*/
|
||||
extern uint8_t ble_static_addr[6];
|
||||
/******************************************************************************
|
||||
* LOCAL FUNCTIONS (本地函数)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* EXTERN FUNCTIONS (外部函数)
|
||||
*/
|
||||
extern void wdt_rst_start(void);
|
||||
|
||||
void show_reg(uint8_t *buffer,uint16_t length)
|
||||
{
|
||||
for(int i = 0; i < length; i++)
|
||||
{
|
||||
printf("%02x ",buffer[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
void ota_check_file_init(void)
|
||||
{
|
||||
ota_info = pvPortMalloc(sizeof(struct ota_info_t));
|
||||
flash_read(QSPI0,OTA_BOOT_INFO_ADDRESS,sizeof(struct ota_info_t),(uint8_t *)ota_info);
|
||||
}
|
||||
|
||||
void ota_deinit(void)
|
||||
{
|
||||
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn app_otas_recv_data
|
||||
*
|
||||
* @brief Otas Data handler
|
||||
*
|
||||
*/
|
||||
void app_otas_recv_data(uint8_t conidx,uint8_t *p_data,uint16_t len)
|
||||
{
|
||||
struct app_ota_cmd_hdr_t *cmd_hdr = (struct app_ota_cmd_hdr_t *)p_data;
|
||||
struct app_ota_rsp_hdr_t *rsp_hdr;
|
||||
uint16_t rsp_data_len = (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN+OTA_HDR_RESULT_LEN);
|
||||
switch(cmd_hdr->opcode)
|
||||
{
|
||||
case OTA_CMD_NVDS_TYPE:
|
||||
rsp_data_len += 1;
|
||||
break;
|
||||
case OTA_CMD_GET_STR_BASE:
|
||||
rsp_data_len += sizeof(struct storage_baseaddr);
|
||||
break;
|
||||
case OTA_CMD_READ_FW_VER:
|
||||
rsp_data_len += sizeof(struct firmware_version);
|
||||
break;
|
||||
case OTA_CMD_PAGE_ERASE:
|
||||
rsp_data_len += sizeof(struct page_erase_rsp);
|
||||
break;
|
||||
case OTA_CMD_WRITE_DATA:
|
||||
rsp_data_len += sizeof(struct write_data_rsp);
|
||||
break;
|
||||
case OTA_CMD_READ_DATA:
|
||||
rsp_data_len += sizeof(struct read_data_rsp);
|
||||
break;
|
||||
case OTA_CMD_WRITE_MEM:
|
||||
rsp_data_len += sizeof(struct write_mem_rsp);
|
||||
break;
|
||||
case OTA_CMD_READ_MEM:
|
||||
rsp_data_len += sizeof(struct read_mem_rsp);
|
||||
break;
|
||||
case OTA_CMD_START:
|
||||
rsp_data_len += sizeof(struct ota_start_rsp);
|
||||
break;
|
||||
case OTA_CMD_NULL:
|
||||
|
||||
return;
|
||||
}
|
||||
struct otas_send_rsp *req = pvPortMalloc(sizeof(struct otas_send_rsp));
|
||||
uint16_t base_length;
|
||||
req->conidx = conidx;
|
||||
req->length = rsp_data_len;
|
||||
req->buffer = pvPortMalloc(rsp_data_len);
|
||||
rsp_hdr = (struct app_ota_rsp_hdr_t *)&req->buffer[0];
|
||||
rsp_hdr->result = OTA_RSP_SUCCESS;
|
||||
rsp_hdr->org_opcode = cmd_hdr->opcode;
|
||||
rsp_hdr->length = rsp_data_len - (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN+OTA_HDR_RESULT_LEN);
|
||||
|
||||
switch(cmd_hdr->opcode)
|
||||
{
|
||||
case OTA_CMD_NVDS_TYPE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_GET_STR_BASE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_READ_FW_VER:
|
||||
{
|
||||
uint8_t type;
|
||||
type = *(p_data + (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN));
|
||||
switch(type)
|
||||
{
|
||||
case FILE_BOOT_LOADER:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->boot_file_info.file_version;
|
||||
break;
|
||||
|
||||
case FILE_APP:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->app_file_info.file_version;
|
||||
break;
|
||||
|
||||
case FILE_CONTROLLER:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->controller_file_info.file_version;
|
||||
break;
|
||||
case FILE_DSP:
|
||||
rsp_hdr->rsp.version.firmware_version = ota_info->dsp_file_info.file_version;
|
||||
break;
|
||||
}
|
||||
printf("version:%x",rsp_hdr->rsp.version.firmware_version);
|
||||
}
|
||||
break;
|
||||
case OTA_CMD_PAGE_ERASE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_CHIP_ERASE:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_WRITE_DATA:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_READ_DATA:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_WRITE_MEM:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_READ_MEM:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_REBOOT:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
case OTA_CMD_START:
|
||||
{
|
||||
uint8_t ota_type;
|
||||
ota_type = *(p_data + (OTA_HDR_OPCODE_LEN+OTA_HDR_LENGTH_LEN));
|
||||
printf("ota type:%d\r\n",ota_type);
|
||||
ota_info->ota_ongoing.type = ota_type;
|
||||
|
||||
ota_info->ota_ongoing.start_flag = 0x01;
|
||||
ota_info->ota_ongoing.erase_flag = 0;
|
||||
memcpy(ota_info->ota_ongoing.mac_addr,ble_static_addr,6);
|
||||
flash_erase(QSPI0,OTA_BOOT_INFO_ADDRESS,0x1000);
|
||||
flash_write(QSPI0,OTA_BOOT_INFO_ADDRESS,sizeof(struct ota_info_t),(uint8_t *)ota_info);
|
||||
wdt_rst_start();
|
||||
rsp_hdr->rsp.ota_start.ota_start = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rsp_hdr->result = OTA_RSP_ERROR;
|
||||
break;
|
||||
}
|
||||
ota_gatt_report_notify(conidx,req->buffer,req->length);
|
||||
vPortFree(req->buffer);
|
||||
vPortFree(req);
|
||||
}
|
||||
|
||||
|
||||
|
78
SW/examples/application/bootloader/customer_ota/ota.h
Normal file
78
SW/examples/application/bootloader/customer_ota/ota.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef OTA_H
|
||||
#define OTA_H
|
||||
#include <stdint.h>
|
||||
#include <cmsis_armclang.h>
|
||||
#define OTA_BOOT_INFO_ADDRESS 0x64000
|
||||
#define OTA_B_STORAGE_ADDRESS 0x32000
|
||||
#define APP_CODE_STORAGE_ADDRESS 0x66000
|
||||
#define RETARGET_APP_CODE_ADDRESS 0x08066000 //APP地址
|
||||
#define APP_CODE_INFO_OFFSET 0x148
|
||||
#define IMGAE_INFO_SIZE 0x10
|
||||
#define FILE_CODE_ADDRESS_OFFSET IMGAE_INFO_SIZE
|
||||
|
||||
|
||||
#define FLASH_SIZE 0x400000 // 2M
|
||||
#define DSP_SIZE (152*1024) // DSP SIZE 152k
|
||||
#define CONTROLLER_SIZE (64*1024)
|
||||
|
||||
#define DSP_STORAGE_ADDRESS (FLASH_SIZE-DSP_SIZE)
|
||||
#define CONTROLLER_STORAGE_ADDRESS (DSP_STORAGE_ADDRESS-CONTROLLER_SIZE)
|
||||
|
||||
|
||||
#define DSP_START_ADDRESS (DSP_STORAGE_ADDRESS+FILE_CODE_ADDRESS_OFFSET)
|
||||
#define CONTROLLER_START_ADDRESS (CONTROLLER_STORAGE_ADDRESS+FILE_CODE_ADDRESS_OFFSET)
|
||||
|
||||
#define OTA_HDR_RESULT_LEN 1
|
||||
#define OTA_HDR_OPCODE_LEN 1
|
||||
#define OTA_HDR_LENGTH_LEN 2
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OTA_CMD_NVDS_TYPE,
|
||||
OTA_CMD_GET_STR_BASE,
|
||||
OTA_CMD_READ_FW_VER, //read firmware version
|
||||
OTA_CMD_PAGE_ERASE,
|
||||
OTA_CMD_CHIP_ERASE,
|
||||
OTA_CMD_WRITE_DATA,
|
||||
OTA_CMD_READ_DATA,
|
||||
OTA_CMD_WRITE_MEM,
|
||||
OTA_CMD_READ_MEM,
|
||||
OTA_CMD_REBOOT,
|
||||
OTA_CMD_START,
|
||||
OTA_CMD_NULL,
|
||||
} ota_cmd_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FILE_BOOT_LOADER =1,
|
||||
FILE_APP,
|
||||
FILE_CONTROLLER,
|
||||
FILE_DSP,
|
||||
}ota_file_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OTA_RSP_SUCCESS,
|
||||
OTA_RSP_ERROR,
|
||||
OTA_RSP_UNKNOWN_CMD,
|
||||
}ota_rsp_t;
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (类型定义)
|
||||
*/
|
||||
struct app_otas_status_t
|
||||
{
|
||||
uint8_t read_opcode;
|
||||
uint8_t length;
|
||||
uint32_t base_addr;
|
||||
};
|
||||
|
||||
__PACKED_STRUCT file_head_info_t{
|
||||
uint8_t check[4];
|
||||
uint32_t version;
|
||||
uint32_t code_length;
|
||||
uint32_t crc;
|
||||
};
|
||||
|
||||
void app_otas_recv_data(uint8_t conidx,uint8_t *p_data,uint16_t len);
|
||||
void ota_check_file_init(void);
|
||||
#endif
|
218
SW/examples/application/bootloader/customer_ota/ota_service.c
Normal file
218
SW/examples/application/bootloader/customer_ota/ota_service.c
Normal file
@ -0,0 +1,218 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 20203, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDES (包含头文件)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "co_util.h"
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
#include "ota_service.h"
|
||||
#include "ota.h"
|
||||
/******************************************************************************
|
||||
* MACROS (宏定义)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (常量定义)
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (类型定义)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* LOCAL VARIABLES (局部变量)
|
||||
*/
|
||||
static const uint8_t ota_svc_uuid[UUID_SIZE_16] = OTA_SVC_UUID;
|
||||
static bool ota_link_ntf_enable = false;
|
||||
static uint8_t ota_svc_id = 0;
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (全局变量)
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Profile Attributes - Table
|
||||
* 每一项都是一个attribute的定义。
|
||||
* 第一个attribute为Service 的的定义。
|
||||
* 每一个特征值(characteristic)的定义,都至少包含三个attribute的定义;
|
||||
* 1. 特征值声明(Characteristic Declaration)
|
||||
* 2. 特征值的值(Characteristic value)
|
||||
* 3. 特征值描述符(Characteristic description)
|
||||
* 如果有notification 或者indication 的功能,则会包含四个attribute的定义,除了前面定义的三个,还会有一个特征值客户端配置(client characteristic configuration)。
|
||||
*
|
||||
*/
|
||||
const gatt_attribute_t ota_svc_att_table[OTA_ATT_NB] =
|
||||
{
|
||||
// Update Over The AIR Service Declaration
|
||||
[OTA_ATT_IDX_SERVICE] = { { UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID) },
|
||||
GATT_PROP_READ,UUID_SIZE_16, (uint8_t *)ota_svc_uuid
|
||||
},
|
||||
|
||||
// OTA Information Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO]= { { UUID_SIZE_16, OTA_CHAR_UUID_VERSION_INFO },
|
||||
GATT_PROP_READ, sizeof(uint16_t), NULL
|
||||
},
|
||||
|
||||
// Notify Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ,0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_NOTI] = { { UUID_SIZE_16, OTA_CHAR_UUID_NOTI },
|
||||
GATT_PROP_READ | GATT_PROP_NOTI, OTAS_NOTIFY_DATA_SIZE, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_CFG_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID) },
|
||||
GATT_PROP_READ | GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, 0,0
|
||||
},
|
||||
[OTA_IDX_CHAR_USER_DESCRIPTION_NOTI]= { { UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) },
|
||||
GATT_PROP_READ, 12, NULL
|
||||
},
|
||||
|
||||
// Tx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_TX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_TX] = { { UUID_SIZE_16, OTA_CHAR_UUID_TX },
|
||||
GATT_PROP_READ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
|
||||
// Rx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_RX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_RX] = { { UUID_SIZE_16, OTA_CHAR_UUID_RX },
|
||||
GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
};
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_msg_handler
|
||||
*
|
||||
* @brief Ota Profile callback funtion for GATT messages. GATT read/write
|
||||
* operations are handeled here.
|
||||
*
|
||||
* @param gatt_msg -GATT messages from GATT layer.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
static uint16_t ota_gatt_msg_handler(struct gatt_msg *p_msg)
|
||||
{
|
||||
switch(p_msg->msg_evt)
|
||||
{
|
||||
case GATTS_MSG_READ_REQ:
|
||||
if(p_msg->att_idx == OTA_IDX_CHAR_USER_DESCRIPTION_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "OTA Response", strlen("OTA Response"));
|
||||
return strlen("OTA Response");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "ntf_enable", strlen("ntf_enable"));
|
||||
return strlen("ntf_enable");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_TX)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "user_ota", strlen("user_ota"));
|
||||
return strlen("user_ota");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO) //get version
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "\x00\x01", strlen("\x00\x01"));
|
||||
return strlen("\x00\x01");
|
||||
}
|
||||
break;
|
||||
|
||||
case GATTS_MSG_WRITE_REQ:
|
||||
if(p_msg->att_idx == OTA_ATT_IDX_CHAR_CFG_NOTI)
|
||||
{
|
||||
|
||||
if(*(uint16_t *)p_msg->param.gatt_data.p_msg_data == 0x1)
|
||||
{
|
||||
printf("true\r\n");
|
||||
ota_link_ntf_enable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("false\r\n");
|
||||
ota_link_ntf_enable = false;
|
||||
}
|
||||
}
|
||||
else if(p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_RX)
|
||||
{
|
||||
app_otas_recv_data(p_msg->conn_idx,p_msg->param.gatt_data.p_msg_data,p_msg->param.gatt_data.msg_len);
|
||||
}
|
||||
break;
|
||||
case GATTC_MSG_CMP_EVT:
|
||||
break;
|
||||
case GATTC_MSG_LINK_CREATE:
|
||||
break;
|
||||
case GATTC_MSG_LINK_LOST:
|
||||
ota_link_ntf_enable = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_report_notify
|
||||
*
|
||||
* @brief Send ota protocol response data.
|
||||
*
|
||||
*
|
||||
* @param conidx - report idx of the hid_rpt_info array.
|
||||
* p_data - data of the Ota information to be sent.
|
||||
* len - length of the HID information data.
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len)
|
||||
{
|
||||
if (ota_link_ntf_enable)
|
||||
{
|
||||
struct gatt_send_event ntf;
|
||||
ntf.conidx = conidx;
|
||||
ntf.svc_id = ota_svc_id;
|
||||
ntf.att_idx = OTA_ATT_IDX_CHAR_VALUE_NOTI;
|
||||
ntf.data_len = len;
|
||||
ntf.p_data = p_data;
|
||||
gatt_notification(&ntf);
|
||||
}
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_add_service
|
||||
*
|
||||
* @brief Ota Profile add GATT service function.
|
||||
* 添加GATT service到ATT的数据库里面。
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void ota_gatt_add_service(void)
|
||||
{
|
||||
gatt_service_t ota_profie_svc;
|
||||
ota_profie_svc.p_att_tb = ota_svc_att_table;
|
||||
ota_profie_svc.att_nb = OTA_ATT_NB;
|
||||
ota_profie_svc.gatt_msg_handler = ota_gatt_msg_handler;
|
||||
|
||||
ota_svc_id = gatt_add_service(&ota_profie_svc);
|
||||
ota_check_file_init();
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
#ifndef OTA_SERVICE_H
|
||||
#define OTA_SERVICE_H
|
||||
/*******************************************************************************
|
||||
* INCLUDES (<28><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MACROS (<28>궨<EFBFBD><EAB6A8>)
|
||||
*/
|
||||
#define OTA_SVC_UUID {0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTA_CHAR_UUID_TX {0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_RX {0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_NOTI {0x02, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
#define OTA_CHAR_UUID_VERSION_INFO {0x03, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x02}
|
||||
|
||||
#define OTAS_MAX_DATA_SIZE 600
|
||||
#define OTAS_NOTIFY_DATA_SIZE 20
|
||||
|
||||
/*******************************************************************************
|
||||
* CONSTANTS (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OTA_ATT_IDX_SERVICE,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO,
|
||||
OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_NOTI,
|
||||
OTA_ATT_IDX_CHAR_VALUE_NOTI,
|
||||
OTA_ATT_IDX_CHAR_CFG_NOTI,
|
||||
OTA_IDX_CHAR_USER_DESCRIPTION_NOTI,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_TX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_TX,
|
||||
|
||||
OTA_ATT_IDX_CHAR_DECLARATION_RX,
|
||||
OTA_ATT_IDX_CHAR_VALUE_RX,
|
||||
|
||||
OTA_ATT_NB,
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* TYPEDEFS (<28><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* GLOBAL VARIABLES (ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* LOCAL VARIABLES (<28><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* PUBLIC FUNCTIONS (ȫ<>ֺ<EFBFBD><D6BA><EFBFBD>)
|
||||
*/
|
||||
void ota_gatt_add_service(void);
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len);
|
||||
|
||||
#endif
|
320
SW/examples/application/bootloader/src/app_at.c
Normal file
320
SW/examples/application/bootloader/src/app_at.c
Normal file
@ -0,0 +1,320 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "co_util.h"
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "me_api.h"
|
||||
#include "hfg_api.h"
|
||||
#include "gatt_api.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_ble.h"
|
||||
|
||||
#define AT_RECV_MAX_LEN 32
|
||||
|
||||
static uint8_t app_at_recv_char;
|
||||
static uint8_t at_recv_buffer[AT_RECV_MAX_LEN];
|
||||
static uint8_t at_recv_index = 0;
|
||||
static uint8_t at_recv_state = 0;
|
||||
|
||||
void btdm_host_send_vendor_cmd(uint8_t type, uint8_t length, void *data);
|
||||
|
||||
void btdm_host_vendor_cmd_cmp_evt(uint8_t status, uint8_t len, uint8_t const *param)
|
||||
{
|
||||
printf("status: 0x%02x.\r\n", status);
|
||||
for (uint32_t i=0; i<len; i++) {
|
||||
printf("%02x ", param[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_A(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd)
|
||||
{
|
||||
// case 'A':
|
||||
// {
|
||||
// mac_addr_t addr;
|
||||
// addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
// addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
// addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
// addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
// addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
// addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
// gap_start_conn(&addr, ascii_strn2val((const char *)&data[12], 16, 2), 64, 64, 0, 500);
|
||||
// }
|
||||
// break;
|
||||
// case 'B':
|
||||
// {
|
||||
// gap_stop_conn();
|
||||
// }
|
||||
// break;
|
||||
case 'A':
|
||||
{
|
||||
uint8_t addr = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x00, 1, &addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'B':
|
||||
{
|
||||
uint8_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
btdm_host_send_vendor_cmd(0x01, 2, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'C':
|
||||
{
|
||||
uint32_t addr = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x02, 4, (void *)&addr);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
uint32_t buffer[2];
|
||||
buffer[0] = ascii_strn2val((const char *)&data[0], 16, 8);
|
||||
buffer[1] = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
btdm_host_send_vendor_cmd(0x03, 8, (void *)&buffer[0]);
|
||||
}
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'G':
|
||||
printf("hello world!\r\n");
|
||||
break;
|
||||
case 'H':
|
||||
printf("VAL: 0x%08x.\r\n", *(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8));
|
||||
break;
|
||||
case 'I':
|
||||
*(volatile uint32_t *)ascii_strn2val((const char *)&data[0], 16, 8) = ascii_strn2val((const char *)&data[9], 16, 8);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'J':
|
||||
printf("OOL VAL: 0x%02x.\r\n", ool_read(ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
break;
|
||||
case 'K':
|
||||
ool_write(ascii_strn2val((const char *)&data[0], 16, 2), ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
case 'L':
|
||||
printf("VAL: 0x%02x.\r\n", *(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)));
|
||||
break;
|
||||
case 'M':
|
||||
*(volatile uint8_t *)(ascii_strn2val((const char *)&data[0], 16, 8)) = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
printf("OK\r\n");
|
||||
break;
|
||||
// case 'P':
|
||||
// co_printf("VAL: 0x%02x.\r\n", *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)));
|
||||
// break;
|
||||
// case 'Q':
|
||||
// *(uint8_t *)(MODEM_BASE + ascii_strn2val((const char *)&data[0], 16, 2)) = ascii_strn2val((const char *)&data[3], 16, 2);
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
// case 'S':
|
||||
// co_printf("VAL: 0x%02x.\r\n", frspim_rd(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1));
|
||||
// break;
|
||||
// case 'T':
|
||||
// frspim_wr(FR_SPI_RF_COB_CHAN, ascii_strn2val((const char *)&data[0], 16, 2), 1, ascii_strn2val((const char *)&data[3], 16, 2));
|
||||
// co_printf("OK\r\n");
|
||||
// break;
|
||||
case 'U':
|
||||
{
|
||||
uint32_t *ptr = (uint32_t *)(ascii_strn2val((const char *)&data[0], 16, 8) & (~3));
|
||||
uint8_t count = ascii_strn2val((const char *)&data[9], 16, 2);
|
||||
uint32_t *start = (uint32_t *)((uint32_t)ptr & (~0x0f));
|
||||
for(uint8_t i=0; i<count;) {
|
||||
if(((uint32_t)start & 0x0c) == 0) {
|
||||
printf("0x%08x: ", (uint32_t)start);
|
||||
}
|
||||
if(start < ptr) {
|
||||
printf(" ");
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
printf("%08x", *start);
|
||||
}
|
||||
if(((uint32_t)start & 0x0c) == 0x0c) {
|
||||
printf("\r\n");
|
||||
}
|
||||
else {
|
||||
printf(" ");
|
||||
}
|
||||
start++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'V':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char *)&data[0], 16, 8), ascii_strn2val((const char *)&data[9], 16, 8));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_B(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
struct gap_ble_addr peer_addr;
|
||||
BD_ADDR addr;
|
||||
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
// AT#BA00
|
||||
//app_ble_advertising_start(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'B':
|
||||
// AT#BB01
|
||||
//app_ble_advertising_stop(ascii_strn2val((const char *)&data[0], 16, 2));
|
||||
break;
|
||||
case 'C':
|
||||
//app_ble_scan_start();
|
||||
break;
|
||||
case 'D':
|
||||
//app_ble_scan_stop();
|
||||
break;
|
||||
case 'E':
|
||||
// AT#BE0123456789ab_01
|
||||
peer_addr.addr.addr[5] = ascii_strn2val((const char *)&data[0], 16, 2);
|
||||
peer_addr.addr.addr[4] = ascii_strn2val((const char *)&data[2], 16, 2);
|
||||
peer_addr.addr.addr[3] = ascii_strn2val((const char *)&data[4], 16, 2);
|
||||
peer_addr.addr.addr[2] = ascii_strn2val((const char *)&data[6], 16, 2);
|
||||
peer_addr.addr.addr[1] = ascii_strn2val((const char *)&data[8], 16, 2);
|
||||
peer_addr.addr.addr[0] = ascii_strn2val((const char *)&data[10], 16, 2);
|
||||
peer_addr.addr_type = ascii_strn2val((const char *)&data[13], 16, 2);
|
||||
//app_ble_conn_start(&peer_addr);
|
||||
break;
|
||||
case 'F':
|
||||
//app_ble_conn_stop();
|
||||
break;
|
||||
case 'H':
|
||||
ME_Inquiry(BT_IAC_GIAC, 5, 5);
|
||||
break;
|
||||
case 'I':
|
||||
ME_CancelInquiry();
|
||||
break;
|
||||
case 'J':
|
||||
{
|
||||
BtStatus status;
|
||||
addr.A[0] = ascii_strn2val((const char*)&data[0],16,2);
|
||||
addr.A[1] = ascii_strn2val((const char*)&data[2],16,2);
|
||||
addr.A[2] = ascii_strn2val((const char*)&data[4],16,2);
|
||||
addr.A[3] = ascii_strn2val((const char*)&data[6],16,2);
|
||||
addr.A[4] = ascii_strn2val((const char*)&data[8],16,2);
|
||||
addr.A[5] = ascii_strn2val((const char*)&data[10],16,2);
|
||||
|
||||
//status = HFG_CreateServiceLink(&hfg_channel[0], &addr);
|
||||
|
||||
if (status == BT_STATUS_PENDING) {
|
||||
printf("Opening Channel...\r\n");
|
||||
} else {
|
||||
printf("Could not open channel, status: %d\r\n", status);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'O':
|
||||
// {
|
||||
// uint8_t battery_level[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
||||
// struct gatt_send_event ntf[6];
|
||||
// uint8_t i=0;
|
||||
// for(i=0;i<6;i++){
|
||||
// ntf[i].conidx = 0;
|
||||
// ntf[i].svc_id = svc_id;
|
||||
// ntf[i].att_idx = 2;
|
||||
// ntf[i].data_len = 15;
|
||||
// ntf[i].p_data = &battery_level[0];
|
||||
// gatt_notification(&ntf[i]);
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
printf("OK\r\n");
|
||||
}
|
||||
|
||||
static void app_at_recv_cmd_D(uint8_t sub_cmd, uint8_t *data)
|
||||
{
|
||||
switch(sub_cmd) {
|
||||
case 'A':
|
||||
flash_erase(QSPI0, ascii_strn2val((const char*)&data[0],16,8), 0x1000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_cmd_recv_handler(uint8_t *data, uint16_t length)
|
||||
{
|
||||
switch(data[0])
|
||||
{
|
||||
case 'A':
|
||||
app_at_recv_cmd_A(data[1], &data[2]);
|
||||
break;
|
||||
case 'B':
|
||||
app_at_recv_cmd_B(data[1], &data[2]);
|
||||
break;
|
||||
case 'D':
|
||||
app_at_recv_cmd_D(data[1], &data[2]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void app_at_recv_c(uint8_t c)
|
||||
{
|
||||
switch(at_recv_state)
|
||||
{
|
||||
case 0:
|
||||
if(c == 'A')
|
||||
{
|
||||
at_recv_state++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(c == 'T')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 2:
|
||||
if(c == '#')
|
||||
at_recv_state++;
|
||||
else
|
||||
at_recv_state = 0;
|
||||
break;
|
||||
case 3:
|
||||
at_recv_buffer[at_recv_index++] = c;
|
||||
if((c == '\n')
|
||||
||(at_recv_index >= AT_RECV_MAX_LEN))
|
||||
{
|
||||
struct app_task_event *event;
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_AT_CMD, at_recv_index, false);
|
||||
if(event) {
|
||||
memcpy(event->param, at_recv_buffer, at_recv_index);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
at_recv_state = 0;
|
||||
at_recv_index = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
app_at_recv_c(app_at_recv_char);
|
||||
if (handle) {
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void app_at_init(struct __UART_HandleTypeDef *handle)
|
||||
{
|
||||
uart_receive_IT(handle, &app_at_recv_char, 1);
|
||||
}
|
434
SW/examples/application/bootloader/src/app_ble.c
Normal file
434
SW/examples/application/bootloader/src/app_ble.c
Normal file
@ -0,0 +1,434 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "co_log.h"
|
||||
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "fdb_app.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#include "portable.h"
|
||||
#include "btdm_mem.h"
|
||||
|
||||
#define SP_SVC_UUID 0xFFF0
|
||||
#define SP_CHAR1_UUID 0xFFF3
|
||||
#define SP_CHAR2_UUID {0xba, 0x5c, 0xFF, 0xF4, 0x04, 0xa3, 0x40, 0x71, 0xa0, 0xb5, 0x35, 0x85, 0x3e, 0xb0, 0x83, 0x07}
|
||||
|
||||
// Element index of gatt service table
|
||||
enum
|
||||
{
|
||||
SP_IDX_SERVICE,
|
||||
|
||||
SP_IDX_CHAR1_DECLARATION,
|
||||
SP_IDX_CHAR1_VALUE,
|
||||
SP_IDX_CHAR1_CFG,
|
||||
SP_IDX_CHAR1_USER_DESCRIPTION,
|
||||
|
||||
SP_IDX_CHAR2_DECLARATION,
|
||||
SP_IDX_CHAR2_VALUE,
|
||||
SP_IDX_CHAR2_USER_DESCRIPTION,
|
||||
|
||||
SP_IDX_NB,
|
||||
};
|
||||
|
||||
// Simple GATT Profile Service UUID: 0xFFF0
|
||||
static const uint8_t sp_svc_uuid[] = UUID16_ARR(SP_SVC_UUID);
|
||||
|
||||
/******************************* Characteristic 1 defination *******************************/
|
||||
// Characteristic 1 UUID: 0xFFF3
|
||||
// Characteristic 1 data
|
||||
#define SP_CHAR1_VALUE_LEN 20
|
||||
static uint8_t sp_char1_value[SP_CHAR1_VALUE_LEN] = {0};
|
||||
|
||||
#define SP_CHAR1_USER_DESC_LEN 17
|
||||
static char sp_char1_user_desc_data[] = "Characteristic 1";
|
||||
|
||||
static uint8_t desc_data[2] = {0};
|
||||
|
||||
/******************************* Characteristic 2 defination *******************************/
|
||||
// Characteristic 2 UUID: 0xBA5C-FFF4-04A3-4071-A0B5-3585-3EB0-8307
|
||||
// Characteristic 2 data
|
||||
#define SP_CHAR2_VALUE_LEN 5
|
||||
static uint8_t sp_char2_value[SP_CHAR2_VALUE_LEN] = {0x11, 0x22, 0x33, 0x44, 0x55};
|
||||
|
||||
#define SP_CHAR2_USER_DESC_LEN 17
|
||||
static char sp_char2_user_desc_data[] = "Characteristic 2";
|
||||
|
||||
static const gatt_attribute_t simple_profile_att_table[] =
|
||||
{
|
||||
// Simple gatt Service Declaration
|
||||
[SP_IDX_SERVICE] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
UUID_SIZE_2, /* Max size of the value */ /* Service UUID size in service declaration */
|
||||
(uint8_t*)sp_svc_uuid, /* Value of the attribute */ /* Service UUID value in service declaration */
|
||||
},
|
||||
|
||||
/******************************* Characteristic 1 defination *******************************/
|
||||
// Characteristic 1 Declaration
|
||||
[SP_IDX_CHAR1_DECLARATION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
0, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */
|
||||
},
|
||||
// Characteristic 1 Value
|
||||
[SP_IDX_CHAR1_VALUE] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(SP_CHAR1_UUID) }, /* UUID */
|
||||
GATT_PROP_READ | GATT_PROP_NOTI | GATT_PROP_WRITE_REQ, /* Permissions */
|
||||
SP_CHAR1_VALUE_LEN, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
/* When the buffer is null, if a read request is received,
|
||||
* the lower layer will report a read event to the gatt callback.
|
||||
* The user must assign a value to the data pointer in the callback event
|
||||
* to reply to the read request
|
||||
*/
|
||||
},
|
||||
|
||||
// Characteristic 1 client characteristic configuration
|
||||
[SP_IDX_CHAR1_CFG] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID) }, /* UUID */
|
||||
GATT_PROP_READ | GATT_PROP_WRITE_REQ, /* Permissions */
|
||||
2, /* Max size of the value */
|
||||
desc_data, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
},
|
||||
|
||||
// Characteristic 1 User Description
|
||||
[SP_IDX_CHAR1_USER_DESCRIPTION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
SP_CHAR1_USER_DESC_LEN, /* Max size of the value */
|
||||
(uint8_t *)sp_char1_user_desc_data, /* Value of the attribute */
|
||||
},
|
||||
|
||||
/******************************* Characteristic 2 defination *******************************/
|
||||
// Characteristic 2 Declaration
|
||||
[SP_IDX_CHAR2_DECLARATION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
0, /* Max size of the value */
|
||||
NULL, /* Value of the attribute */
|
||||
},
|
||||
|
||||
// Characteristic 2 Value
|
||||
[SP_IDX_CHAR2_VALUE] = {
|
||||
{ UUID_SIZE_16, SP_CHAR2_UUID }, /* UUID */
|
||||
GATT_PROP_READ , /* Permissions */
|
||||
SP_CHAR2_VALUE_LEN, /* Max size of the value */
|
||||
sp_char2_value, /* Value of the attribute */ /* Can assign a buffer here, or can be assigned in the application by user */
|
||||
/* When the buffer is null, if a read request is received,
|
||||
* the lower layer will report a read event to the gatt callback.
|
||||
* The user must assign a value to the data pointer in the callback event
|
||||
* to reply to the read request
|
||||
*/
|
||||
},
|
||||
|
||||
// Characteristic 2 User Description
|
||||
[SP_IDX_CHAR2_USER_DESCRIPTION] = {
|
||||
{ UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) }, /* UUID */
|
||||
GATT_PROP_READ, /* Permissions */
|
||||
SP_CHAR2_USER_DESC_LEN, /* Max size of the value */
|
||||
(uint8_t *)sp_char2_user_desc_data, /* Value of the attribute */
|
||||
},
|
||||
};
|
||||
|
||||
static void app_ble_start_advertising(void);
|
||||
|
||||
static char local_device_name[] = "509x_Ble_Periphreal";
|
||||
static adv_handle adv;
|
||||
|
||||
/*
|
||||
* Advertising data, max size is 28 bytes
|
||||
*/
|
||||
static uint8_t adv_data[] = {
|
||||
/* gatt service information */
|
||||
0x03, //length of this AD
|
||||
GAP_ADVTYPE_16BIT_MORE, //16bit service uuid AD type
|
||||
0xff, 0xf0, //value.service uuid:0xFFF0
|
||||
|
||||
/* local device name information */
|
||||
0x14, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'5','0','9','x','_','B','l','e','_','P','e','r','i','p','h','r','e','a','l', //value.local device name
|
||||
};
|
||||
|
||||
/*
|
||||
* Advertising scan response data, max size is 31 bytes
|
||||
*/
|
||||
static uint8_t adv_scan_rsp_data[] = {
|
||||
/* local device name information */
|
||||
0x14, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'5','0','9','x','_','B','l','e','_','P','e','r','i','p','h','r','e','a','l', //value.local device name
|
||||
};
|
||||
|
||||
uint8_t service_id;
|
||||
|
||||
static uint16_t gap_callback(struct gap_event *event)
|
||||
{
|
||||
// printf("gap_callback: type = %d\r\n", event->type);
|
||||
|
||||
switch(event->type) {
|
||||
case GATT_EVT_PROFILE_ADDED:
|
||||
{
|
||||
printf("gap_callback: GATT_EVT_PROFILE_ADDED: 0x%02X\r\n", event->param.profile_added_status);
|
||||
|
||||
/* service profile has been added successfully, then the advertising can be started */
|
||||
app_ble_start_advertising();
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_PARAM:
|
||||
printf("adv param set: 0x%02X\r\n", event->param.adv_set_param.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_ADV_DATA:
|
||||
printf("adv data set: 0x%02X\r\n", event->param.adv_set_adv_data.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_SCAN_RSP:
|
||||
printf("adv scan rsp data set: 0x%02X\r\n", event->param.adv_set_scan_rsp.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_START:
|
||||
printf("adv start :0x%02X\r\n", event->param.adv_start.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_END:
|
||||
printf("adv end: 0x%02X\r\n", event->param.adv_end.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_SLAVE_CONNECT:
|
||||
{
|
||||
//gap_get_link_version(event->param.connect.conidx);
|
||||
//gap_get_link_rssi(event->param.connect.conidx);
|
||||
//gap_get_link_features(event->param.connect.conidx);
|
||||
printf("slave connect[%d], connect num: %d\r\n", event->param.connect.conidx, gap_get_connect_num());
|
||||
gatt_mtu_exchange_req(service_id, event->param.connect.conidx, 247);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_DISCONNECT:
|
||||
{
|
||||
printf("gap_callback: GAP_EVT_DISCONNECT, conidx:%d, reason:0x%02X\r\n", event->param.disconnect.conidx,
|
||||
event->param.disconnect.reason);
|
||||
gap_adv_start(adv, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case GATT_EVT_MTU:
|
||||
printf("gap_callback: conidx: %d, GATT_EVT_MTU: %d\r\n", event->param.mtu_ind.conidx, event->param.mtu_ind.mtu);
|
||||
break;
|
||||
|
||||
case GAP_EVT_NAME_REQ:
|
||||
{
|
||||
gap_name_req_rsp(event->param.name_req.conidx,
|
||||
event->param.name_req.token,
|
||||
sizeof(local_device_name),
|
||||
(uint8_t *)local_device_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_APPEARANCE_REQ:
|
||||
{
|
||||
gap_appearance_req_rsp(event->param.appearance_req.conidx,
|
||||
event->param.appearance_req.token,
|
||||
GAP_APPEARE_UNKNOWN);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_REQ:
|
||||
{
|
||||
struct gap_link_param_update_rsp rsp;
|
||||
rsp.accept = true;
|
||||
rsp.conidx = event->param.link_param_update_req.conidx;
|
||||
rsp.ce_len_max = 2;
|
||||
rsp.ce_len_min = 2;
|
||||
gap_param_update_rsp(&rsp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_UPDATE:
|
||||
{
|
||||
printf("conn param update,conidx:%d, con_int:%d, latency:%d, timeout%d\r\n", event->param.link_param_update.conidx,
|
||||
event->param.link_param_update.con_interval,
|
||||
event->param.link_param_update.con_latency,
|
||||
event->param.link_param_update.sup_to);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_RSSI:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_RSSI: %d\r\n", event->param.gap_link_rssi.conidx, event->param.gap_link_rssi.link_rssi);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_IND:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_IND: %d\r\n", event->param.gap_phy_ind.conidx, event->param.gap_phy_ind.tx_phy);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_REJECT:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_REJECT, status: %d\r\n", event->param.gap_phy_update_reject.conidx, event->param.gap_phy_update_reject.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_VER:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_VER\r\n", event->param.gap_link_ver.conidx);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_FEATURE:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_FEATURE:%d\r\n", event->param.gap_link_feature.conidx, event->param.gap_link_feature.features[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint16_t gatt_callback(struct gatt_msg *p_msg)
|
||||
{
|
||||
uint8_t uuid_temp[16];
|
||||
uint16_t uuid_2 = 0;
|
||||
|
||||
switch(p_msg->msg_evt) {
|
||||
case GATTC_MSG_CMP_EVT:
|
||||
{
|
||||
switch(p_msg->param.gatt_op_cmp.operation) {
|
||||
case GATT_OP_NOTIFY:
|
||||
/*opearation of notification is complete */
|
||||
printf("notify cmp, conidx:%d, status:0x%02X\r\n", p_msg->conn_idx, p_msg->param.gatt_op_cmp.status);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Received a read request from the peer device */
|
||||
case GATTS_MSG_READ_REQ:
|
||||
{
|
||||
printf("GATTS_MSG_READ_REQ, conidx:%d, att idx:%d\r\n", p_msg->conn_idx, p_msg->att_idx);
|
||||
|
||||
if(p_msg->att_idx == SP_IDX_CHAR1_VALUE)
|
||||
{
|
||||
/*
|
||||
* Because the buffer pointer of SP_IDX_CHAR1_VALUE is NULL,
|
||||
* read requests will be report to the application layer for user response
|
||||
*/
|
||||
uint8_t read_rsp_data[] = {0x00, 0x01, 0x02, 0x03, 0x04};
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, read_rsp_data, sizeof(read_rsp_data));
|
||||
|
||||
/* Return the length of response data */
|
||||
return (sizeof(read_rsp_data));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Received a write request from the peer device */
|
||||
case GATTS_MSG_WRITE_REQ:
|
||||
{
|
||||
printf("GATTS_MSG_WRITE_REQ, conidx:%d, att idx:%d\r\n", p_msg->conn_idx, p_msg->att_idx);
|
||||
|
||||
if(p_msg->att_idx == SP_IDX_CHAR1_VALUE)
|
||||
{
|
||||
printf("recv data: 0x");
|
||||
for(uint8_t i=0; i<p_msg->param.gatt_data.msg_len; i++)
|
||||
printf("%02X", p_msg->param.gatt_data.p_msg_data[i]);
|
||||
printf("\r\n");
|
||||
}
|
||||
else if(p_msg->att_idx == SP_IDX_CHAR1_CFG)
|
||||
{
|
||||
uint8_t data[2];
|
||||
memcpy(data, p_msg->param.gatt_data.p_msg_data, 2);
|
||||
if(data[0] & 0x01)
|
||||
{
|
||||
/* peer device enable notify */
|
||||
printf("ntf enable, att_idx:%d\r\n", p_msg->att_idx);
|
||||
uint8_t send_data[5] = {0x01, 0x02, 0x03, 0x04, 0x05};
|
||||
struct gatt_send_event ntf;
|
||||
ntf.conidx = p_msg->conn_idx;
|
||||
ntf.att_idx = SP_IDX_CHAR1_VALUE;
|
||||
ntf.p_data = send_data;
|
||||
ntf.data_len = sizeof(send_data);
|
||||
ntf.svc_id = service_id;
|
||||
|
||||
/* Send a notification to the peer device */
|
||||
gatt_notification(&ntf);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case GATTC_MSG_LINK_CREATE:
|
||||
printf("gatt linkk create, conidx:%d\r\n", p_msg->conn_idx);
|
||||
break;
|
||||
|
||||
case GATTC_MSG_LINK_LOST:
|
||||
printf("gatt linkk lost, conidx:%d\r\n", p_msg->conn_idx);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void app_ble_add_service(void)
|
||||
{
|
||||
struct gatt_service service;
|
||||
|
||||
service.att_nb = SP_IDX_NB;
|
||||
service.p_att_tb = simple_profile_att_table;
|
||||
service.gatt_msg_handler = gatt_callback; //set GATT event callback
|
||||
|
||||
service_id = gatt_add_service(&service);
|
||||
}
|
||||
|
||||
static void app_ble_start_advertising(void)
|
||||
{
|
||||
/* creat a handle of advertising*/
|
||||
adv = gap_adv_create();
|
||||
|
||||
gap_adv_param_t adv_param = {
|
||||
.own_addr_type = GAP_ADDR_TYPE_STATIC, //own address type
|
||||
.adv_mode = GAP_ADV_MODE_UNDIRECT,
|
||||
.disc_mode = GAP_ADV_DISC_MODE_GEN_DISC,
|
||||
.adv_chnl_map = GAP_ADV_CHAN_ALL,
|
||||
.filt_policy = GAP_ADV_FILTER_SCAN_ANY_CON_ANY, //Policy for filtering scanning or connection requests from peer devices
|
||||
.phy_mode = GAP_PHY_TYPE_LE_1M,
|
||||
.adv_intv_min = 160, //advertising min interval, in unit of 0.625ms
|
||||
.adv_intv_max = 160, //advertising max interval, in unit of 0.625ms
|
||||
};
|
||||
|
||||
/* set advertising param */
|
||||
gap_adv_set_param(adv, &adv_param);
|
||||
/* set advertising data */
|
||||
gap_adv_set_adv_data(adv, adv_data, sizeof(adv_data));
|
||||
/* set advertising scan response data */
|
||||
gap_adv_set_scan_rsp(adv, adv_scan_rsp_data, sizeof(adv_scan_rsp_data));
|
||||
/* start sadvertising */
|
||||
gap_adv_start(adv, 0, 0);
|
||||
}
|
||||
|
||||
void app_ble_init(void)
|
||||
{
|
||||
printf("app_ble_init\r\n");
|
||||
|
||||
/* set GAP event callback*/
|
||||
gap_set_cb_func(gap_callback);
|
||||
|
||||
/* set security param */
|
||||
struct gap_security_param smp_param;
|
||||
smp_param.mitm = true;
|
||||
smp_param.secure_connection = false;
|
||||
smp_param.bond = true;
|
||||
smp_param.oob_used = GAP_OOB_AUTH_DATA_NOT_PRESENT;
|
||||
smp_param.io_cap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT;
|
||||
gap_security_param_init(&smp_param);
|
||||
|
||||
/* add service profile, The GAP callback event is GATT_EVT_PROFILE_ADDED*/
|
||||
app_ble_add_service();
|
||||
}
|
||||
|
||||
|
118
SW/examples/application/bootloader/src/app_btdm.c
Normal file
118
SW/examples/application/bootloader/src/app_btdm.c
Normal file
@ -0,0 +1,118 @@
|
||||
#include "app_config.h"
|
||||
#include "app_task.h"
|
||||
#include "app_btdm.h"
|
||||
#include "app_ble.h"
|
||||
|
||||
#include "controller_bootloader.h"
|
||||
#include "host.h"
|
||||
#include "app_ota.h"
|
||||
|
||||
typedef int32_t app_btdm_ret_t;
|
||||
|
||||
static const uint8_t bt_addr[] = {0x12, 0x00, 0x12, 0x12, 0x12, 0x12};
|
||||
static const uint8_t ble_public_addr[] = {0x13, 0x00, 0x12, 0x12, 0x12, 0x12};
|
||||
uint8_t ble_static_addr[] = {0x13, 0x66, 0x12, 0x72, 0x12, 0xc2};
|
||||
|
||||
static void encoded_sco_frame_cb(void *arg, uint8_t *data, uint16_t length)
|
||||
{
|
||||
static uint16_t seq = 0;
|
||||
app_bt_send_sco_data(arg, seq++, data, length);
|
||||
}
|
||||
|
||||
static void btdm_callback(struct app_btdm_event_t *event)
|
||||
{
|
||||
switch(event->event) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void app_btdm_start(void)
|
||||
{
|
||||
app_ble_init();
|
||||
}
|
||||
|
||||
void host_ready_cb(void)
|
||||
{
|
||||
struct app_task_event *event;
|
||||
/* notify application BTDM stack is ready. */
|
||||
event = app_task_event_alloc(APP_TASK_EVENT_HOST_INITED, 0, true);
|
||||
app_task_event_post(event, false);
|
||||
}
|
||||
|
||||
void user_controller_init(void)
|
||||
{
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr);
|
||||
}
|
||||
void app_btdm_init(void)
|
||||
{
|
||||
/* prepare for BTDM stack */
|
||||
controller_start(BTDM_STACK_HCI_BAUDRATE, ble_public_addr, bt_addr);
|
||||
|
||||
host_ble_start(BTDM_STACK_HCI_BAUDRATE, HOST_TASK_STACK_SIZE, HOST_TASK_PRIORITY, ble_static_addr);
|
||||
|
||||
/*
|
||||
* init MCU->BT pin, configure PMU_PIN_8 output BBG_EN signal, this pin is used to
|
||||
* notice BT core that MCU is in working mode.
|
||||
*/
|
||||
ool_write(PMU_REG_DIAG_CTRL, 0x82);
|
||||
ool_write(PMU_REG_PIN_IOMUX_H, 0x03);
|
||||
/* disable PMU pin input as default setting */
|
||||
ool_write16(PMU_REG_PIN_INPUT_EN, 0x0002);
|
||||
|
||||
|
||||
/*
|
||||
* init BT->MCU pin, system should not enter sleep mode when this pin is low level.
|
||||
* This pin is used by BT core to notice MCU than BT core is in working mode.
|
||||
*/
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
pmu_gpio_int_init(PMU_PIN_9, PMU_GPIO_PULL_UP, 0);
|
||||
pmu_enable_isr(PMU_GPIO_PMU_INT_MSK_BIT);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_adv_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_ble_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_access_mode_set(uint8_t mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_start(uint16_t dur)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_scan_stop(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_connect(uint8_t *peer_addr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_disconnect(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
app_btdm_ret_t app_btdm_bt_profile_enable(uint16_t profiles)
|
||||
{
|
||||
return -1;
|
||||
}
|
828
SW/examples/application/bootloader/src/app_hw.c
Normal file
828
SW/examples/application/bootloader/src/app_hw.c
Normal file
@ -0,0 +1,828 @@
|
||||
/*
|
||||
* 1. AT command and log: UART3
|
||||
* 2. HCI interface: UART0, GPIO_PMU, handled by host.c.
|
||||
* 3. Display: DMA1, SPIx8_0, GPIO (for cs)
|
||||
* 4. Touchpad: I2C3
|
||||
* 5. external Flash: DMA0, SPIx8_1
|
||||
* 6. DSP: IPC, RPMSG
|
||||
* 7. Sensors: handled by 1010
|
||||
* 8. System clock, XIP Flash: handled by sleep procedure
|
||||
*/
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "driver_display.h"
|
||||
#include "driver_touchpad.h"
|
||||
#include "IC_W25Qxx.h"
|
||||
|
||||
#include "app_config.h"
|
||||
#include "app_hw.h"
|
||||
|
||||
struct hw_gpio_state_t {
|
||||
uint16_t PortA_PullEN;
|
||||
uint16_t PortB_PullEN;
|
||||
uint16_t PortC_PullEN;
|
||||
uint16_t PortD_PullEN;
|
||||
|
||||
uint16_t PortA_PullSelect;
|
||||
uint16_t PortB_PullSelect;
|
||||
uint16_t PortC_PullSelect;
|
||||
uint16_t PortD_PullSelect;
|
||||
|
||||
uint32_t PortA_PullResCfg;
|
||||
uint32_t PortB_PullResCfg;
|
||||
uint32_t PortC_PullResCfg;
|
||||
uint32_t PortD_PullResCfg;
|
||||
|
||||
uint32_t PortA_DriveCfg;
|
||||
uint32_t PortB_DriveCfg;
|
||||
uint32_t PortC_DriveCfg;
|
||||
uint32_t PortD_DriveCfg;
|
||||
|
||||
uint32_t PortA_L_FuncMux;
|
||||
uint32_t PortA_H_FuncMux;
|
||||
uint32_t PortB_L_FuncMux;
|
||||
uint32_t PortB_H_FuncMux;
|
||||
uint32_t PortC_L_FuncMux;
|
||||
uint32_t PortC_H_FuncMux;
|
||||
uint32_t PortD_L_FuncMux;
|
||||
uint32_t PortD_H_FuncMux;
|
||||
|
||||
uint32_t QSPI_PullSelect;
|
||||
uint32_t QSPI_PullEN;
|
||||
uint32_t OSPI_PullSelect;
|
||||
uint32_t OSPI_PullEN;
|
||||
|
||||
uint16_t GPIOA_OutputEN;
|
||||
uint16_t GPIOA_OUT_DATA;
|
||||
uint16_t GPIOA_EXTI_EN;
|
||||
uint16_t GPIOA_EXTI_INT_EN;
|
||||
uint32_t GPIOA_EXTI_TYPE;
|
||||
uint16_t GPIOB_OutputEN;
|
||||
uint16_t GPIOB_OUT_DATA;
|
||||
uint16_t GPIOB_EXTI_EN;
|
||||
uint16_t GPIOB_EXTI_INT_EN;
|
||||
uint32_t GPIOB_EXTI_TYPE;
|
||||
uint16_t GPIOC_OutputEN;
|
||||
uint16_t GPIOC_OUT_DATA;
|
||||
uint16_t GPIOC_EXTI_EN;
|
||||
uint16_t GPIOC_EXTI_INT_EN;
|
||||
uint32_t GPIOC_EXTI_TYPE;
|
||||
uint16_t GPIOD_OutputEN;
|
||||
uint16_t GPIOD_OUT_DATA;
|
||||
uint16_t GPIOD_EXTI_EN;
|
||||
uint16_t GPIOD_EXTI_INT_EN;
|
||||
uint32_t GPIOD_EXTI_TYPE;
|
||||
};
|
||||
|
||||
static struct hw_gpio_state_t gpio_state;
|
||||
|
||||
UART_HandleTypeDef uart_log_handle;
|
||||
DMA_HandleTypeDef dma_display_handle;
|
||||
SPI_HandleTypeDef spi_display_handle;
|
||||
I2C_HandleTypeDef i2c_touchpad_handle;
|
||||
SPI_HandleTypeDef spi_flash_handle;
|
||||
DMA_HandleTypeDef dma_flash_handle;
|
||||
|
||||
void app_at_rx_done(struct __UART_HandleTypeDef *handle);
|
||||
|
||||
void display_cs_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET);
|
||||
printf("cs 0");
|
||||
}
|
||||
|
||||
void display_cs_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_5, GPIO_PIN_CLEAR);
|
||||
printf("cs 1");
|
||||
}
|
||||
|
||||
void spi_flash_cs_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_9, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void spi_flash_cs_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_9, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
void display_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
void display_vci_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_vci_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
bool display_te_status(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
void display_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_6, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_6, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
void display_vci_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_vci_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
bool display_te_status(void)
|
||||
{
|
||||
return gpio_read_pin(GPIOC, GPIO_PIN_7);
|
||||
}
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
void display_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_14, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
void display_vci_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void display_vci_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_13, GPIO_PIN_CLEAR);
|
||||
}
|
||||
|
||||
bool display_te_status(void)
|
||||
{
|
||||
return gpio_read_pin(GPIOB, GPIO_PIN_15);
|
||||
}
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
void display_delay_ms(uint32_t counter)
|
||||
{
|
||||
system_delay_us(counter * 1000);
|
||||
}
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
|
||||
#if 1 //DISPLAY_TYPE_ICNA3310
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#else
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_6, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
void touchpad_reset_set(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
void touchpad_reset_clear(void)
|
||||
{
|
||||
gpio_write_pin(GPIOC, GPIO_PIN_15, GPIO_PIN_CLEAR);
|
||||
}
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
void touchpad_delay_ms(uint32_t counter)
|
||||
{
|
||||
system_delay_us(counter * 1000);
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_log_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= Uart LOG configuration ========= */
|
||||
/* ========================================================== */
|
||||
/* configure PB4 and PB5 to UART3 function */
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
|
||||
/* UART3: used for Log and AT command */
|
||||
uart_log_handle.UARTx = UART3;
|
||||
uart_log_handle.Init.BaudRate = 921600;
|
||||
uart_log_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
uart_log_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
uart_log_handle.Init.Parity = UART_PARITY_NONE;
|
||||
uart_log_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
uart_log_handle.TxCpltCallback = NULL;
|
||||
uart_log_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&uart_log_handle);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
}
|
||||
else {
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
uart_init(&uart_log_handle);
|
||||
__UART_INT_RX_ENABLE(uart_log_handle.UARTx);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_display_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= Display interface configuration ========= */
|
||||
/* ========================================================== */
|
||||
/* config DMA1 for display */
|
||||
__SYSTEM_DMA1_CLK_ENABLE();
|
||||
dma_display_handle.DMAx = DMA1;
|
||||
dma_display_handle.Channel = DMA_Channel0;
|
||||
dma_display_handle.Init.Data_Flow = DMA_M2P_DMAC;
|
||||
dma_display_handle.Init.Request_ID = 2;
|
||||
system_dmac_request_id_config(SPIMX8_0_TX, DMA1_REQUEST_ID_2);
|
||||
dma_display_handle.Init.Source_Master_Sel = DMA_AHB_MASTER_3;
|
||||
dma_display_handle.Init.Desination_Master_Sel = DMA_AHB_MASTER_2;
|
||||
dma_display_handle.Init.Source_Inc = DMA_ADDR_INC_INC;
|
||||
dma_display_handle.Init.Desination_Inc = DMA_ADDR_INC_NO_CHANGE;
|
||||
dma_display_handle.Init.Source_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_display_handle.Init.Desination_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_display_handle.Init.Source_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_display_handle.Init.Desination_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_init(&dma_display_handle);
|
||||
NVIC_EnableIRQ(DMA1_IRQn);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
|
||||
/* configure C0, C1, C2, C3, C4 to SPIx8_0 function */
|
||||
gpio_config.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_5;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure C5 to CS function */
|
||||
gpio_config.Pin = GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
/* configure B13, PB14 to VCCI function, RESET function */
|
||||
gpio_config.Pin = GPIO_PIN_13 | GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
/* configure PC15, PC6 to VCCI function, RESET function n*/
|
||||
gpio_config.Pin = GPIO_PIN_6 | GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC7 to TE functio(interrupt pin) */
|
||||
gpio_config.Pin = GPIO_PIN_7;
|
||||
gpio_config.Mode = GPIO_MODE_INPUT;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLDOWN;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
/* configure B13, PB14 to VCCI function, RESET function */
|
||||
gpio_config.Pin = GPIO_PIN_13 | GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* configure GPIO_PB15 to TE functio(interrupt pin) */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_INPUT;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLDOWN;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
__SYSTEM_SPI_MASTER0_X8_CLK_ENABLE();
|
||||
spi_display_handle.SPIx = SPIMX8_0;
|
||||
spi_display_handle.Init.Work_Mode = SPI_WORK_MODE_0;
|
||||
spi_display_handle.Init.Frame_Size = SPI_FRAME_SIZE_8BIT;
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
spi_display_handle.Init.BaudRate_Prescaler = 2;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
spi_display_handle.Init.BaudRate_Prescaler = 4;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
spi_display_handle.Init.BaudRate_Prescaler = 4;
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
spi_display_handle.Init.TxFIFOEmpty_Threshold = 20;
|
||||
spi_display_handle.Init.RxFIFOFull_Threshold = 0;
|
||||
spi_master_init(&spi_display_handle);
|
||||
|
||||
display_cs_set();
|
||||
display_init();
|
||||
printf("display_init!\n");
|
||||
}
|
||||
else {
|
||||
__SYSTEM_DMA1_CLK_ENABLE();
|
||||
system_dmac_request_id_config(SPIMX8_0_TX, DMA1_REQUEST_ID_2);
|
||||
dma_init(&dma_display_handle);
|
||||
NVIC_EnableIRQ(DMA1_IRQn);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
__SYSTEM_SPI_MASTER0_X8_CLK_ENABLE();
|
||||
spi_display_handle.Init.Frame_Size = SPI_FRAME_SIZE_8BIT;
|
||||
spi_master_init(&spi_display_handle);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_touchpad_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= TP configuration ========= */
|
||||
/* ========================================================== */
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
/* configure GPIO_PC6 and GPIO_PC7 to I2C3 mode */
|
||||
gpio_config.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC15 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
|
||||
#if 1 //DISPLAY_TYPE_ICNA3310
|
||||
/* configure GPIO_PB12 and GPIO_PB13 to I2C2 mode */
|
||||
gpio_config.Pin = GPIO_PIN_12|GPIO_PIN_13;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* configure GPIO_PB15 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* configure GPIO_PB14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
|
||||
exti_interrupt_enable(GPIOB,EXTI_LINE_14);
|
||||
exti_clear_LineStatus(GPIOB,EXTI_LINE_14);
|
||||
|
||||
NVIC_EnableIRQ(GPIOB_IRQn);
|
||||
|
||||
#else
|
||||
|
||||
/* configure GPIO_PA4 and GPIO_PA5 to I2C2 mode */
|
||||
gpio_config.Pin = GPIO_PIN_4|GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
/* configure GPIO_PA6 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_6;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
/* configure GPIO_PB14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
#endif
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
/* configure GPIO_PC6 and GPIO_PC7 to I2C3 mode */
|
||||
gpio_config.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_3;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC15 to reset pin */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* configure GPIO_PC14 to interrupt pin */
|
||||
gpio_config.Pin = GPIO_PIN_14;
|
||||
gpio_config.Mode = GPIO_MODE_EXTI_IT_FALLING;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
/* I2C Init */
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
__SYSTEM_I2C3_CLK_ENABLE();
|
||||
i2c_touchpad_handle.I2Cx = I2C3;
|
||||
i2c_touchpad_handle.Init.I2C_Mode = I2C_MODE_MASTER_7BIT;
|
||||
i2c_touchpad_handle.Init.SCL_HCNT = 220;
|
||||
i2c_touchpad_handle.Init.SCL_LCNT = 230;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
__SYSTEM_I2C2_CLK_ENABLE();
|
||||
i2c_touchpad_handle.I2Cx = I2C2;
|
||||
i2c_touchpad_handle.Init.I2C_Mode = I2C_MODE_MASTER_7BIT;
|
||||
i2c_touchpad_handle.Init.SCL_HCNT = 220;
|
||||
i2c_touchpad_handle.Init.SCL_LCNT = 230;
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
__SYSTEM_I2C3_CLK_ENABLE();
|
||||
i2c_touchpad_handle.I2Cx = I2C3;
|
||||
i2c_touchpad_handle.Init.I2C_Mode = I2C_MODE_MASTER_7BIT;
|
||||
i2c_touchpad_handle.Init.SCL_HCNT = 90;
|
||||
i2c_touchpad_handle.Init.SCL_LCNT = 90;
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
i2c_init(&i2c_touchpad_handle);
|
||||
|
||||
__TOUCHPAD_RESET_SET();
|
||||
touchpad_init();
|
||||
}
|
||||
else {
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
#if BOARD_SEL == BOARD_EVB_FR3092E
|
||||
__SYSTEM_I2C2_CLK_ENABLE();
|
||||
#else
|
||||
__SYSTEM_I2C3_CLK_ENABLE();
|
||||
#endif
|
||||
i2c_init(&i2c_touchpad_handle);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_external_flash_init(bool wake_up)
|
||||
{
|
||||
if (wake_up == false) {
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/* ========================================================== */
|
||||
/* ========= External Flash interface configuration ======== */
|
||||
/* ========================================================== */
|
||||
/* config GPIO for external flash */
|
||||
gpio_config.Pin = GPIO_PIN_8 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_7;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* CS of external flash is controllerd by software */
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_9;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOC, &gpio_config);
|
||||
|
||||
/* config DMA0 for external flash */
|
||||
__SYSTEM_DMA0_CLK_ENABLE();
|
||||
dma_flash_handle.DMAx = DMA0;
|
||||
dma_flash_handle.Channel = DMA_Channel0;
|
||||
dma_flash_handle.Init.Data_Flow = DMA_P2M_DMAC;
|
||||
dma_flash_handle.Init.Request_ID = 2;
|
||||
system_dmac_request_id_config(SPIMX8_1_RX, DMA0_REQUEST_ID_2);
|
||||
dma_flash_handle.Init.Source_Master_Sel = DMA_AHB_MASTER_1;
|
||||
dma_flash_handle.Init.Desination_Master_Sel = DMA_AHB_MASTER_4;
|
||||
dma_flash_handle.Init.Source_Inc = DMA_ADDR_INC_NO_CHANGE;
|
||||
dma_flash_handle.Init.Desination_Inc = DMA_ADDR_INC_INC;
|
||||
dma_flash_handle.Init.Source_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_flash_handle.Init.Desination_Width = DMA_TRANSFER_WIDTH_32;
|
||||
dma_flash_handle.Init.Source_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_flash_handle.Init.Desination_Burst_Len = DMA_BURST_LEN_4;
|
||||
dma_init(&dma_flash_handle);
|
||||
|
||||
/* Initial SPIx8_1 for extern flash */
|
||||
__SYSTEM_SPI_MASTER1_X8_CLK_ENABLE();
|
||||
spi_flash_handle.SPIx = SPIMX8_1;
|
||||
spi_flash_handle.Init.Work_Mode = SPI_WORK_MODE_3;
|
||||
spi_flash_handle.Init.Frame_Size = SPI_FRAME_SIZE_8BIT;
|
||||
spi_flash_handle.Init.BaudRate_Prescaler = 2;
|
||||
spi_flash_handle.Init.TxFIFOEmpty_Threshold = 20;
|
||||
spi_flash_handle.Init.RxFIFOFull_Threshold = 4;
|
||||
spi_master_init(&spi_flash_handle);
|
||||
__SPI_RX_SAMPLE_DLY(spi_flash_handle.SPIx, 2);
|
||||
__SPI_CS_Release();
|
||||
|
||||
IC_W25Qxx_QuadConfig(true);
|
||||
|
||||
NVIC_EnableIRQ(DMA0_IRQn);
|
||||
NVIC_EnableIRQ(SPIMX8_1_IRQn);
|
||||
}
|
||||
else {
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
|
||||
__SYSTEM_DMA0_CLK_ENABLE();
|
||||
system_dmac_request_id_config(SPIMX8_1_RX, DMA0_REQUEST_ID_2);
|
||||
dma_init(&dma_flash_handle);
|
||||
|
||||
__SYSTEM_SPI_MASTER1_X8_CLK_ENABLE();
|
||||
spi_master_init(&spi_flash_handle);
|
||||
__SPI_RX_SAMPLE_DLY(spi_flash_handle.SPIx, 2);
|
||||
|
||||
NVIC_EnableIRQ(DMA0_IRQn);
|
||||
NVIC_EnableIRQ(SPIMX8_1_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_dsp_xip_flash_init(bool wake_up)
|
||||
{
|
||||
/* init QSPI1 for DSP XIP flash */
|
||||
__SYSTEM_QSPI1_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_QSPI1_CLK_ENABLE();
|
||||
/* configure OSPI pad to DSP XIP flash function */
|
||||
SYSTEM->OspiPadConfig.OSPI_FuncMux = 0x55555555;
|
||||
|
||||
/* power on DSP flash */
|
||||
ool_write(0xfc, ool_read(0xfc) | 0x01);
|
||||
|
||||
/* configure DSP XIP controller */
|
||||
flash_enable_quad(QSPI1);
|
||||
flash_init_controller(QSPI1, FLASH_RD_TYPE_QUAD_FAST, FLASH_WR_TYPE_SINGLE);
|
||||
flash_set_baudrate(QSPI1, QSPI_BAUDRATE_DIV_4);
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_dsp_restore(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
__RAM_CODE __attribute__((noinline)) static void rise_qspi_clock(void)
|
||||
{
|
||||
__SYSTEM_QSPI0_CLK_SELECT_AUPLL();
|
||||
__QSPI_DELAY_CS_START_SET(QSPI0, 4);
|
||||
__QSPI_DELAY_CS_END_SET(QSPI0, 4);
|
||||
__QSPI_DELAY_CS_DESSERT_SET(QSPI0, 8);
|
||||
__QSPI_READ_CAPTURE_DELAY_SET(QSPI0, 0); // FLASH_ID_PUYA_P25Q32: 4 when div is 2
|
||||
// FLASH_ID_XMC_XM25LU32: 3 when div is 2
|
||||
// FLASH_ID_GIANTEC_GT25Q16A: 1 when div is 4
|
||||
// FLASH_ID_GIANTEC_GT25Q16A: 4 when div is 2
|
||||
system_delay_us(1000);
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_xip_flash_init(bool wake_up)
|
||||
{
|
||||
// init internal flash
|
||||
__SYSTEM_PFC_CLK_ENABLE();
|
||||
__SYSTEM_QSPI0_CLK_ENABLE();
|
||||
__SYSTEM_APB_CLK_ENABLE();
|
||||
__SYSTEM_APB1_CLK_ENABLE();
|
||||
system_cache_enable(true);
|
||||
flash_enable_quad(QSPI0);
|
||||
SYSTEM->QspiPadConfig.QSPI_FuncMux = 0x00000500;
|
||||
flash_init_controller(QSPI0, FLASH_RD_TYPE_QUAD, FLASH_WR_TYPE_SINGLE);
|
||||
if (wake_up == false) {
|
||||
flash_set_IO_DRV(QSPI0, 3);
|
||||
}
|
||||
flash_set_baudrate(QSPI0, QSPI_BAUDRATE_DIV_4);
|
||||
rise_qspi_clock();
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_gpio_save(void)
|
||||
{
|
||||
gpio_state.PortA_PullEN = SYSTEM->PortA_PullEN;
|
||||
gpio_state.PortB_PullEN = SYSTEM->PortB_PullEN;
|
||||
gpio_state.PortC_PullEN = SYSTEM->PortC_PullEN;
|
||||
gpio_state.PortD_PullEN = SYSTEM->PortD_PullEN;
|
||||
|
||||
gpio_state.PortA_PullSelect = SYSTEM->PortA_PullSelect;
|
||||
gpio_state.PortB_PullSelect = SYSTEM->PortB_PullSelect;
|
||||
gpio_state.PortC_PullSelect = SYSTEM->PortC_PullSelect;
|
||||
gpio_state.PortD_PullSelect = SYSTEM->PortD_PullSelect;
|
||||
|
||||
gpio_state.PortA_PullResCfg = SYSTEM->PortA_PullResCfg;
|
||||
gpio_state.PortB_PullResCfg = SYSTEM->PortB_PullResCfg;
|
||||
gpio_state.PortC_PullResCfg = SYSTEM->PortC_PullResCfg;
|
||||
gpio_state.PortD_PullResCfg = SYSTEM->PortD_PullResCfg;
|
||||
|
||||
gpio_state.PortA_DriveCfg = SYSTEM->PortA_DriveCfg;
|
||||
gpio_state.PortB_DriveCfg = SYSTEM->PortB_DriveCfg;
|
||||
gpio_state.PortC_DriveCfg = SYSTEM->PortC_DriveCfg;
|
||||
gpio_state.PortD_DriveCfg = SYSTEM->PortD_DriveCfg;
|
||||
|
||||
gpio_state.PortA_L_FuncMux = SYSTEM->PortA_L_FuncMux;
|
||||
gpio_state.PortA_H_FuncMux = SYSTEM->PortA_H_FuncMux;
|
||||
gpio_state.PortB_L_FuncMux = SYSTEM->PortB_L_FuncMux;
|
||||
gpio_state.PortB_H_FuncMux = SYSTEM->PortB_H_FuncMux;
|
||||
gpio_state.PortC_L_FuncMux = SYSTEM->PortC_L_FuncMux;
|
||||
gpio_state.PortC_H_FuncMux = SYSTEM->PortC_H_FuncMux;
|
||||
gpio_state.PortD_L_FuncMux = SYSTEM->PortD_L_FuncMux;
|
||||
gpio_state.PortD_H_FuncMux = SYSTEM->PortD_H_FuncMux;
|
||||
|
||||
gpio_state.QSPI_PullSelect = SYSTEM->QspiPadConfig.QSPI_PullSelect;
|
||||
gpio_state.QSPI_PullEN = SYSTEM->QspiPadConfig.QSPI_PullEN;
|
||||
gpio_state.OSPI_PullSelect = SYSTEM->OspiPadConfig.OSPI_PullSelect;
|
||||
gpio_state.OSPI_PullEN = SYSTEM->OspiPadConfig.OSPI_PullEN;
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
__SYSTEM_GPIOD_CLK_ENABLE();
|
||||
|
||||
gpio_state.GPIOA_OutputEN = GPIOA->GPIO_OutputEN;
|
||||
gpio_state.GPIOA_OUT_DATA = GPIOA->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOA_EXTI_EN = GPIOA->EXTI_EN;
|
||||
gpio_state.GPIOA_EXTI_INT_EN= GPIOA->EXTI_INT_EN;
|
||||
gpio_state.GPIOA_EXTI_TYPE = GPIOA->EXTI_TYPE;
|
||||
gpio_state.GPIOB_OutputEN = GPIOB->GPIO_OutputEN;
|
||||
gpio_state.GPIOB_OUT_DATA = GPIOB->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOB_EXTI_EN = GPIOB->EXTI_EN;
|
||||
gpio_state.GPIOB_EXTI_INT_EN= GPIOB->EXTI_INT_EN;
|
||||
gpio_state.GPIOB_EXTI_TYPE = GPIOB->EXTI_TYPE;
|
||||
gpio_state.GPIOC_OutputEN = GPIOC->GPIO_OutputEN;
|
||||
gpio_state.GPIOC_OUT_DATA = GPIOC->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOC_EXTI_EN = GPIOC->EXTI_EN;
|
||||
gpio_state.GPIOC_EXTI_INT_EN= GPIOC->EXTI_INT_EN;
|
||||
gpio_state.GPIOC_EXTI_TYPE = GPIOC->EXTI_TYPE;
|
||||
gpio_state.GPIOD_OutputEN = GPIOD->GPIO_OutputEN;
|
||||
gpio_state.GPIOD_OUT_DATA = GPIOD->GPIO_OUT_DATA;
|
||||
gpio_state.GPIOD_EXTI_EN = GPIOD->EXTI_EN;
|
||||
gpio_state.GPIOD_EXTI_INT_EN= GPIOD->EXTI_INT_EN;
|
||||
gpio_state.GPIOD_EXTI_TYPE = GPIOD->EXTI_TYPE;
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_gpio_restore(void)
|
||||
{
|
||||
SYSTEM->PortA_PullEN = gpio_state.PortA_PullEN;
|
||||
SYSTEM->PortB_PullEN = gpio_state.PortB_PullEN;
|
||||
SYSTEM->PortC_PullEN = gpio_state.PortC_PullEN;
|
||||
SYSTEM->PortD_PullEN = gpio_state.PortD_PullEN;
|
||||
|
||||
SYSTEM->PortA_PullSelect = gpio_state.PortA_PullSelect;
|
||||
SYSTEM->PortB_PullSelect = gpio_state.PortB_PullSelect;
|
||||
SYSTEM->PortC_PullSelect = gpio_state.PortC_PullSelect;
|
||||
SYSTEM->PortD_PullSelect = gpio_state.PortD_PullSelect;
|
||||
|
||||
SYSTEM->PortA_PullResCfg = gpio_state.PortA_PullResCfg;
|
||||
SYSTEM->PortB_PullResCfg = gpio_state.PortB_PullResCfg;
|
||||
SYSTEM->PortC_PullResCfg = gpio_state.PortC_PullResCfg;
|
||||
SYSTEM->PortD_PullResCfg = gpio_state.PortD_PullResCfg;
|
||||
|
||||
SYSTEM->PortA_DriveCfg = gpio_state.PortA_DriveCfg;
|
||||
SYSTEM->PortB_DriveCfg = gpio_state.PortB_DriveCfg;
|
||||
SYSTEM->PortC_DriveCfg = gpio_state.PortC_DriveCfg;
|
||||
SYSTEM->PortD_DriveCfg = gpio_state.PortD_DriveCfg;
|
||||
|
||||
SYSTEM->PortA_L_FuncMux = gpio_state.PortA_L_FuncMux;
|
||||
SYSTEM->PortA_H_FuncMux = gpio_state.PortA_H_FuncMux;
|
||||
SYSTEM->PortB_L_FuncMux = gpio_state.PortB_L_FuncMux;
|
||||
SYSTEM->PortB_H_FuncMux = gpio_state.PortB_H_FuncMux;
|
||||
SYSTEM->PortC_L_FuncMux = gpio_state.PortC_L_FuncMux;
|
||||
SYSTEM->PortC_H_FuncMux = gpio_state.PortC_H_FuncMux;
|
||||
SYSTEM->PortD_L_FuncMux = gpio_state.PortD_L_FuncMux;
|
||||
SYSTEM->PortD_H_FuncMux = gpio_state.PortD_H_FuncMux;
|
||||
|
||||
SYSTEM->QspiPadConfig.QSPI_PullSelect = gpio_state.QSPI_PullSelect;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = gpio_state.QSPI_PullEN;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullSelect = gpio_state.OSPI_PullSelect;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullEN = gpio_state.OSPI_PullEN;
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
__SYSTEM_GPIOC_CLK_ENABLE();
|
||||
__SYSTEM_GPIOD_CLK_ENABLE();
|
||||
|
||||
GPIOA->GPIO_OutputEN = gpio_state.GPIOA_OutputEN;
|
||||
GPIOA->GPIO_OUT_DATA = gpio_state.GPIOA_OUT_DATA;
|
||||
GPIOA->EXTI_EN = gpio_state.GPIOA_EXTI_EN;
|
||||
GPIOA->EXTI_INT_EN = gpio_state.GPIOA_EXTI_INT_EN;
|
||||
GPIOA->EXTI_TYPE = gpio_state.GPIOA_EXTI_TYPE;
|
||||
GPIOB->GPIO_OutputEN = gpio_state.GPIOB_OutputEN;
|
||||
GPIOB->GPIO_OUT_DATA = gpio_state.GPIOB_OUT_DATA;
|
||||
GPIOB->EXTI_EN = gpio_state.GPIOB_EXTI_EN;
|
||||
GPIOB->EXTI_INT_EN = gpio_state.GPIOB_EXTI_INT_EN;
|
||||
GPIOB->EXTI_TYPE = gpio_state.GPIOB_EXTI_TYPE;
|
||||
GPIOC->GPIO_OutputEN = gpio_state.GPIOC_OutputEN;
|
||||
GPIOC->GPIO_OUT_DATA = gpio_state.GPIOC_OUT_DATA;
|
||||
GPIOC->EXTI_EN = gpio_state.GPIOC_EXTI_EN;
|
||||
GPIOC->EXTI_INT_EN = gpio_state.GPIOC_EXTI_INT_EN;
|
||||
GPIOC->EXTI_TYPE = gpio_state.GPIOC_EXTI_TYPE;
|
||||
GPIOD->GPIO_OutputEN = gpio_state.GPIOD_OutputEN;
|
||||
GPIOD->GPIO_OUT_DATA = gpio_state.GPIOD_OUT_DATA;
|
||||
GPIOD->EXTI_EN = gpio_state.GPIOD_EXTI_EN;
|
||||
GPIOD->EXTI_INT_EN = gpio_state.GPIOD_EXTI_INT_EN;
|
||||
GPIOD->EXTI_TYPE = gpio_state.GPIOD_EXTI_TYPE;
|
||||
}
|
||||
|
||||
__RAM_CODE void hw_clock_init(void)
|
||||
{
|
||||
System_ClkConfig_t sys_clk_cfg;
|
||||
|
||||
sys_clk_cfg.AUPLL_CFG.PLL_N = 8;
|
||||
sys_clk_cfg.AUPLL_CFG.PLL_M = 0;
|
||||
sys_clk_cfg.AUPLL_CFG.PowerEn = 1;
|
||||
sys_clk_cfg.SPLL_CFG.PLL_N = 10;
|
||||
sys_clk_cfg.SPLL_CFG.PLL_M = 0;
|
||||
sys_clk_cfg.SPLL_CFG.PowerEn = 1;
|
||||
sys_clk_cfg.MCU_Clock_Source = MCU_CLK_SEL_SPLL_CLK;
|
||||
sys_clk_cfg.SOC_DIV = 1;
|
||||
sys_clk_cfg.MCU_DIV = 1;
|
||||
sys_clk_cfg.APB0_DIV = 1;
|
||||
sys_clk_cfg.APB1_DIV = 1;
|
||||
sys_clk_cfg.APB2_DIV = 1;
|
||||
sys_clk_cfg.APB3_DIV = 1;
|
||||
System_AUPLL_config(&sys_clk_cfg.AUPLL_CFG, 1000);
|
||||
System_SPLL_config(&sys_clk_cfg.SPLL_CFG, 1000);
|
||||
System_MCU_clock_Config(&sys_clk_cfg);
|
||||
|
||||
__SYSTEM_SPI_MASTER0_X8_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_SPI_MASTER1_X8_CLK_SELECT_AUPLL();
|
||||
__SYSTEM_I2C_CLK_SELECT_SPLL();
|
||||
__SYSTEM_BLEND_CLK_SELECT_SPLL();
|
||||
__SYSTEM_UART_CLK_SELECT_SPLL();
|
||||
}
|
27
SW/examples/application/bootloader/src/app_hw.h
Normal file
27
SW/examples/application/bootloader/src/app_hw.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __APP_HW_H__
|
||||
#define __APP_HW_H__
|
||||
|
||||
#include "fr30xx.h"
|
||||
|
||||
extern UART_HandleTypeDef uart_log_handle;
|
||||
extern DMA_HandleTypeDef dma_display_handle;
|
||||
extern SPI_HandleTypeDef spi_display_handle;
|
||||
extern I2C_HandleTypeDef i2c_touchpad_handle;
|
||||
extern SPI_HandleTypeDef spi_flash_handle;
|
||||
extern DMA_HandleTypeDef dma_flash_handle;
|
||||
|
||||
void hw_log_init(bool wake_up);
|
||||
void hw_display_init(bool wake_up);
|
||||
void hw_touchpad_init(bool wake_up);
|
||||
void hw_external_flash_init(bool wake_up);
|
||||
void hw_xip_flash_init(bool wake_up);
|
||||
void hw_dsp_xip_flash_init(bool wake_up);
|
||||
|
||||
void hw_clock_init(void);
|
||||
|
||||
void hw_gpio_save(void);
|
||||
void hw_gpio_restore(void);
|
||||
|
||||
void hw_dsp_restore(void);
|
||||
|
||||
#endif // __APP_HW_H__
|
1149
SW/examples/application/bootloader/src/app_ota.c
Normal file
1149
SW/examples/application/bootloader/src/app_ota.c
Normal file
File diff suppressed because it is too large
Load Diff
442
SW/examples/application/bootloader/src/app_ota_service.c
Normal file
442
SW/examples/application/bootloader/src/app_ota_service.c
Normal file
@ -0,0 +1,442 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 20203, Freqchip
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* INCLUDES (<28><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>)
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "co_util.h"
|
||||
#include "gap_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "timers.h"
|
||||
|
||||
#include "app_ota_service.h"
|
||||
#include "app_ota.h"
|
||||
|
||||
/******************************************************************************
|
||||
* MACROS (<28>궨<EFBFBD><EAB6A8>)
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* CONSTANTS (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* TYPEDEFS (<28><><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>)
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* LOCAL VARIABLES (<28>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>)
|
||||
*/
|
||||
static const uint8_t ota_svc_uuid[UUID_SIZE_16] = OTA_SVC_UUID;
|
||||
static uint8_t ota_svc_id = 0;
|
||||
static bool ota_link_ntf_enable = false;
|
||||
static TimerHandle_t xTimer_OtaAdvTimerOut = NULL;
|
||||
/******************************************************************************
|
||||
* GLOBAL VARIABLES (ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>)
|
||||
*/
|
||||
|
||||
static void app_ble_start_advertising(void);
|
||||
|
||||
static char local_device_name[] = "Smart Watch";
|
||||
adv_handle ota_adv;
|
||||
extern uint8_t ble_static_addr[];
|
||||
|
||||
/*
|
||||
* Advertising data, max size is 28 bytes
|
||||
*/
|
||||
static uint8_t adv_data[] = {
|
||||
|
||||
/* local device name information */
|
||||
0x0C, //length of this AD
|
||||
GAP_ADVTYPE_LOCAL_NAME_COMPLETE, //complete name AD type
|
||||
'S','m','a','r','t',' ','W','a','t','c','h', //value.local device name
|
||||
|
||||
0x09, // addr mac
|
||||
GAP_ADVTYPE_MANUFACTURER_SPECIFIC,
|
||||
LO_UINT16(0x1671),
|
||||
HI_UINT16(0x1671),
|
||||
0xc2,0x12,0x12,0x12,0x00,0x13,
|
||||
|
||||
0x03, // length of this data
|
||||
GAP_ADVTYPE_APPEARANCE,
|
||||
LO_UINT16(0x03c0),
|
||||
HI_UINT16(0x03c0),
|
||||
|
||||
|
||||
};
|
||||
|
||||
static uint16_t gap_callback(struct gap_event *event)
|
||||
{
|
||||
// printf("gap_callback: type = %d\r\n", event->type);
|
||||
switch(event->type) {
|
||||
case GATT_EVT_PROFILE_ADDED:
|
||||
{
|
||||
printf("gap_callback: GATT_EVT_PROFILE_ADDED: 0x%02X\r\n", event->param.profile_added_status);
|
||||
|
||||
/* service profile has been added successfully, then the advertising can be started */
|
||||
app_ble_start_advertising();
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_PARAM:
|
||||
printf("adv param set: 0x%02X\r\n", event->param.adv_set_param.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_ADV_DATA:
|
||||
printf("adv data set: 0x%02X\r\n", event->param.adv_set_adv_data.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_SET_SCAN_RSP:
|
||||
printf("adv scan rsp data set: 0x%02X\r\n", event->param.adv_set_scan_rsp.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_START:
|
||||
printf("adv start :0x%02X\r\n", event->param.adv_start.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_ADV_END:
|
||||
printf("adv end: 0x%02X\r\n", event->param.adv_end.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_SLAVE_CONNECT:
|
||||
{
|
||||
struct gap_link_param_update_req req;
|
||||
printf("slave connect[%d], connect num: %d\r\n", event->param.connect.conidx, gap_get_connect_num());
|
||||
gatt_mtu_exchange_req(ota_svc_id, event->param.connect.conidx, 247);
|
||||
req.conidx = event->param.connect.conidx;
|
||||
req.intv_max = 12;
|
||||
req.intv_min = 12;
|
||||
req.latency = 0;
|
||||
req.time_out = 500;
|
||||
gap_param_update_req(&req);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_DISCONNECT:
|
||||
{
|
||||
printf("gap_callback: GAP_EVT_DISCONNECT, conidx:%d, reason:0x%02X\r\n", event->param.disconnect.conidx,
|
||||
event->param.disconnect.reason);
|
||||
app_ble_start_advertising();
|
||||
}
|
||||
break;
|
||||
|
||||
case GATT_EVT_MTU:
|
||||
printf("gap_callback: conidx: %d, GATT_EVT_MTU: %d\r\n", event->param.mtu_ind.conidx, event->param.mtu_ind.mtu);
|
||||
break;
|
||||
|
||||
case GAP_EVT_NAME_REQ:
|
||||
{
|
||||
gap_name_req_rsp(event->param.name_req.conidx,
|
||||
event->param.name_req.token,
|
||||
sizeof(local_device_name),
|
||||
(uint8_t *)local_device_name);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_APPEARANCE_REQ:
|
||||
{
|
||||
gap_appearance_req_rsp(event->param.appearance_req.conidx,
|
||||
event->param.appearance_req.token,
|
||||
GAP_APPEARE_UNKNOWN);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_REQ:
|
||||
{
|
||||
struct gap_link_param_update_rsp rsp;
|
||||
rsp.accept = true;
|
||||
rsp.conidx = event->param.link_param_update_req.conidx;
|
||||
rsp.ce_len_max = 2;
|
||||
rsp.ce_len_min = 2;
|
||||
gap_param_update_rsp(&rsp);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_PARAM_UPDATE:
|
||||
{
|
||||
printf("conn param update,conidx:%d, con_int:%d, latency:%d, timeout%d\r\n", event->param.link_param_update.conidx,
|
||||
event->param.link_param_update.con_interval,
|
||||
event->param.link_param_update.con_latency,
|
||||
event->param.link_param_update.sup_to);
|
||||
}
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_RSSI:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_RSSI: %d\r\n", event->param.gap_link_rssi.conidx, event->param.gap_link_rssi.link_rssi);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_IND:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_IND: %d\r\n", event->param.gap_phy_ind.conidx, event->param.gap_phy_ind.tx_phy);
|
||||
break;
|
||||
|
||||
case GAP_EVT_PHY_REJECT:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_PHY_REJECT, status: %d\r\n", event->param.gap_phy_update_reject.conidx, event->param.gap_phy_update_reject.status);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_VER:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_VER\r\n", event->param.gap_link_ver.conidx);
|
||||
break;
|
||||
|
||||
case GAP_EVT_LINK_FEATURE:
|
||||
printf("gap_callback: conidx: %d, GAP_EVT_LINK_FEATURE:%d\r\n", event->param.gap_link_feature.conidx, event->param.gap_link_feature.features[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* @fn adv_timeout_callback
|
||||
*
|
||||
* @brief
|
||||
*/
|
||||
void adv_timeout_callback(TimerHandle_t timer)
|
||||
{
|
||||
check_file_integrity();
|
||||
}
|
||||
|
||||
void adv_timeout_TimerStop(void)
|
||||
{
|
||||
xTimerStop(xTimer_OtaAdvTimerOut,0);
|
||||
}
|
||||
static void app_ble_start_advertising(void)
|
||||
{
|
||||
/* creat a handle of advertising*/
|
||||
ota_adv = gap_adv_create();
|
||||
|
||||
gap_adv_param_t adv_param = {
|
||||
.own_addr_type = GAP_ADDR_TYPE_STATIC, //own address type
|
||||
.adv_mode = GAP_ADV_MODE_UNDIRECT,
|
||||
.disc_mode = GAP_ADV_DISC_MODE_GEN_DISC,
|
||||
.adv_chnl_map = GAP_ADV_CHAN_ALL,
|
||||
.filt_policy = GAP_ADV_FILTER_SCAN_ANY_CON_ANY, //Policy for filtering scanning or connection requests from peer devices
|
||||
.phy_mode = GAP_PHY_TYPE_LE_1M,
|
||||
.adv_intv_min = 32, //advertising min interval, in unit of 0.625ms
|
||||
.adv_intv_max = 32, //advertising max interval, in unit of 0.625ms
|
||||
};
|
||||
|
||||
/* set advertising param */
|
||||
gap_adv_set_param(ota_adv, &adv_param);
|
||||
/* set advertising data */
|
||||
|
||||
adv_data[17] = ble_static_addr[5];
|
||||
adv_data[18] = ble_static_addr[4];
|
||||
adv_data[19] = ble_static_addr[3];
|
||||
adv_data[20] = ble_static_addr[2];
|
||||
adv_data[21] = ble_static_addr[1];
|
||||
adv_data[22] = ble_static_addr[0];
|
||||
|
||||
gap_adv_set_adv_data(ota_adv, adv_data, sizeof(adv_data));
|
||||
/* start sadvertising */
|
||||
gap_adv_start(ota_adv, 0, 0);
|
||||
}
|
||||
|
||||
void app_ble_init(void)
|
||||
{
|
||||
printf("app_ble_init\r\n");
|
||||
|
||||
/* set GAP event callback*/
|
||||
gap_set_cb_func(gap_callback);
|
||||
|
||||
/* set security param */
|
||||
struct gap_security_param smp_param;
|
||||
smp_param.mitm = true;
|
||||
smp_param.secure_connection = false;
|
||||
smp_param.bond = true;
|
||||
smp_param.oob_used = GAP_OOB_AUTH_DATA_NOT_PRESENT;
|
||||
smp_param.io_cap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT;
|
||||
gap_security_param_init(&smp_param);
|
||||
/*start ota adv 1 min*/
|
||||
ota_gatt_add_service();
|
||||
/*ota adv timeout*/
|
||||
xTimer_OtaAdvTimerOut = xTimerCreate("ota_adv",OTA_ADV_TIMEOUT/portTICK_PERIOD_MS,pdFALSE,NULL,adv_timeout_callback);
|
||||
xTimerStart(xTimer_OtaAdvTimerOut,0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Profile Attributes - Table
|
||||
* ÿһ<C3BF><EFBFBD><EEB6BC>һ<EFBFBD><D2BB>attribute<74>Ķ<EFBFBD><C4B6>塣
|
||||
* <20><>һ<EFBFBD><D2BB>attributeΪService <20>ĵĶ<C4B5><C4B6>塣
|
||||
* ÿһ<C3BF><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ(characteristic)<29>Ķ<EFBFBD><C4B6>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD>ٰ<EFBFBD><D9B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>attribute<74>Ķ<EFBFBD><C4B6>壻
|
||||
* 1. <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>(Characteristic Declaration)
|
||||
* 2. <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ֵ(Characteristic value)
|
||||
* 3. <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(Characteristic description)
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>notification <20><><EFBFBD><EFBFBD>indication <20>Ĺ<EFBFBD><C4B9>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>attribute<74>Ķ<EFBFBD><C4B6>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD>ǰ<EFBFBD>涨<EFBFBD><E6B6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(client characteristic configuration)<29><>
|
||||
*
|
||||
*/
|
||||
const gatt_attribute_t ota_svc_att_table[OTA_ATT_NB] =
|
||||
{
|
||||
// Update Over The AIR Service Declaration
|
||||
[OTA_ATT_IDX_SERVICE] = { { UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID) },
|
||||
GATT_PROP_READ,UUID_SIZE_16, (uint8_t *)ota_svc_uuid
|
||||
},
|
||||
|
||||
// OTA Information Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_VERSION_INFO] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO]= { { UUID_SIZE_16, OTA_CHAR_UUID_VERSION_INFO },
|
||||
GATT_PROP_READ, sizeof(uint16_t), NULL
|
||||
},
|
||||
|
||||
// Notify Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ,0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_NOTI] = { { UUID_SIZE_16, OTA_CHAR_UUID_NOTI },
|
||||
GATT_PROP_READ | GATT_PROP_NOTI, OTAS_NOTIFY_DATA_SIZE, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_CFG_NOTI] = { { UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID) },
|
||||
GATT_PROP_READ | GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, 0,0
|
||||
},
|
||||
[OTA_IDX_CHAR_USER_DESCRIPTION_NOTI]= { { UUID_SIZE_2, UUID16_ARR(GATT_CHAR_USER_DESC_UUID) },
|
||||
GATT_PROP_READ, 12, NULL
|
||||
},
|
||||
|
||||
// Tx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_TX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_TX] = { { UUID_SIZE_16, OTA_CHAR_UUID_TX },
|
||||
GATT_PROP_READ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
|
||||
// Rx Characteristic Declaration
|
||||
[OTA_ATT_IDX_CHAR_DECLARATION_RX] = { { UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID) },
|
||||
GATT_PROP_READ, 0, NULL
|
||||
},
|
||||
[OTA_ATT_IDX_CHAR_VALUE_RX] = { { UUID_SIZE_16, OTA_CHAR_UUID_RX },
|
||||
GATT_PROP_WRITE_CMD | GATT_PROP_WRITE_REQ, OTAS_MAX_DATA_SIZE, NULL
|
||||
},
|
||||
};
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_msg_handler
|
||||
*
|
||||
* @brief Ota Profile callback funtion for GATT messages. GATT read/write
|
||||
* operations are handeled here.
|
||||
*
|
||||
* @param gatt_msg -GATT messages from GATT layer.
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
static uint16_t ota_gatt_msg_handler(struct gatt_msg *p_msg)
|
||||
{
|
||||
switch(p_msg->msg_evt)
|
||||
{
|
||||
case GATTS_MSG_READ_REQ:
|
||||
if(p_msg->att_idx == OTA_IDX_CHAR_USER_DESCRIPTION_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "OTA Response", strlen("OTA Response"));
|
||||
return strlen("OTA Response");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_NOTI)
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "ntf_enable", strlen("ntf_enable"));
|
||||
return strlen("ntf_enable");
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_TX)
|
||||
{
|
||||
return app_otas_read_data(p_msg->param.gatt_data.p_msg_data);
|
||||
}
|
||||
else if (p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_VERSION_INFO) //get version
|
||||
{
|
||||
memcpy(p_msg->param.gatt_data.p_msg_data, "\x00\x01", strlen("\x00\x01"));
|
||||
return strlen("\x00\x01");
|
||||
}
|
||||
break;
|
||||
|
||||
case GATTS_MSG_WRITE_REQ:
|
||||
if(p_msg->att_idx == OTA_ATT_IDX_CHAR_CFG_NOTI)
|
||||
{
|
||||
|
||||
if(*(uint16_t *)p_msg->param.gatt_data.p_msg_data == 0x1)
|
||||
{
|
||||
printf("true\r\n");
|
||||
ota_link_ntf_enable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("false\r\n");
|
||||
ota_link_ntf_enable = false;
|
||||
}
|
||||
}
|
||||
else if(p_msg->att_idx == OTA_ATT_IDX_CHAR_VALUE_RX)
|
||||
{
|
||||
app_otas_recv_data(p_msg->conn_idx,p_msg->param.gatt_data.p_msg_data,p_msg->param.gatt_data.msg_len);
|
||||
}
|
||||
break;
|
||||
case GATTC_MSG_CMP_EVT:
|
||||
|
||||
break;
|
||||
case GATTC_MSG_LINK_CREATE:
|
||||
ota_init();
|
||||
break;
|
||||
case GATTC_MSG_LINK_LOST:
|
||||
ota_deinit();
|
||||
ota_link_ntf_enable = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_report_notify
|
||||
*
|
||||
* @brief Send ota protocol response data.
|
||||
*
|
||||
*
|
||||
* @param conidx - report idx of the hid_rpt_info array.
|
||||
* p_data - data of the Ota information to be sent.
|
||||
* len - length of the HID information data.
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
void ota_gatt_report_notify(uint8_t conidx, uint8_t *p_data, uint16_t len)
|
||||
{
|
||||
if (ota_link_ntf_enable)
|
||||
{
|
||||
struct gatt_send_event ntf;
|
||||
ntf.conidx = conidx;
|
||||
ntf.svc_id = ota_svc_id;
|
||||
ntf.att_idx = OTA_ATT_IDX_CHAR_VALUE_NOTI;
|
||||
ntf.data_len = len;
|
||||
ntf.p_data = p_data;
|
||||
gatt_notification(&ntf);
|
||||
}
|
||||
}
|
||||
/*********************************************************************
|
||||
* @fn ota_gatt_add_service
|
||||
*
|
||||
* @brief Ota Profile add GATT service function.
|
||||
* <20><><EFBFBD><EFBFBD>GATT service<63><65>ATT<54><54><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>档
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
void ota_gatt_add_service(void)
|
||||
{
|
||||
gatt_service_t ota_profie_svc;
|
||||
ota_profie_svc.p_att_tb = ota_svc_att_table;
|
||||
ota_profie_svc.att_nb = OTA_ATT_NB;
|
||||
ota_profie_svc.gatt_msg_handler = ota_gatt_msg_handler;
|
||||
|
||||
ota_svc_id = gatt_add_service(&ota_profie_svc);
|
||||
}
|
||||
|
242
SW/examples/application/bootloader/src/app_task.c
Normal file
242
SW/examples/application/bootloader/src/app_task.c
Normal file
@ -0,0 +1,242 @@
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "app_at.h"
|
||||
#include "app_task.h"
|
||||
#include "app_ble.h"
|
||||
#include "app_btdm.h"
|
||||
#include "app_config.h"
|
||||
#include "app_hw.h"
|
||||
#include "driver_display.h"
|
||||
#include "IC_W25Qxx.h"
|
||||
|
||||
static struct co_list event_list;
|
||||
|
||||
extern TaskHandle_t app_task_handle;
|
||||
|
||||
void hci_controller_read(void);
|
||||
void hci_host_read(void);
|
||||
static void iwdt_task(void *arg);
|
||||
|
||||
#if BOARD_SEL == BOARD_EVB_FR5090
|
||||
#define LCD_HOR_SIZE (466)
|
||||
#define LCD_VER_SIZE (466)
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E
|
||||
#if 0 //DISPLAY_TYPE_ICNA3310
|
||||
#define LCD_HOR_SIZE (466)
|
||||
#define LCD_VER_SIZE (466)
|
||||
#else
|
||||
#define LCD_HOR_SIZE (368)
|
||||
#define LCD_VER_SIZE (448)
|
||||
#endif
|
||||
#elif BOARD_SEL == BOARD_EVB_FR3092E_CM
|
||||
#define LCD_HOR_SIZE (368)
|
||||
#define LCD_VER_SIZE (448)
|
||||
#else
|
||||
#error "choose correct board"
|
||||
#endif
|
||||
|
||||
#define LV_COLOR_DEPTH 16
|
||||
|
||||
#define LV_HOR_RES_MAX (368)
|
||||
#define LV_VER_RES_MAX (448)
|
||||
#if (((LCD_HOR_SIZE - LV_HOR_RES_MAX) / 2 ) & 0x01)
|
||||
#define HOR_OFFSET (((LCD_HOR_SIZE - LV_HOR_RES_MAX) / 2 ) + 0x01)
|
||||
#else
|
||||
#define HOR_OFFSET (((LCD_HOR_SIZE - LV_HOR_RES_MAX) / 2 ) + 0x00)
|
||||
#endif
|
||||
#if (((LCD_VER_SIZE - LV_VER_RES_MAX) / 2 ) & 0x01)
|
||||
#define VER_OFFSET (((LCD_VER_SIZE - LV_VER_RES_MAX) / 2 ) + 0x01)
|
||||
#else
|
||||
#define VER_OFFSET (((LCD_VER_SIZE - LV_VER_RES_MAX) / 2 ) + 0x00)
|
||||
#endif
|
||||
|
||||
#define DISPLAY_BUFFER_SIZE LV_HOR_RES_MAX*LV_VER_RES_MAX*LV_COLOR_DEPTH/8/sizeof(uint32_t)
|
||||
|
||||
static uint32_t display_framebuffer[DISPLAY_BUFFER_SIZE];
|
||||
|
||||
typedef int16_t lv_coord_t;
|
||||
|
||||
typedef struct {
|
||||
lv_coord_t x1;
|
||||
lv_coord_t y1;
|
||||
lv_coord_t x2;
|
||||
lv_coord_t y2;
|
||||
} lv_area_t;
|
||||
|
||||
lv_area_t panel_win_area;
|
||||
|
||||
|
||||
void dma1_irq(void)
|
||||
{
|
||||
if (dma_get_tfr_Status(&dma_display_handle)) {
|
||||
display_update_dma_isr();
|
||||
|
||||
printf("dma end!");
|
||||
|
||||
//display_dma_ongoing = false;
|
||||
//my_disp_flush_done();
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_DISPLAY_ONGOING);
|
||||
}
|
||||
}
|
||||
|
||||
void dma0_irq(void)
|
||||
{
|
||||
IC_W25Qxx_DMA_Interrupt();
|
||||
}
|
||||
|
||||
void spimx8_1_irq(void)
|
||||
{
|
||||
IC_W25Qxx_Spi_Interrupt();
|
||||
}
|
||||
|
||||
const int color_table[] =
|
||||
{
|
||||
0xf800f800,
|
||||
0x07E007E0,
|
||||
0x001F001F,
|
||||
0x0,
|
||||
0xF81FF81F,
|
||||
0x07FF07FF,
|
||||
0xFFEFFFE0,
|
||||
0xFFFFFFFF,
|
||||
};
|
||||
|
||||
|
||||
static int color_id = 0;
|
||||
|
||||
void panel_disp_update(void)
|
||||
{
|
||||
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_DISPLAY_ONGOING);
|
||||
//memset(display_framebuffer,0xf800f800,sizeof(display_framebuffer));
|
||||
for(int i = 0; i < DISPLAY_BUFFER_SIZE; i++)
|
||||
{
|
||||
display_framebuffer[i] = color_table[color_id];
|
||||
}
|
||||
|
||||
color_id ++;
|
||||
color_id %= 8;
|
||||
|
||||
panel_win_area.x1 = 0;
|
||||
panel_win_area.x2 = LV_HOR_RES_MAX -1;
|
||||
panel_win_area.y1 = 0;
|
||||
panel_win_area.y2 = LV_VER_RES_MAX -1;
|
||||
|
||||
display_set_window(HOR_OFFSET+panel_win_area.x1,
|
||||
HOR_OFFSET+panel_win_area.x2,
|
||||
VER_OFFSET+panel_win_area.y1,
|
||||
VER_OFFSET+panel_win_area.y2);
|
||||
|
||||
display_update_dma((panel_win_area.x2+1-panel_win_area.x1)*(panel_win_area.y2+1-panel_win_area.y1), 16, (void *)display_framebuffer);
|
||||
}
|
||||
|
||||
|
||||
static void app_task_event_handler(void)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
vTaskSuspendAll();
|
||||
event = (struct app_task_event *)co_list_pop_front(&event_list);
|
||||
xTaskResumeAll();
|
||||
|
||||
if(event) {
|
||||
switch(event->event_type) {
|
||||
case APP_TASK_EVENT_AT_CMD:
|
||||
app_at_cmd_recv_handler(event->param, event->param_len);
|
||||
break;
|
||||
case APP_TASK_EVENT_HOST_INITED:
|
||||
app_btdm_start();
|
||||
xTaskCreate(iwdt_task, "idwt_task", 128, NULL, APP_TASK_PRIORITY-1, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
vPortFree((void *)event);
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_event_post(struct app_task_event *event, bool high)
|
||||
{
|
||||
uint32_t old_basepri;
|
||||
|
||||
if(xPortIsInsideInterrupt()) {
|
||||
old_basepri = taskENTER_CRITICAL_FROM_ISR();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL_FROM_ISR(old_basepri);
|
||||
vTaskNotifyGiveFromISR(app_task_handle, NULL);
|
||||
}
|
||||
else {
|
||||
taskENTER_CRITICAL();
|
||||
if(high) {
|
||||
co_list_push_front(&event_list, &event->hdr);
|
||||
}
|
||||
else {
|
||||
co_list_push_back(&event_list, &event->hdr);
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
xTaskNotifyGive(app_task_handle);
|
||||
}
|
||||
}
|
||||
|
||||
struct app_task_event *app_task_event_alloc(uint8_t event_type, uint32_t param_len, bool block)
|
||||
{
|
||||
struct app_task_event *event = NULL;
|
||||
|
||||
while(event == NULL) {
|
||||
event = pvPortMalloc(sizeof(struct app_task_event) + param_len);
|
||||
if (event == NULL) {
|
||||
if (block) {
|
||||
vTaskDelay(10);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event->event_type = event_type;
|
||||
event->param_len = param_len;
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
static void app_task(void *arg)
|
||||
{
|
||||
co_list_init(&event_list);
|
||||
|
||||
app_btdm_init();
|
||||
while(1) {
|
||||
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||
app_task_event_handler();
|
||||
}
|
||||
}
|
||||
|
||||
static void iwdt_task(void *arg)
|
||||
{
|
||||
printf("iwdt task!\n");
|
||||
|
||||
/* reinit external flash */
|
||||
hw_external_flash_init(false);
|
||||
|
||||
hw_display_init(false);
|
||||
hw_touchpad_init(false);
|
||||
|
||||
while(1) {
|
||||
vTaskDelay(2000);
|
||||
iwdt_Refresh();
|
||||
panel_disp_update();
|
||||
}
|
||||
}
|
||||
|
||||
void app_task_init(void)
|
||||
{
|
||||
|
||||
xTaskCreate(app_task, "app", APP_TASK_STACK_SIZE, NULL, APP_TASK_PRIORITY, &app_task_handle);
|
||||
}
|
381
SW/examples/application/bootloader/src/controller.c
Normal file
381
SW/examples/application/bootloader/src/controller.c
Normal file
@ -0,0 +1,381 @@
|
||||
#include "fr30xx.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#include "SWD.h"
|
||||
#include "fdb_app.h"
|
||||
|
||||
#include "controller.h"
|
||||
|
||||
//#define CONTROLLER_CODE_SPLIT
|
||||
|
||||
#define HCI_UART UART0
|
||||
#define HCI_UART_IRQn UART0_IRQn
|
||||
|
||||
#ifndef CONTROLLER_CODE_SPLIT
|
||||
#define CODE_EXEC_BASE_ADDR 0x1FFFA000
|
||||
|
||||
extern uint8_t CODE_BASE, CODE_END;
|
||||
#else
|
||||
#define CODE_EXEC_L_BASE_ADDR 0x1FFF8000
|
||||
#define CODE_EXEC_H_BASE_ADDR_P1 0x20008700
|
||||
//#define CODE_EXEC_H_BASE_ADDR_P2 0x20008700
|
||||
|
||||
extern uint8_t CODE_L_BASE, CODE_L_END;
|
||||
extern uint8_t CODE_H_BASE, CODE_H_END;
|
||||
#endif
|
||||
|
||||
#define CONTROLLER_PARAM_DUMMY 0x00
|
||||
#define CONTROLLER_PARAM_BAUDRATE 0x01
|
||||
#define CONTROLLER_PARAM_KEY 0x02
|
||||
#define CONTROLLER_PARAM_BT_ADDR 0x03
|
||||
#define CONTROLLER_PARAM_BLE_ADDR 0x04
|
||||
|
||||
const uint8_t app_boot_conn_req[] = {'f','r','e','q','c','h','i','p'};//from embedded to pc, request
|
||||
const uint8_t app_boot_conn_ack[] = {'F','R','1','0','1','0','O','K'};//from pc to embedded,ack
|
||||
const uint8_t app_boot_conn_success[] = {'o','k'};
|
||||
|
||||
const uint8_t controller_param_header[] = {'f', 'r', 'e', 'q'};
|
||||
const uint8_t controller_param_tail[] = {'c', 'h', 'i', 'p'};
|
||||
|
||||
///default feature
|
||||
//static uint8_t bt_feature_param[] = {
|
||||
// 0x41,0x08,
|
||||
// 0xaf,0x2a,0x4d,0xde,0xc3,0x2f,0x5b,0x87,
|
||||
//};
|
||||
static uint8_t btdm_internal_param[] = {
|
||||
///bt_feature:disable 3M(Byte3,bit3),0xde->0xda
|
||||
0x41,0x08,
|
||||
0xaf,0x2a,0x4d,0xda,0xc3,0x2f,0x5b,0x87,
|
||||
///to add
|
||||
|
||||
};
|
||||
/* hardware handlers */
|
||||
static UART_HandleTypeDef HCI_handle;
|
||||
|
||||
/************************************************************************************
|
||||
* @fn controller_start
|
||||
*
|
||||
* @brief Initializes bluetooth controller.
|
||||
*
|
||||
* @param baudrate: uart baudrate of HCI
|
||||
* ble_addr: ble public address
|
||||
* bt_addr: bt address
|
||||
*/
|
||||
bool controller_start(uint32_t baudrate, const uint8_t *ble_addr, const uint8_t *bt_addr)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
uint8_t buffer[8];
|
||||
uint32_t length;
|
||||
uint8_t *src, *dst;
|
||||
uint16_t tx_length;
|
||||
uint8_t opcode, param_type;
|
||||
|
||||
/* configure PA0, PA1, PA2, PA3 to UART0 function */
|
||||
gpio_config.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
/* UART0: used for Log and AT command */
|
||||
__SYSTEM_UART0_CLK_ENABLE();
|
||||
HCI_handle.UARTx = HCI_UART;
|
||||
HCI_handle.Init.BaudRate = 115200;
|
||||
HCI_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
HCI_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
HCI_handle.Init.Parity = UART_PARITY_NONE;
|
||||
HCI_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
HCI_handle.TxCpltCallback = NULL;
|
||||
HCI_handle.RxCpltCallback = NULL;
|
||||
uart_init(&HCI_handle);
|
||||
/* keep RTS is inactive before HCI is ready */
|
||||
__UART_AUTO_FLOW_CONTROL_DISABLE(HCI_handle.UARTx);
|
||||
__UART_RTS_INACTIVE(HCI_handle.UARTx);
|
||||
|
||||
/* reset controller */
|
||||
/* configure PA15 GPIO function */
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_15, 0);
|
||||
system_delay_us(3000);
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_15, 1);
|
||||
|
||||
/* change PA15 to input mode, used to avoid current leakage */
|
||||
gpio_config.Pin = GPIO_PIN_15;
|
||||
gpio_config.Mode = GPIO_MODE_INPUT;
|
||||
gpio_config.Pull = GPIO_NOPULL;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
|
||||
/* hand shake with controller */
|
||||
uart_receive(&HCI_handle, buffer, 8);
|
||||
while (memcmp(buffer, app_boot_conn_req, 8)) {
|
||||
memcpy(&buffer[0], &buffer[1], 7);
|
||||
uart_receive(&HCI_handle, &buffer[7], 1);
|
||||
}
|
||||
|
||||
uart_transmit(&HCI_handle, (void *)app_boot_conn_ack, 8);
|
||||
uart_receive(&HCI_handle, buffer, 2);
|
||||
if (memcmp(buffer, app_boot_conn_success, 2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* SWD Enable RAM */
|
||||
SWD_W_SystemReg();
|
||||
|
||||
/* change uart baudrate */
|
||||
opcode = 0x12;
|
||||
buffer[0] = 11; // 921600
|
||||
buffer[1] = 0;
|
||||
buffer[2] = 0;
|
||||
buffer[3] = 0;
|
||||
buffer[4] = 0;
|
||||
buffer[5] = 0;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&buffer, 6);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x13) {
|
||||
return false;
|
||||
}
|
||||
HCI_handle.Init.BaudRate = 921600;
|
||||
uart_config_baudRate(&HCI_handle);
|
||||
system_delay_us(5000);
|
||||
|
||||
/* write code into RAM */
|
||||
#ifndef CONTROLLER_CODE_SPLIT
|
||||
opcode = 0x04;
|
||||
src = (void *)&CODE_BASE;
|
||||
dst = (void *)CODE_EXEC_BASE_ADDR;
|
||||
length = (uint32_t)&CODE_END - (uint32_t)&CODE_BASE;
|
||||
while (length) {
|
||||
tx_length = length > 256 ? 256 : length;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_transmit(&HCI_handle, src, tx_length);
|
||||
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
length -= tx_length;
|
||||
src += tx_length;
|
||||
dst += tx_length;
|
||||
}
|
||||
#else
|
||||
opcode = 0x04;
|
||||
src = (void *)&CODE_L_BASE;
|
||||
dst = (void *)CODE_EXEC_L_BASE_ADDR;
|
||||
length = (uint32_t)&CODE_L_END - (uint32_t)&CODE_L_BASE;
|
||||
while (length) {
|
||||
tx_length = length > 256 ? 256 : length;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_transmit(&HCI_handle, src, tx_length);
|
||||
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
length -= tx_length;
|
||||
src += tx_length;
|
||||
dst += tx_length;
|
||||
}
|
||||
|
||||
// opcode = 0x04;
|
||||
// src = (void *)&CODE_H_BASE;
|
||||
// dst = (void *)CODE_EXEC_H_BASE_ADDR_P2;
|
||||
// length = (uint32_t)&CODE_H_END - (uint32_t)&CODE_H_BASE;
|
||||
// if (length > (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1)) {
|
||||
// length -= (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1);
|
||||
// src += (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1);
|
||||
// }
|
||||
// else {
|
||||
// length = 0;
|
||||
// }
|
||||
// while (length) {
|
||||
// tx_length = length > 256 ? 256 : length;
|
||||
// uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
// uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
// uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
// uart_transmit(&HCI_handle, src, tx_length);
|
||||
//
|
||||
// uart_receive(&HCI_handle, buffer, 7);
|
||||
// if (buffer[0] != 0x05) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// length -= tx_length;
|
||||
// src += tx_length;
|
||||
// dst += tx_length;
|
||||
// }
|
||||
#endif
|
||||
|
||||
/* write parameters to exchange memory */
|
||||
opcode = 0x04;
|
||||
dst = (void *)0x40014000;
|
||||
/* write header to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = sizeof(controller_param_header);
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&controller_param_header[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write baudrate to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = sizeof(baudrate) + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_BAUDRATE;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = sizeof(baudrate);
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&baudrate, length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write keys to remote device */
|
||||
length = flashdb_get_length(FDB_KEY_CONTROLLER_INFO) + sizeof(btdm_internal_param);
|
||||
if (length) {
|
||||
uint8_t *tmp = pvPortMalloc(length);
|
||||
uint16_t sub_length = length;
|
||||
uint16_t key_len = length - sizeof(btdm_internal_param);
|
||||
if(key_len){
|
||||
flashdb_get(FDB_KEY_CONTROLLER_INFO, tmp, key_len);
|
||||
memcpy(&tmp[key_len],btdm_internal_param,sizeof(btdm_internal_param));
|
||||
}
|
||||
else{
|
||||
memcpy(&tmp[0],btdm_internal_param,sizeof(btdm_internal_param));
|
||||
}
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
|
||||
length = sub_length + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_KEY;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = sub_length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&tmp[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
vPortFree(tmp);
|
||||
return false;
|
||||
}
|
||||
vPortFree(tmp);
|
||||
}
|
||||
/* write bt address to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = 6 + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_BT_ADDR;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = 6;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&bt_addr[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write parameter to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = 6 + 1 + 2;
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
param_type = CONTROLLER_PARAM_BLE_ADDR;
|
||||
uart_transmit(&HCI_handle, (void *)¶m_type, 1);
|
||||
length = 6;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&ble_addr[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
/* write tail to remote device */
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
length = sizeof(controller_param_tail);
|
||||
dst += length;
|
||||
uart_transmit(&HCI_handle, (void *)&length, 2);
|
||||
uart_transmit(&HCI_handle, (void *)&controller_param_tail[0], length);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* boot from RAM */
|
||||
opcode = 0x2b;
|
||||
#ifndef CONTROLLER_CODE_SPLIT
|
||||
dst = (void *)CODE_EXEC_BASE_ADDR;
|
||||
#else
|
||||
dst = (void *)CODE_EXEC_L_BASE_ADDR;
|
||||
#endif
|
||||
tx_length = 0;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x2c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONTROLLER_CODE_SPLIT
|
||||
system_delay_us(50000);
|
||||
opcode = 0x04;
|
||||
src = (void *)&CODE_H_BASE;
|
||||
dst = (void *)CODE_EXEC_H_BASE_ADDR_P1;
|
||||
length = (uint32_t)&CODE_H_END - (uint32_t)&CODE_H_BASE;
|
||||
// if (length > (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1)) {
|
||||
// length = (CODE_EXEC_H_BASE_ADDR_P2 - CODE_EXEC_H_BASE_ADDR_P1);
|
||||
// }
|
||||
while (length) {
|
||||
tx_length = length > 256 ? 256 : length;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_transmit(&HCI_handle, src, tx_length);
|
||||
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x05) {
|
||||
return false;
|
||||
}
|
||||
|
||||
length -= tx_length;
|
||||
src += tx_length;
|
||||
dst += tx_length;
|
||||
}
|
||||
|
||||
/* disconnect */
|
||||
opcode = 0x10;
|
||||
dst = (void *)1; /* normal disconnect */
|
||||
tx_length = 0;
|
||||
uart_transmit(&HCI_handle, (void *)&opcode, 1);
|
||||
uart_transmit(&HCI_handle, (void *)&dst, 4);
|
||||
uart_transmit(&HCI_handle, (void *)&tx_length, 2);
|
||||
uart_receive(&HCI_handle, buffer, 7);
|
||||
if (buffer[0] != 0x11) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
363
SW/examples/application/bootloader/src/main.c
Normal file
363
SW/examples/application/bootloader/src/main.c
Normal file
@ -0,0 +1,363 @@
|
||||
/* Standard includes. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "fr30xx.h"
|
||||
#include "driver_pmu_iwdt.h"
|
||||
/* FreeRTOS kernel includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "fdb_app.h"
|
||||
#include "host.h"
|
||||
|
||||
#include "app_task.h"
|
||||
#include "app_at.h"
|
||||
#include "app_ota.h"
|
||||
#include "driver_timer.h"
|
||||
#include "app_hw.h"
|
||||
|
||||
/* hardware handlers */
|
||||
static UART_HandleTypeDef Uart3_handle;
|
||||
static CALI_HandleTypeDef cali_handle;
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
/* FreeRTOS running status monitor task */
|
||||
static TaskHandle_t monitor_task_handle;
|
||||
volatile unsigned int CPU_RunTime;
|
||||
static uint8_t CPU_RunInfo[2048];
|
||||
#endif
|
||||
|
||||
/* APP task */
|
||||
TaskHandle_t app_task_handle;
|
||||
|
||||
void controller_start(void);
|
||||
void host_start(void);
|
||||
|
||||
int fputc(int c, FILE *fp)
|
||||
{
|
||||
uart_transmit(&Uart3_handle, (void *)&c, 1);
|
||||
while(!(Uart3_handle.UARTx->USR.TFE));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
static void monitor_task(void *arg)
|
||||
{
|
||||
while(1) {
|
||||
vTaskDelay(2000000);
|
||||
|
||||
memset(CPU_RunInfo,0,2048);
|
||||
vTaskList((char *)&CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
printf("name state priority stack seq\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
|
||||
memset(CPU_RunInfo,0,400);
|
||||
vTaskGetRunTimeStats((char *)&CPU_RunInfo);
|
||||
printf("name counter usage\r\n");
|
||||
printf("%s", CPU_RunInfo);
|
||||
printf("---------------------------------------------\r\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
|
||||
{
|
||||
( void ) pcTaskName;
|
||||
( void ) pxTask;
|
||||
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
void vApplicationTickHook(void)
|
||||
{
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
CPU_RunTime++;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cali_done_handle(CALI_HandleTypeDef *hcali, uint32_t result)
|
||||
{
|
||||
system_set_LPRCCLK(cali_calc_rc_freq(hcali, result));
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
}
|
||||
|
||||
__RAM_CODE bool user_deep_sleep_check(void)
|
||||
{
|
||||
return host_before_sleep_check();
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_before_sleep(void)
|
||||
{
|
||||
ool_write16(PMU_REG_PIN_PULL_EN, 0x3fff);
|
||||
ool_write16(PMU_REG_PIN_PULL_SEL, 0x3fff);
|
||||
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) | 0x40);
|
||||
}
|
||||
|
||||
__RAM_CODE void user_entry_after_sleep(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
/*
|
||||
* enable pull up of all 3.3v IO, these configuration will be latched by set
|
||||
* BIT6 of PMU_REG_PMU_GATE_M regsiter. used to avoid electric leakage
|
||||
*/
|
||||
SYSTEM->PortA_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000dff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0x0000000;
|
||||
|
||||
host_hci_reinit();
|
||||
ool_write(PMU_REG_PMU_GATE_M, ool_read(PMU_REG_PMU_GATE_M) & (~0x40));
|
||||
NVIC_SetPriority(UART0_IRQn, 2);
|
||||
NVIC_EnableIRQ(UART0_IRQn);
|
||||
NVIC_SetPriority(PMU_IRQn, 4);
|
||||
NVIC_EnableIRQ(PMU_IRQn);
|
||||
|
||||
/* configure PA0 and PA1 to UART0 function */
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART0: used for Log and AT command */
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 115200;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
|
||||
/* restart calibration */
|
||||
__SYSTEM_CALI_CLK_ENABLE();
|
||||
cali_handle.mode = CALI_UP_MODE_NORMAL;
|
||||
cali_handle.rc_cnt = 60;
|
||||
cali_handle.DoneCallback = cali_done_handle;
|
||||
cali_init(&cali_handle);
|
||||
cali_start_IT(&cali_handle);
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
NVIC_SetPriority(CALI_IRQn, 2);
|
||||
NVIC_EnableIRQ(CALI_IRQn);
|
||||
}
|
||||
void wdt_rst_start(void)
|
||||
{
|
||||
iwdt_Init_t iwdt_handle;
|
||||
iwdt_handle.iwdt_int_Enable = WDT_INT_DISABLE;
|
||||
iwdt_handle.iwdt_Timeout = 0xFFF;
|
||||
iwdt_handle.iwdt_Count = 32000 * 3; // 32K, timeout 3s
|
||||
iwdt_init(iwdt_handle);
|
||||
|
||||
iwdt_Enable();
|
||||
}
|
||||
|
||||
void sys_iwdt_start(void)
|
||||
{
|
||||
iwdt_Init_t iwdt_handle;
|
||||
iwdt_handle.iwdt_int_Enable = WDT_INT_DISABLE;
|
||||
iwdt_handle.iwdt_Timeout = 0xFFF;
|
||||
iwdt_handle.iwdt_Count = 32000 * 6; // 32K, timeout 5s
|
||||
iwdt_init(iwdt_handle);
|
||||
|
||||
iwdt_Enable();
|
||||
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
GPIO_InitTypeDef gpio_config;
|
||||
|
||||
system_delay_us(1000000);
|
||||
|
||||
/* configure all interrupt priority to 2 */
|
||||
*(volatile uint32_t *)0xE000E400 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E404 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E408 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E40C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E410 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E414 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E418 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E41C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E420 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E424 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E428 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E42C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E430 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E434 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E438 = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E43C = 0x40404040;
|
||||
*(volatile uint32_t *)0xE000E440 = 0x40404040;
|
||||
|
||||
pmu_init();
|
||||
// /* Power Keep: 32KB PRAM, 128KB SRAM */
|
||||
// ool_write16(PMU_REG_PKSRAM_GATE, ~0x0063);
|
||||
|
||||
/* reinit flash controller */
|
||||
system_cache_enable(true);
|
||||
SYSTEM->QspiPadConfig.QSPI_FuncMux = 0x00000500;
|
||||
flash_enable_quad(QSPI0);
|
||||
flash_init_controller(QSPI0, FLASH_RD_TYPE_DUAL, FLASH_WR_TYPE_SINGLE);
|
||||
flash_set_baudrate(QSPI0, QSPI_BAUDRATE_DIV_4);
|
||||
|
||||
/* configure PB4 and PB5 to UART3 function */
|
||||
gpio_config.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_AF_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_1;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
|
||||
/* UART2: used for Log and AT command */
|
||||
__SYSTEM_UART3_CLK_ENABLE();
|
||||
Uart3_handle.UARTx = UART3;
|
||||
Uart3_handle.Init.BaudRate = 921600;
|
||||
Uart3_handle.Init.DataLength = UART_DATA_LENGTH_8BIT;
|
||||
Uart3_handle.Init.StopBits = UART_STOPBITS_1;
|
||||
Uart3_handle.Init.Parity = UART_PARITY_NONE;
|
||||
Uart3_handle.Init.FIFO_Mode = UART_FIFO_ENABLE;
|
||||
Uart3_handle.TxCpltCallback = NULL;
|
||||
Uart3_handle.RxCpltCallback = app_at_rx_done;
|
||||
uart_init(&Uart3_handle);
|
||||
|
||||
/*ota check*/
|
||||
ota_boot_start();
|
||||
|
||||
#if 1
|
||||
/* set SYSTEM BUCK to 1.35v, set DSP LDO and APP LDO to bypass mode */
|
||||
ool_write(PMU_REG_SYSBUCK_CTRL_0, 0x04);
|
||||
ool_write(PMU_REG_DSP_DLDO_CTRL, ool_read(PMU_REG_DSP_DLDO_CTRL)| 0x80);
|
||||
ool_write(PMU_REG_APP_DLDO_CTRL, ool_read(PMU_REG_APP_DLDO_CTRL)| 0x40);
|
||||
|
||||
/* initial system clock and XIP flash */
|
||||
hw_clock_init();
|
||||
hw_xip_flash_init(false);
|
||||
uart_init(&Uart3_handle);
|
||||
#endif
|
||||
|
||||
/*enable uart irq*/
|
||||
NVIC_SetPriority(UART3_IRQn, 4);
|
||||
NVIC_EnableIRQ(UART3_IRQn);
|
||||
|
||||
/* do calibration, get current RC frequency */
|
||||
__SYSTEM_CALI_CLK_ENABLE();
|
||||
cali_handle.mode = CALI_UP_MODE_NORMAL;
|
||||
cali_handle.rc_cnt = 200;
|
||||
cali_handle.DoneCallback = cali_done_handle;
|
||||
cali_init(&cali_handle);
|
||||
cali_start_IT(&cali_handle);
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_CALIBRATION);
|
||||
NVIC_SetPriority(CALI_IRQn, 4);
|
||||
NVIC_EnableIRQ(CALI_IRQn);
|
||||
|
||||
/* init flashdb to store user data */
|
||||
flashdb_init();
|
||||
printf("start running\r\n");
|
||||
|
||||
sys_iwdt_start();
|
||||
|
||||
/* Create tasks */
|
||||
#if ENABLE_RTOS_MONITOR == 1
|
||||
xTaskCreate(monitor_task, "monitor", MONITOR_TASK_STACK_SIZE, NULL, MONITOR_TASK_PRIORITY, &monitor_task_handle);
|
||||
#endif
|
||||
/* create application task */
|
||||
app_task_init();
|
||||
|
||||
/* initialize AT command */
|
||||
app_at_init(&Uart3_handle);
|
||||
|
||||
/*
|
||||
* enable pull up of all 3.3v IO, these configuration will be latched by set
|
||||
* BIT6 of PMU_REG_PMU_GATE_M regsiter. used to avoid electric leakage
|
||||
*/
|
||||
#if 1
|
||||
SYSTEM->PortA_PullSelect = 0x0000ff9f;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000fff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullSelect = 0x00000000;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0xffffffff;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullSelect = 0x00000000;
|
||||
SYSTEM->OspiPadConfig.OSPI_PullEN = 0xffffffff;
|
||||
|
||||
/* IO33 always on, IO18 off in sleep mode */
|
||||
ool_write(0x63, 0x08);
|
||||
|
||||
__SYSTEM_GPIOB_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_12;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLDOWN;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOB, &gpio_config);
|
||||
gpio_write_pin(GPIOB, GPIO_PIN_12, GPIO_PIN_CLEAR); // motor en: default output low
|
||||
|
||||
__SYSTEM_GPIOA_CLK_ENABLE();
|
||||
gpio_config.Pin = GPIO_PIN_5;
|
||||
gpio_config.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpio_config.Pull = GPIO_PULLUP;
|
||||
gpio_config.Alternate = GPIO_FUNCTION_0;
|
||||
gpio_init(GPIOA, &gpio_config);
|
||||
gpio_write_pin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); // HR sensor power en: default output high
|
||||
#else
|
||||
SYSTEM->PortA_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortB_PullSelect = 0x00000fff;
|
||||
SYSTEM->PortC_PullSelect = 0x00000000;
|
||||
SYSTEM->PortD_PullSelect = 0x0000ffff;
|
||||
SYSTEM->PortA_PullEN = 0x00007fff;
|
||||
SYSTEM->PortB_PullEN = 0x00000dff;
|
||||
SYSTEM->PortC_PullEN = 0x00000000;
|
||||
SYSTEM->PortD_PullEN = 0x0000ffff;
|
||||
SYSTEM->QspiPadConfig.QSPI_PullEN = 0x0000000;
|
||||
#endif
|
||||
/* enable sleep */
|
||||
//system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_DISABLE);
|
||||
printf("FR5090: BTDM test: 0x%04x.\r\n", ool_read16(PMU_REG_PIN_INPUT_EN));
|
||||
/* Start the scheduler itself. */
|
||||
vTaskStartScheduler();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uart3_irq(void)
|
||||
{
|
||||
uart_IRQHandler(&Uart3_handle);
|
||||
}
|
||||
|
||||
void PMU_GPIO_PMU_IRQHandler(void)
|
||||
{
|
||||
uint16_t data = ool_read16(PMU_REG_PIN_DATA);
|
||||
uint16_t result = ool_read16(PMU_REG_PIN_XOR_RESULT);
|
||||
|
||||
/* update last value with latest data */
|
||||
ool_write16(PMU_REG_PIN_LAST_V, data);
|
||||
/* clear last XOR result */
|
||||
ool_write16(PMU_REG_PIN_XOR_CLR, result);
|
||||
|
||||
if (data & PMU_PIN_9) {
|
||||
system_prevent_sleep_clear(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
else {
|
||||
system_prevent_sleep_set(SYSTEM_PREVENT_SLEEP_TYPE_HCI_RX);
|
||||
}
|
||||
}
|
||||
|
||||
void cali_irq(void)
|
||||
{
|
||||
cali_IRQHandler(&cali_handle);
|
||||
}
|
||||
|
Reference in New Issue
Block a user