[chibios] Bootloader support for Lisa/Lia M/MX and PX4FMU

This commit is contained in:
Michal Podhradsky
2017-03-18 18:52:48 -07:00
parent 3f4a05d13a
commit 717cd10e49
7 changed files with 193 additions and 94 deletions
@@ -12,7 +12,7 @@
<firmware name="rotorcraft"> <firmware name="rotorcraft">
<target name="ap" board="px4fmu_2.4" /> <target name="ap" board="px4fmu_2.4_chibios" />
<configure name="PERIODIC_FREQUENCY" value="200"/> <configure name="PERIODIC_FREQUENCY" value="200"/>
<configure name="TELEMETRY_FREQUENCY" value="60"/> <configure name="TELEMETRY_FREQUENCY" value="60"/>
@@ -121,7 +121,7 @@
<modules main_freq="PERIODIC_FREQUENCY"> <modules main_freq="PERIODIC_FREQUENCY">
<!-- allow flashing FBW target through AP --> <!-- allow flashing FBW target through AP -->
<module name="px4_flash"/> <!--module name="px4_flash"/-->
<!-- CPU utilization monitor --> <!-- CPU utilization monitor -->
<module name="sys_mon"/> <module name="sys_mon"/>
@@ -11,6 +11,7 @@ RP3 Lisa MX
<module name="radio_control" type="sbus"> <module name="radio_control" type="sbus">
<configure name="SBUS_PORT" value="UART5"/> <configure name="SBUS_PORT" value="UART5"/>
</module> </module>
<configure name="HAS_LUFTBOOT" value="1"/>
</target> </target>
<!-- NOTE: if you want to use extra_dl module for HITL <!-- NOTE: if you want to use extra_dl module for HITL
+4 -5
View File
@@ -25,7 +25,7 @@ PROJECT = $(TARGET)
# Project specific files and paths (see Makefile.chibios for details) # Project specific files and paths (see Makefile.chibios for details)
CHIBIOS_BOARD_PLATFORM = STM32F1xx/platform.mk CHIBIOS_BOARD_PLATFORM = STM32F1xx/platform.mk
# CHIBIOS_BOARD_LINKER script depends on whether we use a bootloader or not, see below CHIBIOS_BOARD_LINKER = STM32F107xC.ld
CHIBIOS_BOARD_STARTUP = startup_stm32f1xx.mk CHIBIOS_BOARD_STARTUP = startup_stm32f1xx.mk
############################################################################## ##############################################################################
@@ -39,8 +39,7 @@ FLASH_MODE ?= DFU
HAS_LUFTBOOT ?= 1 HAS_LUFTBOOT ?= 1
ifeq (,$(findstring $(HAS_LUFTBOOT),0 FALSE)) ifeq (,$(findstring $(HAS_LUFTBOOT),0 FALSE))
$(TARGET).CFLAGS+=-DLUFTBOOT -DCORTEX_VTOR_INIT=0x00002000 $(TARGET).CFLAGS+=-DLUFTBOOT
CHIBIOS_BOARD_LINKER = STM32F107xC_luftboot.ld DFU_ADDR = 0x8002000
else DFU_PRODUCT = Lisa/Lia
CHIBIOS_BOARD_LINKER = STM32F107xC.ld
endif endif
+7 -2
View File
@@ -30,11 +30,16 @@ CHIBIOS_BOARD_PLATFORM = STM32F4xx/platform.mk
CHIBIOS_BOARD_LINKER = STM32F407xG.ld CHIBIOS_BOARD_LINKER = STM32F407xG.ld
CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk
HAS_LUFTBOOT ?= 0
ifeq (,$(findstring $(HAS_LUFTBOOT),0 FALSE))
$(TARGET).CFLAGS+=-DLUFTBOOT
DFU_ADDR = 0x8004000
DFU_PRODUCT = Lisa/Lia
endif
############################################################################## ##############################################################################
# Compiler settings # Compiler settings
# #
MCU = cortex-m4 MCU = cortex-m4
HAS_LUFTBOOT = FALSE
include $(PAPARAZZI_SRC)/conf/boards/lisa_mx_defaults.makefile include $(PAPARAZZI_SRC)/conf/boards/lisa_mx_defaults.makefile
+8
View File
@@ -32,6 +32,14 @@ CHIBIOS_BOARD_PLATFORM = STM32F4xx/platform.mk
CHIBIOS_BOARD_LINKER = STM32F407xG.ld CHIBIOS_BOARD_LINKER = STM32F407xG.ld
CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk
# In this case we dont have LUFTBOOT but PX4_BOOTLOADER, but in order
# to correctly initialize the interrupt vector we have to define that
# the board has LUFTBOOT
HAS_LUFTBOOT ?= 1
ifeq (,$(findstring $(HAS_LUFTBOOT),0 FALSE))
$(TARGET).CFLAGS+=-DLUFTBOOT
endif
############################################################################## ##############################################################################
# Compiler settings # Compiler settings
# #
@@ -1,85 +1,85 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* /*
* ST32F107xC memory setup. * ST32F107xC memory setup.
* with LUFTBOOT offset */
*/ MEMORY
MEMORY {
{ flash0 : org = 0x08002000, len = 256k
flash0 : org = 0x08002000, len = 256k flash1 : org = 0x00000000, len = 0
flash1 : org = 0x00000000, len = 0 flash2 : org = 0x00000000, len = 0
flash2 : org = 0x00000000, len = 0 flash3 : org = 0x00000000, len = 0
flash3 : org = 0x00000000, len = 0 flash4 : org = 0x00000000, len = 0
flash4 : org = 0x00000000, len = 0 flash5 : org = 0x00000000, len = 0
flash5 : org = 0x00000000, len = 0 flash6 : org = 0x00000000, len = 0
flash6 : org = 0x00000000, len = 0 flash7 : org = 0x00000000, len = 0
flash7 : org = 0x00000000, len = 0 ram0 : org = 0x20000000, len = 64k
ram0 : org = 0x20000000, len = 64k ram1 : org = 0x00000000, len = 0
ram1 : org = 0x00000000, len = 0 ram2 : org = 0x00000000, len = 0
ram2 : org = 0x00000000, len = 0 ram3 : org = 0x00000000, len = 0
ram3 : org = 0x00000000, len = 0 ram4 : org = 0x00000000, len = 0
ram4 : org = 0x00000000, len = 0 ram5 : org = 0x00000000, len = 0
ram5 : org = 0x00000000, len = 0 ram6 : org = 0x00000000, len = 0
ram6 : org = 0x00000000, len = 0 ram7 : org = 0x00000000, len = 0
ram7 : org = 0x00000000, len = 0 }
}
/* For each data/text section two region are defined, a virtual region
/* For each data/text section two region are defined, a virtual region and a load region (_LMA suffix).*/
and a load region (_LMA suffix).*/
/* Flash region to be used for exception vectors.*/
/* Flash region to be used for exception vectors.*/ REGION_ALIAS("VECTORS_FLASH", flash0);
REGION_ALIAS("VECTORS_FLASH", flash0); REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
/* Flash region to be used for constructors and destructors.*/
/* Flash region to be used for constructors and destructors.*/ REGION_ALIAS("XTORS_FLASH", flash0);
REGION_ALIAS("XTORS_FLASH", flash0); REGION_ALIAS("XTORS_FLASH_LMA", flash0);
REGION_ALIAS("XTORS_FLASH_LMA", flash0);
/* Flash region to be used for code text.*/
/* Flash region to be used for code text.*/ REGION_ALIAS("TEXT_FLASH", flash0);
REGION_ALIAS("TEXT_FLASH", flash0); REGION_ALIAS("TEXT_FLASH_LMA", flash0);
REGION_ALIAS("TEXT_FLASH_LMA", flash0);
/* Flash region to be used for read only data.*/
/* Flash region to be used for read only data.*/ REGION_ALIAS("RODATA_FLASH", flash0);
REGION_ALIAS("RODATA_FLASH", flash0); REGION_ALIAS("RODATA_FLASH_LMA", flash0);
REGION_ALIAS("RODATA_FLASH_LMA", flash0);
/* Flash region to be used for various.*/
/* Flash region to be used for various.*/ REGION_ALIAS("VARIOUS_FLASH", flash0);
REGION_ALIAS("VARIOUS_FLASH", flash0); REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
/* Flash region to be used for RAM(n) initialization data.*/
/* Flash region to be used for RAM(n) initialization data.*/ REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
/* RAM region to be used for Main stack. This stack accommodates the processing
/* RAM region to be used for Main stack. This stack accommodates the processing of all exceptions and interrupts.*/
of all exceptions and interrupts.*/ REGION_ALIAS("MAIN_STACK_RAM", ram0);
REGION_ALIAS("MAIN_STACK_RAM", ram0);
/* RAM region to be used for the process stack. This is the stack used by
/* RAM region to be used for the process stack. This is the stack used by the main() function.*/
the main() function.*/ REGION_ALIAS("PROCESS_STACK_RAM", ram0);
REGION_ALIAS("PROCESS_STACK_RAM", ram0);
/* RAM region to be used for data segment.*/
/* RAM region to be used for data segment.*/ REGION_ALIAS("DATA_RAM", ram0);
REGION_ALIAS("DATA_RAM", ram0); REGION_ALIAS("DATA_RAM_LMA", flash0);
REGION_ALIAS("DATA_RAM_LMA", flash0);
/* RAM region to be used for BSS segment.*/
/* RAM region to be used for BSS segment.*/ REGION_ALIAS("BSS_RAM", ram0);
REGION_ALIAS("BSS_RAM", ram0);
/* RAM region to be used for the default heap.*/
/* RAM region to be used for the default heap.*/ REGION_ALIAS("HEAP_RAM", ram0);
REGION_ALIAS("HEAP_RAM", ram0);
/* Generic rules inclusion.*/
INCLUDE rules.ld INCLUDE rules.ld
+86
View File
@@ -0,0 +1,86 @@
/*
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* STM32F407xG memory setup.
* Note: Use of ram1 and ram2 is mutually exclusive with use of ram0.
*/
MEMORY
{
flash0 : org = 0x08004000, len = 1M
flash1 : org = 0x00000000, len = 0
flash2 : org = 0x00000000, len = 0
flash3 : org = 0x00000000, len = 0
flash4 : org = 0x00000000, len = 0
flash5 : org = 0x00000000, len = 0
flash6 : org = 0x00000000, len = 0
flash7 : org = 0x00000000, len = 0
ram0 : org = 0x20000000, len = 128k /* SRAM1 + SRAM2 */
ram1 : org = 0x20000000, len = 112k /* SRAM1 */
ram2 : org = 0x2001C000, len = 16k /* SRAM2 */
ram3 : org = 0x00000000, len = 0
ram4 : org = 0x10000000, len = 64k /* CCM SRAM */
ram5 : org = 0x40024000, len = 4k /* BCKP SRAM */
ram6 : org = 0x00000000, len = 0
ram7 : org = 0x00000000, len = 0
}
/* For each data/text section two region are defined, a virtual region
and a load region (_LMA suffix).*/
/* Flash region to be used for exception vectors.*/
REGION_ALIAS("VECTORS_FLASH", flash0);
REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
/* Flash region to be used for constructors and destructors.*/
REGION_ALIAS("XTORS_FLASH", flash0);
REGION_ALIAS("XTORS_FLASH_LMA", flash0);
/* Flash region to be used for code text.*/
REGION_ALIAS("TEXT_FLASH", flash0);
REGION_ALIAS("TEXT_FLASH_LMA", flash0);
/* Flash region to be used for read only data.*/
REGION_ALIAS("RODATA_FLASH", flash0);
REGION_ALIAS("RODATA_FLASH_LMA", flash0);
/* Flash region to be used for various.*/
REGION_ALIAS("VARIOUS_FLASH", flash0);
REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
/* Flash region to be used for RAM(n) initialization data.*/
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
/* RAM region to be used for Main stack. This stack accommodates the processing
of all exceptions and interrupts.*/
REGION_ALIAS("MAIN_STACK_RAM", ram0);
/* RAM region to be used for the process stack. This is the stack used by
the main() function.*/
REGION_ALIAS("PROCESS_STACK_RAM", ram0);
/* RAM region to be used for data segment.*/
REGION_ALIAS("DATA_RAM", ram0);
REGION_ALIAS("DATA_RAM_LMA", flash0);
/* RAM region to be used for BSS segment.*/
REGION_ALIAS("BSS_RAM", ram0);
/* RAM region to be used for the default heap.*/
REGION_ALIAS("HEAP_RAM", ram0);
/* Generic rules inclusion.*/
INCLUDE rules.ld