[FL-1473, FL-1651] Update STM32CubeWB to latest version. Radio firmware bundle. (#642)

* FuriHal: update STM32CubeWB to latest version.
* Makefile: debug other script
* FuriHal: correctly handle 0 size transfers in VCP
* Dolphin: cleanup and minor timer tuning.
* FuriHal: update FreeRTOS config with bigger timer command queue.
* FuriHal: delayed irq enabling, fixes missing ticks.
* FuriHal: use SFSA to determine free space for internal FS, update linker script to use as much space as theoretically possible.
* Scripts: update core2 flashing scripts and OB data.
* Github: bundle resources, core2 firmware and supplementary data.
* GitHub: versioning for supplemental artifacts
This commit is contained in:
あく 2021-08-17 12:41:08 +03:00 committed by GitHub
parent 1f192c4a48
commit f02cec45a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 115 additions and 49 deletions

View File

@ -136,6 +136,26 @@ jobs:
>> artifacts/flipper-z-${TARGET}-full-${SUFFIX}.bin
done
- name: 'Bundle core2 firmware'
run: |
test -d core2_firmware && rm -rf core2_firmware || true
mkdir core2_firmware
cp \
lib/STM32CubeWB/package.xml \
lib/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/stm32wb5x_FUS_fw.bin \
lib/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/stm32wb5x_FUS_fw_for_fus_0_5_3.bin \
lib/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x/stm32wb5x_BLE_Stack_full_fw.bin \
core2_firmware
tar czpf artifacts/flipper-z-core2_firmware-${SUFFIX}.tgz core2_firmware
- name: 'Bundle scripts'
run: |
tar czpf artifacts/flipper-z-scripts-${SUFFIX}.tgz scripts
- name: 'Bundle resources'
run: |
tar czpf artifacts/flipper-z-resources-${SUFFIX}.tgz -C assets resources
- name: 'Upload artifacts to update server'
uses: burnett01/rsync-deployments@4.1
with:

View File

@ -117,7 +117,7 @@ bool dolphin_view_idle_main_input(InputEvent* event, void* context) {
with_value_mutex(
dolphin->menu_vm, (Menu * menu) { menu_ok(menu); });
} else if(event->key == InputKeyUp && event->type == InputTypeShort) {
osTimerStart(dolphin->timeout_timer, 40);
osTimerStart(dolphin->timeout_timer, 64);
view_dispatcher_switch_to_view(dolphin->idle_view_dispatcher, DolphinViewLockMenu);
} else if(event->key == InputKeyDown && event->type == InputTypeShort) {
dolphin_switch_to_app(dolphin, &FLIPPER_ARCHIVE);

View File

@ -46,8 +46,6 @@ struct Dolphin {
View* idle_view_first_start;
View* idle_view_main;
View* idle_view_dolphin_stats;
View* idle_view_down;
View* idle_view_meta;
View* view_hw_mismatch;
View* view_lockmenu;
ViewPort* lock_viewport;

View File

@ -0,0 +1,45 @@
POWER Samsung32 A:07 C:02
POWER NEC A:50 C:17
POWER NEC A:40 C:12
POWER NECext A:4931 C:63
POWER NEC A:AA C:1C
POWER NEC A:AA C:1C
POWER NEC A:AA C:1C
POWER NEC A:AA C:1C
POWER NEC A:38 C:1C
POWER NECext A:7A83 C:08
POWER NEC A:53 C:17
POWER NECext A:1818 C:C0
POWER NEC A:38 C:10
POWER NEC A:AA C:C5
POWER NEC A:04 C:08
POWER NEC A:18 C:08
POWER NEC A:71 C:08
POWER NECext A:6F80 C:0A
POWER NEC A:48 C:00
POWER NECext A:7B80 C:13
#POWER Samsung32 A:0E C:14
POWER NECext A:7E80 C:18
POWER NEC A:50 C:08
VOL- NECext A:DF00 C:4F
CH+ NECext A:DF00 C:09
CH- NECext A:DF00 C:05
MUTE NECext A:DF00 C:08
// Microlab (Not TV)
POWER NEC A:00 C:00
MUTE NEC A:00 C:02
VOL+ NEC A:00 C:11
VOL- NEC A:00 C:10
// Skyworth
POWER Samsung32 A:0E C:0C
MUTE Samsung32 A:0E C:0D
VOL+ Samsung32 A:0E C:14
VOL- Samsung32 A:0E C:15
CH- Samsung32 A:0E C:12
CH+ Samsung32 A:0E C:13
// LG (Goldstar)
MUTE NEC A

View File

@ -51,17 +51,16 @@
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
#include <stdint.h>
extern uint32_t SystemCoreClock;
void xPortSysTickHandler(void);
/* USER CODE BEGIN 0 */
extern void configureTimerForRunTimeStats(void);
extern unsigned long getRunTimeCounterValue(void);
/* USER CODE END 0 */
#endif
#ifndef CMSIS_device_header
#define CMSIS_device_header "stm32wbxx.h"
#endif /* CMSIS_device_header */
#define configENABLE_FPU 1
#define configENABLE_MPU 1
#define configUSE_PREEMPTION 1
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_STATIC_ALLOCATION 0
#define configSUPPORT_DYNAMIC_ALLOCATION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
@ -100,22 +99,24 @@
/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_QUEUE_LENGTH 32
#define configTIMER_TASK_STACK_DEPTH 256
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskDelay 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_xQueueGetMutexHolder 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xQueueGetMutexHolder 1
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_eTaskGetState 1
/*
* The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used
@ -159,9 +160,13 @@ standard names. */
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
/* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick,
to prevent overwriting SysTick_Handler defined within STM32Cube HAL */
/* IMPORTANT: After 10.3.1 update, Systick_Handler comes from NVIC (if SYS timebase = systick), otherwise from cmsis_os2.c */
/* #define xPortSysTickHandler SysTick_Handler */
#define USE_CUSTOM_SYSTICK_HANDLER_IMPLEMENTATION 1
/* USER CODE BEGIN Defines */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1 /* required only for Keil but does not hurt otherwise */
/* USER CODE END Defines */
#endif /* FREERTOS_CONFIG_H */

View File

@ -241,7 +241,9 @@ static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length)
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
_furi_hal_vcp_rx_callback((char*)Buf, *Len);
if (*Len) {
_furi_hal_vcp_rx_callback((char*)Buf, *Len);
}
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
/* USER CODE END 6 */

View File

@ -52,12 +52,13 @@ typedef PACKED_STRUCT
* THIS SHALL BE SET TO A VALUE DIFFERENT FROM 0 ONLY ON REQUEST FROM ST SUPPORT
*/
#define BLE_DTB_CFG 0
#define SYS_DBG_CFG1 (SHCI_C2_DEBUG_OPTIONS_IPCORE_LP | SHCI_C2_DEBUG_OPTIONS_CPU2_STOP_EN)
/* USER CODE END PD */
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static SHCI_C2_DEBUG_TracesConfig_t APPD_TracesConfig={0, 0, 0, 0};
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig={BLE_DTB_CFG, {0, 0, 0}};
PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static SHCI_C2_DEBUG_GeneralConfig_t APPD_GeneralConfig={BLE_DTB_CFG, SYS_DBG_CFG1, {0, 0}};
/**
* THE DEBUG ON GPIO FOR CPU2 IS INTENDED TO BE USED ONLY ON REQUEST FROM ST SUPPORT

View File

@ -5,7 +5,6 @@
/* Free flash space borders, exported by linker */
extern const void __free_flash_start__;
extern const void __free_flash_end__;
#define FURI_HAL_FLASH_READ_BLOCK 8
#define FURI_HAL_FLASH_WRITE_BLOCK 8
@ -37,7 +36,9 @@ const void* furi_hal_flash_get_free_start_address() {
}
const void* furi_hal_flash_get_free_end_address() {
return &__free_flash_end__;
FLASH_OBProgramInitTypeDef pOBInit;
HAL_FLASHEx_OBGetConfig(&pOBInit);
return (const void *)pOBInit.SecureFlashStartAddr;
}
size_t furi_hal_flash_get_free_page_start_address() {

View File

@ -26,6 +26,8 @@ void furi_hal_os_timer_callback() {
}
#endif
extern void xPortSysTickHandler();
volatile uint32_t furi_hal_os_skew = 0;
void furi_hal_os_init() {
@ -122,9 +124,6 @@ void vPortSuppressTicksAndSleep(TickType_t expected_idle_ticks) {
// Sleep and track how much ticks we spent sleeping
uint32_t completed_ticks = furi_hal_os_sleep(expected_idle_ticks);
// Reenable IRQ
__enable_irq();
// Notify system about time spent in sleep
if (completed_ticks > 0) {
if (completed_ticks > expected_idle_ticks) {
@ -133,6 +132,9 @@ void vPortSuppressTicksAndSleep(TickType_t expected_idle_ticks) {
vTaskStepTick(completed_ticks);
}
}
// Reenable IRQ
__enable_irq();
}
void vApplicationStackOverflowHook(TaskHandle_t xTask, signed char *pcTaskName) {

View File

@ -55,7 +55,7 @@ _Min_Stack_Size = 0x1000; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 780K
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 992K
RAM1 (xrw) : ORIGIN = 0x20000004, LENGTH = 0x2FFFC
RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
}
@ -173,7 +173,6 @@ SECTIONS
{
__free_flash_start__ = .;
. = ORIGIN(FLASH) + LENGTH(FLASH);
__free_flash_end__ = .;
} >FLASH
/* Remove information from the standard libraries */

View File

@ -55,7 +55,7 @@ _Min_Stack_Size = 0x1000; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 812K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM1 (xrw) : ORIGIN = 0x20000004, LENGTH = 0x2FFFC
RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
}
@ -173,7 +173,6 @@ SECTIONS
{
__free_flash_start__ = .;
. = ORIGIN(FLASH) + LENGTH(FLASH);
__free_flash_end__ = .;
} >FLASH
/* Remove information from the standard libraries */

@ -1 +1 @@
Subproject commit 1c15728a3c08e42919024e2a3781862f7d6c86d7
Subproject commit 9e2dd9db125fa53e0ec59f807eb8a052ab922583

View File

@ -88,22 +88,16 @@ debug: flash
-ex "compare-sections" \
$(OBJ_DIR)/$(PROJECT).elf; \
debug_other:
arm-none-eabi-gdb-py \
-ex 'target extended-remote | openocd -c "gdb_port pipe" $(OPENOCD_OPTS)' \
-ex "set confirm off" \
-ex "source ../debug/PyCortexMDebug/PyCortexMDebug.py" \
-ex "svd_load $(SVD_FILE)" \
openocd:
openocd $(OPENOCD_OPTS)
bm_debug: flash
set -m; blackmagic & echo $$! > $(OBJ_DIR)/agent.PID
arm-none-eabi-gdb-py \
-ex "target extended-remote 127.0.0.1:2000" \
-ex "set confirm off" \
-ex "monitor debug_bmp enable"\
-ex "monitor swdp_scan"\
-ex "attach 1"\
-ex "source ../debug/FreeRTOS/FreeRTOS.py" \
$(OBJ_DIR)/$(PROJECT).elf; \
kill `cat $(OBJ_DIR)/agent.PID`; \
rm $(OBJ_DIR)/agent.PID
clean:
@echo "\tCLEAN\t"
@$(RM) $(OBJ_DIR)/*

View File

@ -6,7 +6,7 @@ SCRIPT_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
COPRO_DIR="$PROJECT_DIR/lib/STM32CubeWB/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x"
STM32_Programmer_CLI -c port=swd -fwupgrade $COPRO_DIR/stm32wb5x_FUS_fw_1_0_2.bin 0x080EC000 || true
STM32_Programmer_CLI -c port=swd -fwupgrade $COPRO_DIR/stm32wb5x_FUS_fw_for_fus_0_5_3.bin 0x080EC000 || true
STM32_Programmer_CLI -c port=swd
STM32_Programmer_CLI -c port=swd -fwupgrade $COPRO_DIR/stm32wb5x_FUS_fw.bin 0x080EC000 || true
@ -14,7 +14,7 @@ STM32_Programmer_CLI -c port=swd
STM32_Programmer_CLI -c port=swd -fwdelete
STM32_Programmer_CLI -c port=swd -fwupgrade $COPRO_DIR/stm32wb5x_BLE_Stack_full_fw.bin 0x080CB000 firstinstall=0
STM32_Programmer_CLI -c port=swd -fwupgrade $COPRO_DIR/stm32wb5x_BLE_Stack_full_fw.bin 0x080CA000 firstinstall=0
STM32_Programmer_CLI -c port=swd -ob nSWBOOT0=1 nBOOT0=1

View File

@ -14,7 +14,7 @@ IWDGSTOP:0x1:rw
IWDGSW:0x1:rw
IPCCDBA:0x0:rw
ESE:0x1:r
SFSA:0xCB:r
SFSA:0xCA:r
FSD:0x0:r
DDS:0x1:r
C2OPT:0x1:r
@ -22,7 +22,7 @@ NBRSD:0x0:r
SNBRSA:0xF:r
BRSD:0x0:r
SBRSA:0xA:r
SBRV:0x32C00:r
SBRV:0x32800:r
PCROP1A_STRT:0x1FF:r
PCROP1A_END:0x0:r
PCROP_RDP:0x1:r