1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

PiOS.posix: porting some of the recent updates to PiOS.posix - compiles now

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2449 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
corvus 2011-01-16 15:17:57 +00:00 committed by corvus
parent 6c3b887ae4
commit 115a581d7c
7 changed files with 131 additions and 68 deletions

View File

@ -68,11 +68,12 @@ MODULES = Telemetry Actuator Stabilization Guidance ManualControl
MCU = i686 MCU = i686
#CHIP = STM32F103RET #CHIP = STM32F103RET
#BOARD = STM3210E_OP #BOARD = STM3210E_OP
MODEL = HD
ifeq ($(USE_BOOTLOADER), YES) ifeq ($(USE_BOOTLOADER), YES)
MODEL = HD_BL BOOT_MODEL = $(MODEL)_BL
else else
MODEL = HD_NB BOOT_MODEL = $(MODEL)_NB
endif endif
# Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.) # Directory for output files (lst, obj, dep, elf, sym, map, hex, bin etc.)
@ -84,12 +85,14 @@ TARGET = OpenPilot
# Paths # Paths
OPSYSTEM = ./System OPSYSTEM = ./System
OPSYSTEMINC = $(OPSYSTEM)/inc OPSYSTEMINC = $(OPSYSTEM)/inc
OPUAVTALK = ./UAVTalk OPUAVTALK = ../UAVTalk
OPUAVTALKINC = $(OPUAVTALK)/inc OPUAVTALKINC = $(OPUAVTALK)/inc
OPUAVOBJ = ./UAVObjects OPUAVOBJ = ../UAVObjects
OPUAVOBJINC = $(OPUAVOBJ)/inc OPUAVOBJINC = $(OPUAVOBJ)/inc
OPTESTS = ./Tests OPTESTS = ./Tests
OPMODULEDIR = ./Modules OPMODULEDIR = ../Modules
FLIGHTLIB = ../Libraries
FLIGHTLIBINC = $(FLIGHTLIB)/inc
PIOS = ../PiOS.posix PIOS = ../PiOS.posix
PIOSINC = $(PIOS)/inc PIOSINC = $(PIOS)/inc
PIOSPOSIX = $(PIOS)/posix PIOSPOSIX = $(PIOS)/posix
@ -98,6 +101,18 @@ RTOSDIR = $(APPLIBDIR)/FreeRTOS
RTOSSRCDIR = $(RTOSDIR)/Source RTOSSRCDIR = $(RTOSDIR)/Source
RTOSINCDIR = $(RTOSSRCDIR)/include RTOSINCDIR = $(RTOSSRCDIR)/include
DOXYGENDIR = ../Doc/Doxygen DOXYGENDIR = ../Doc/Doxygen
AHRSBOOTLOADER = ../Bootloaders/AHRS/
AHRSBOOTLOADERINC = $(AHRSBOOTLOADER)/inc
PYMITE = $(FLIGHTLIB)/PyMite
PYMITELIB = $(PYMITE)/lib
PYMITEPLAT = $(PYMITE)/platform/openpilot
PYMITETOOLS = $(PYMITE)/tools
PYMITEVM = $(PYMITE)/vm
PYMITEINC = $(PYMITEVM)
PYMITEINC += $(PYMITEPLAT)
PYMITEINC += $(OUTDIR)
FLIGHTPLANLIB = $(OPMODULEDIR)/FlightPlan/lib
FLIGHTPLANS = $(OPMODULEDIR)/FlightPlan/flightplans
# List C source files here. (C dependencies are automatically generated.) # List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files # use file-extension c for "c-only"-files
@ -113,6 +128,7 @@ SRC += ${OPMODULEDIR}/System/systemmod.c
SRC += $(OPSYSTEM)/openpilot.c SRC += $(OPSYSTEM)/openpilot.c
SRC += $(OPSYSTEM)/pios_board_posix.c SRC += $(OPSYSTEM)/pios_board_posix.c
SRC += $(OPSYSTEM)/alarms.c SRC += $(OPSYSTEM)/alarms.c
SRC += $(OPSYSTEM)/taskmonitor.c
SRC += $(OPUAVTALK)/uavtalk.c SRC += $(OPUAVTALK)/uavtalk.c
SRC += $(OPUAVOBJ)/uavobjectmanager.c SRC += $(OPUAVOBJ)/uavobjectmanager.c
SRC += $(OPUAVOBJ)/uavobjectsinit.c SRC += $(OPUAVOBJ)/uavobjectsinit.c
@ -170,6 +186,7 @@ SRC += $(OPUAVOBJ)/flightplanstatus.c
SRC += $(OPUAVOBJ)/flightplansettings.c SRC += $(OPUAVOBJ)/flightplansettings.c
SRC += $(OPUAVOBJ)/taskinfo.c SRC += $(OPUAVOBJ)/taskinfo.c
SRC += $(OPUAVOBJ)/watchdogstatus.c SRC += $(OPUAVOBJ)/watchdogstatus.c
SRC += $(OPUAVOBJ)/nedaccel.c
endif endif
## PIOS Hardware (posix) ## PIOS Hardware (posix)
@ -180,7 +197,12 @@ SRC += $(PIOSPOSIX)/pios_sdcard.c
SRC += $(PIOSPOSIX)/pios_udp.c SRC += $(PIOSPOSIX)/pios_udp.c
SRC += $(PIOSPOSIX)/pios_com.c SRC += $(PIOSPOSIX)/pios_com.c
SRC += $(PIOSPOSIX)/pios_servo.c SRC += $(PIOSPOSIX)/pios_servo.c
# SRC += $(PIOSPOSIX)/pios_wdg.c
## Libraries for flight calculations
#SRC += $(FLIGHTLIB)/fifo_buffer.c
SRC += $(FLIGHTLIB)/WorldMagModel.c
SRC += $(FLIGHTLIB)/CoordinateConversions.c
## RTOS ## RTOS
SRC += $(RTOSSRCDIR)/list.c SRC += $(RTOSSRCDIR)/list.c
SRC += $(RTOSSRCDIR)/queue.c SRC += $(RTOSSRCDIR)/queue.c
@ -191,6 +213,14 @@ SRC += $(RTOSSRCDIR)/portable/GCC/Posix/port.c
SRC += $(RTOSSRCDIR)/portable/MemMang/heap_3.c SRC += $(RTOSSRCDIR)/portable/MemMang/heap_3.c
## PyMite files
#SRC += $(wildcard ${PYMITEVM}/*.c)
#SRC += $(wildcard ${PYMITEPLAT}/*.c)
#SRC += $(OUTDIR)/pmlib_img.c
#SRC += $(OUTDIR)/pmlib_nat.c
#SRC += $(OUTDIR)/pmlibusr_img.c
#SRC += $(OUTDIR)/pmlibusr_nat.c
# List C source files here which must be compiled in ARM-Mode (no -mthumb). # List C source files here which must be compiled in ARM-Mode (no -mthumb).
# use file-extension c for "c-only"-files # use file-extension c for "c-only"-files
@ -217,13 +247,13 @@ EXTRAINCDIRS += $(OPUAVOBJ)
EXTRAINCDIRS += $(OPUAVOBJINC) EXTRAINCDIRS += $(OPUAVOBJINC)
EXTRAINCDIRS += $(PIOS) EXTRAINCDIRS += $(PIOS)
EXTRAINCDIRS += $(PIOSINC) EXTRAINCDIRS += $(PIOSINC)
EXTRAINCDIRS += $(FLIGHTLIBINC)
EXTRAINCDIRS += $(PIOSPOSIX) EXTRAINCDIRS += $(PIOSPOSIX)
EXTRAINCDIRS += $(MININIDIR)
EXTRAINCDIRS += $(RTOSINCDIR) EXTRAINCDIRS += $(RTOSINCDIR)
EXTRAINCDIRS += $(APPLIBDIR) EXTRAINCDIRS += $(APPLIBDIR)
EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/Posix EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/Posix
EXTRAINCDIRS += ${foreach MOD, ${MODULES}, Modules/${MOD}/inc} ${OPMODULEDIR}/System/inc EXTRAINCDIRS += ${foreach MOD, ${MODULES}, $(OPMODULEDIR)/${MOD}/inc} ${OPMODULEDIR}/System/inc
# List any extra directories to look for library files here. # List any extra directories to look for library files here.
@ -354,6 +384,7 @@ OBJDUMP = $(TCHAIN_PREFIX)objdump
SIZE = $(TCHAIN_PREFIX)size SIZE = $(TCHAIN_PREFIX)size
NM = $(TCHAIN_PREFIX)nm NM = $(TCHAIN_PREFIX)nm
REMOVE = $(REMOVE_CMD) -f REMOVE = $(REMOVE_CMD) -f
PYTHON = python
###SHELL = sh ###SHELL = sh
###COPY = cp ###COPY = cp
@ -381,6 +412,7 @@ MSG_CLEANING = ${quote}Cleaning project:${quote}
MSG_FORMATERROR = ${quote}Can not handle output-format${quote} MSG_FORMATERROR = ${quote}Can not handle output-format${quote}
MSG_ASMFROMC = ${quote}Creating asm-File from C-Source:${quote} MSG_ASMFROMC = ${quote}Creating asm-File from C-Source:${quote}
MSG_ASMFROMC_ARM = ${quote}Creating asm-File from C-Source (ARM-only):${quote} MSG_ASMFROMC_ARM = ${quote}Creating asm-File from C-Source (ARM-only):${quote}
MSG_PYMITEINIT = ${quote}**** Generating PyMite intermediate code${quote}
# List of all source files. # List of all source files.
ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC)
@ -403,7 +435,7 @@ bin: $(OUTDIR)/$(TARGET).bin
# Default target. # Default target.
#all: begin gccversion sizebefore build sizeafter finished end #all: begin gccversion sizebefore build sizeafter finished end
#all: begin gccversion build sizeafter finished end #all: begin gencode gccversion build sizeafter finished end
all: elf all: elf
ifeq ($(LOADFORMAT),ihex) ifeq ($(LOADFORMAT),ihex)
@ -428,6 +460,10 @@ else
quote = quote =
endif endif
# Generate intermediate code
gencode: ${OUTDIR}/InitMods.c #$(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h
# Generate code for module initialization
${OUTDIR}/InitMods.c: Makefile.posix ${OUTDIR}/InitMods.c: Makefile.posix
@echo ${MSG_MODINIT} @echo ${MSG_MODINIT}
@echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c @echo ${quote}// Autogenerated file${quote} > ${OUTDIR}/InitMods.c
@ -436,6 +472,13 @@ ${OUTDIR}/InitMods.c: Makefile.posix
@echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c
@echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c
# Generate code for PyMite
#$(OUTDIR)/pmlib_img.c $(OUTDIR)/pmlib_nat.c $(OUTDIR)/pmlibusr_img.c $(OUTDIR)/pmlibusr_nat.c $(OUTDIR)/pmfeatures.h: $(wildcard $(PYMITELIB)/*.py) $(wildcard $(PYMITEPLAT)/*.py) $(wildcard $(FLIGHTPLANLIB)/*.py) $(wildcard $(FLIGHTPLANS)/*.py)
# @echo ${MSG_PYMITEINIT}
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py)
# @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h
# @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py
# Eye candy. # Eye candy.
begin: begin:
## @echo ## @echo
@ -465,12 +508,19 @@ gccversion :
# @echo $(ALLOBJ) # @echo $(ALLOBJ)
# Program the device. # Program the device.
ifeq ($(USE_BOOTLOADER), YES)
# Program the device with OP Upload Tool".
program: $(OUTDIR)/$(TARGET).bin
@echo ${quote}Programming with OP Upload Tool${quote}
../../ground/src/experimental/upload-build-desktop/debug/OPUploadTool -d 0 -p $(OUTDIR)/$(TARGET).bin
else
ifeq ($(FLASH_TOOL),OPENOCD) ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". # Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script".
program: $(OUTDIR)/$(TARGET).elf program: $(OUTDIR)/$(TARGET).elf
@echo ${quote}Programming with OPENOCD${quote} @echo ${quote}Programming with OPENOCD${quote}
$(OOCD_EXE) $(OOCD_CL) $(OOCD_EXE) $(OOCD_CL)
endif endif
endif
# Create final output file (.hex) from ELF output file. # Create final output file (.hex) from ELF output file.
%.hex: %.elf %.hex: %.elf
@ -591,6 +641,8 @@ clean_list :
$(REMOVE) $(OUTDIR)/$(TARGET).bin $(REMOVE) $(OUTDIR)/$(TARGET).bin
$(REMOVE) $(OUTDIR)/$(TARGET).sym $(REMOVE) $(OUTDIR)/$(TARGET).sym
$(REMOVE) $(OUTDIR)/$(TARGET).lss $(REMOVE) $(OUTDIR)/$(TARGET).lss
$(REMOVE) $(wildcard $(OUTDIR)/*.c)
$(REMOVE) $(wildcard $(OUTDIR)/*.h)
$(REMOVE) $(ALLOBJ) $(REMOVE) $(ALLOBJ)
$(REMOVE) $(LSTFILES) $(REMOVE) $(LSTFILES)
$(REMOVE) $(DEPFILES) $(REMOVE) $(DEPFILES)
@ -619,5 +671,5 @@ endif
# Listing of phony targets. # Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \ .PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex bin lss sym clean clean_list program build elf hex bin lss sym clean clean_list program gencode

View File

@ -28,6 +28,13 @@
#include <stdint.h> #include <stdint.h>
typedef enum {FALSE = 0, TRUE = !FALSE} bool;
#ifndef false
#define false FALSE
#define true TRUE
#endif
#define FILEINFO FILE* #define FILEINFO FILE*
#define PIOS_SERVO_NUM_OUTPUTS 8 #define PIOS_SERVO_NUM_OUTPUTS 8

View File

@ -99,7 +99,7 @@ extern int32_t PIOS_SDCARD_CIDRead(SDCARDCidTypeDef *cid);
extern int32_t PIOS_SDCARD_CSDRead(SDCARDCsdTypeDef *csd); extern int32_t PIOS_SDCARD_CSDRead(SDCARDCsdTypeDef *csd);
extern int32_t PIOS_SDCARD_StartupLog(void); extern int32_t PIOS_SDCARD_StartupLog(void);
extern int32_t POIS_SDCARD_IsMounted(); extern int32_t PIOS_SDCARD_IsMounted();
extern int32_t PIOS_SDCARD_MountFS(uint32_t StartupLog); extern int32_t PIOS_SDCARD_MountFS(uint32_t StartupLog);
extern int32_t PIOS_SDCARD_GetFree(void); extern int32_t PIOS_SDCARD_GetFree(void);

View File

@ -38,4 +38,8 @@ uint16_t PIOS_WDG_GetBootupFlags();
uint16_t PIOS_WDG_GetActiveFlags(); uint16_t PIOS_WDG_GetActiveFlags();
void PIOS_WDG_Clear(void); void PIOS_WDG_Clear(void);
#define PIOS_WDG_ACTUATOR 0x0001
#define PIOS_WDG_STABILIZATION 0x0002
#define PIOS_WDG_MANUAL 0x0008
#endif #endif

View File

@ -221,7 +221,7 @@ int32_t PIOS_SDCARD_StartupLog(void)
* @return 0 if no * @return 0 if no
* @return 1 if yes * @return 1 if yes
*/ */
int32_t POIS_SDCARD_IsMounted() int32_t PIOS_SDCARD_IsMounted()
{ {
return 1; return 1;
} }

View File

@ -63,7 +63,7 @@ void PIOS_Servo_Set(uint8_t Servo, uint16_t Position)
{ {
#ifndef PIOS_ENABLE_DEBUG_PINS #ifndef PIOS_ENABLE_DEBUG_PINS
/* Make sure servo exists */ /* Make sure servo exists */
if (Servo < PIOS_SERVO_NUM_OUTPUTS && Servo >= 0) { if (Servo < PIOS_SERVO_NUM_OUTPUTS) {
/* Update the position */ /* Update the position */
ServoPosition[Servo] = Position; ServoPosition[Servo] = Position;