Cleaned up ChibiOS makefile script (now depends on linker scripts in chibios directory)

Added first part of lia_1.1_chibios makefile
Tested on Lisa MX
This commit is contained in:
Michal Podhradsky
2017-02-06 18:38:46 -08:00
parent 056433d653
commit dcae49bed3
6 changed files with 91 additions and 255 deletions
+1 -2
View File
@@ -30,7 +30,7 @@ BOARD_DIR ?= $(BOARD)/chibios
CHIBIOS_BOARD_DIR = $(PAPARAZZI_SRC)/sw/airborne/boards/$(BOARD_DIR) CHIBIOS_BOARD_DIR = $(PAPARAZZI_SRC)/sw/airborne/boards/$(BOARD_DIR)
# chibos arch directory # chibos arch directory
CHIBIOS_ARCH_DIR = $(PAPARAZZI_SRC)/sw/airborne/arch/chibios CHIBIOS_ARCH_DIR = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/ld
# Launch with "make Q=''" to get full command display # Launch with "make Q=''" to get full command display
Q=@ Q=@
@@ -185,7 +185,6 @@ endif
# Define linker script file here # Define linker script file here
LDSCRIPT= $(CHIBIOS_ARCH_DIR)/$(CHIBIOS_BOARD_LINKER) LDSCRIPT= $(CHIBIOS_ARCH_DIR)/$(CHIBIOS_BOARD_LINKER)
#LDSCRIPT= $(STARTUPLD)/$(CHIBIOS_BOARD_LINKER)
# C sources that can be compiled in ARM or THUMB mode depending on the global # C sources that can be compiled in ARM or THUMB mode depending on the global
# setting. # setting.
+2 -3
View File
@@ -14,7 +14,7 @@ $(TARGET).ARCHDIR = $(ARCH)
RTOS=chibios RTOS=chibios
## FPU on F4 # FPU on F4
USE_FPU=yes USE_FPU=yes
HARD_FLOAT=yes HARD_FLOAT=yes
@@ -28,8 +28,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 = STM32F4xx/platform.mk CHIBIOS_BOARD_PLATFORM = STM32F4xx/platform.mk
CHIBIOS_BOARD_PORT = ARMCMx/STM32F4xx/port.mk CHIBIOS_BOARD_LINKER = STM32F407xG.ld
CHIBIOS_BOARD_LINKER = STM32F407xG_ccm.ld
CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk
############################################################################## ##############################################################################
+86
View File
@@ -0,0 +1,86 @@
# Hey Emacs, this is a -*- makefile -*-
#
# Lisa_MX_2.1_chibios.makefile
#
#
BOARD=lisa
BOARD_VERSION=2.1
BOARD_DIR=$(BOARD)/chibios/v$(BOARD_VERSION)
BOARD_CFG=\"boards/$(BOARD_DIR)/board.h\"
ARCH=chibios
$(TARGET).ARCHDIR = $(ARCH)
RTOS=chibios
# FPU not present on F1
USE_FPU=no
HARD_FLOAT=no
$(TARGET).CFLAGS += -DSTM32F1 -DPPRZLINK_ENABLE_FD
##############################################################################
# Architecture or project specific options
#
# Define project name here (target)
PROJECT = $(TARGET)
# Project specific files and paths (see Makefile.chibios for details)
CHIBIOS_BOARD_PLATFORM = STM32F1xx/platform.mk
CHIBIOS_BOARD_LINKER = STM32F107xC.ld
CHIBIOS_BOARD_STARTUP = startup_stm32f1xx.mk
##############################################################################
# Compiler settings
#
MCU = cortex-m3
# default flash mode is via usb dfu bootloader (luftboot)
# other possibilities: DFU-UTIL, JTAG, SWD, STLINK, SERIAL
FLASH_MODE ?= DFU
HAS_LUFTBOOT ?= 1
ifeq (,$(findstring $(HAS_LUFTBOOT),0 FALSE))
$(TARGET).CFLAGS+=-DLUFTBOOT
$(TARGET).LDFLAGS+=-Wl,-Ttext=0x8002000
endif
#
#
# some default values shared between different firmwares
#
#
#
# default LED configuration
#
RADIO_CONTROL_LED ?= 4
BARO_LED ?= none
AHRS_ALIGNER_LED ?= 2
GPS_LED ?= 3
SYS_TIME_LED ?= 1
#
# default uart configuration
#
RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT ?= UART1
RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT ?= UART5
MODEM_PORT ?= UART2
MODEM_BAUD ?= B57600
GPS_PORT ?= UART3
GPS_BAUD ?= B38400
#
# default actuator configuration
#
# you can use different actuators by adding a configure option to your firmware section
# e.g. <configure name="ACTUATORS" value="actuators_ppm/>
# and by setting the correct "driver" attribute in servo section
# e.g. <servo driver="Ppm">
#
ACTUATORS ?= actuators_pwm
+2 -3
View File
@@ -14,7 +14,7 @@ $(TARGET).ARCHDIR = $(ARCH)
RTOS=chibios RTOS=chibios
## FPU on F4 # FPU on F4
USE_FPU=yes USE_FPU=yes
HARD_FLOAT=yes HARD_FLOAT=yes
@@ -28,8 +28,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 = STM32F4xx/platform.mk CHIBIOS_BOARD_PLATFORM = STM32F4xx/platform.mk
CHIBIOS_BOARD_PORT = ARMCMx/STM32F4xx/port.mk CHIBIOS_BOARD_LINKER = STM32F407xG.ld
CHIBIOS_BOARD_LINKER = STM32F407xG_ccm.ld
CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk CHIBIOS_BOARD_STARTUP = startup_stm32f4xx.mk
############################################################################## ##############################################################################
-162
View File
@@ -1,162 +0,0 @@
/*
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
2011,2012,2013 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
ChibiOS/RT is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
ChibiOS/RT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
---
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes ChibiOS/RT, without being obliged to provide
the source code for any proprietary components. See the file exception.txt
for full details of how and when the exception can be applied.
*/
/*
* ST32F407xG memory setup.
*/
__main_stack_size__ = 0x0400;
__process_stack_size__ = 0x0400;
MEMORY
{
flash : org = 0x08004000, len = 1M
ram : org = 0x20000000, len = 112k
ethram : org = 0x2001C000, len = 16k
ccmram : org = 0x10000000, len = 64k
}
__ram_start__ = ORIGIN(ram);
__ram_size__ = LENGTH(ram);
__ram_end__ = __ram_start__ + __ram_size__;
ENTRY(ResetHandler)
SECTIONS
{
. = 0;
_text = .;
startup : ALIGN(16) SUBALIGN(16)
{
KEEP(*(vectors))
} > flash
constructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE(__init_array_end = .);
} > flash
destructors : ALIGN(4) SUBALIGN(4)
{
PROVIDE(__fini_array_start = .);
KEEP(*(.fini_array))
KEEP(*(SORT(.fini_array.*)))
PROVIDE(__fini_array_end = .);
} > flash
.text : ALIGN(16) SUBALIGN(16)
{
*(.text.startup.*)
*(.text)
*(.text.*)
*(.rodata)
*(.rodata.*)
*(.glue_7t)
*(.glue_7)
*(.gcc*)
} > flash
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > flash
.ARM.exidx : {
PROVIDE(__exidx_start = .);
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
PROVIDE(__exidx_end = .);
} > flash
.eh_frame_hdr :
{
*(.eh_frame_hdr)
} > flash
.eh_frame : ONLY_IF_RO
{
*(.eh_frame)
} > flash
.textalign : ONLY_IF_RO
{
. = ALIGN(8);
} > flash
. = ALIGN(4);
_etext = .;
_textdata = _etext;
.stacks :
{
. = ALIGN(8);
__main_stack_base__ = .;
. += __main_stack_size__;
. = ALIGN(8);
__main_stack_end__ = .;
__process_stack_base__ = .;
__main_thread_stack_base__ = .;
. += __process_stack_size__;
. = ALIGN(8);
__process_stack_end__ = .;
__main_thread_stack_end__ = .;
} > ram
.data :
{
. = ALIGN(4);
PROVIDE(_data = .);
*(.data)
. = ALIGN(4);
*(.data.*)
. = ALIGN(4);
*(.ramtext)
. = ALIGN(4);
PROVIDE(_edata = .);
} > ram AT > flash
.bss :
{
. = ALIGN(4);
PROVIDE(_bss_start = .);
*(.bss)
. = ALIGN(4);
*(.bss.*)
. = ALIGN(4);
*(COMMON)
. = ALIGN(4);
PROVIDE(_bss_end = .);
} > ram
}
PROVIDE(end = .);
_end = .;
__heap_base__ = _end;
__heap_end__ = __ram_end__;
@@ -1,85 +0,0 @@
/*
ChibiOS - Copyright (C) 2006..2015 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
{
flash : org = 0x08000000, len = 1M
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 */
ccmram : org = 0x10000000, len = 64k /* CCM SRAM */
ram5 : org = 0x40024000, len = 4k /* BCKP SRAM */
ram6 : org = 0x00000000, len = 0
ram7 : org = 0x00000000, len = 0
}
/* 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);
/* 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);
__ccmram_start__ = ORIGIN(ccmram);
__ccmram_size__ = LENGTH(ccmram);
__ccmram_end__ = __ccmram_start__ + __ccmram_size__;
SECTIONS
{
.ccmram_init : ALIGN(4)
{
. = ALIGN(4);
__ccmram_init_text__ = LOADADDR(.ccmram_init);
__ccmram_init__ = .;
*(.ccmram_init)
*(.ccmram_init.*)
. = ALIGN(4);
} > ccmram AT > flash
.ccmram (NOLOAD) : ALIGN(4)
{
. = ALIGN(4);
__ccmram_clear__ = .;
*(.ccmram_clear)
*(.ccmram_clear.*)
. = ALIGN(4);
__ccmram_noinit__ = .;
*(.ccmram)
*(.ccmram.*)
. = ALIGN(4);
__ccmram_free__ = .;
} > ccmram
}
INCLUDE rules.ld