It now runs inside an RTOS task! Still a lot to do, but it's a good start!

This commit is contained in:
bsongis
2012-06-12 18:29:56 +00:00
parent 8dee4218f7
commit 06b5a2903d
7 changed files with 90 additions and 69 deletions
+8 -17
View File
@@ -192,6 +192,7 @@ FORMAT = ihex
TARGET = open9x
# List C++ source files here. (C dependencies are automatically generated.)
SRC =
CPPSRC = open9x.cpp $(PULSESSRC) stamp.cpp menus.cpp model_menus.cpp general_menus.cpp main_views.cpp statistics_views.cpp $(EEPROMSRC) lcd.cpp drivers.cpp translations.cpp
ifeq ($(EXT), JETI)
@@ -324,7 +325,8 @@ ifeq ($(PCB), ARM)
CPPDEFS += -DPCBARM -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM
EXTRAINCDIRS += ersky9x CoOS/kernel CoOS/portable
BOARDSRC = board_ersky9x.cpp
EXTRABOARDSRC = ersky9x/core_cm3.c ersky9x/board_lowlevel.c ersky9x/crt.c ersky9x/vectors_sam3s.c
SRC += ersky9x/core_cm3.c ersky9x/board_lowlevel.c ersky9x/crt.c ersky9x/vectors_sam3s.c
SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c
CPPSRC += ersky9x/ff.cpp ersky9x/diskio.cpp ersky9x/gtime.cpp
EEPROMSRC = eeprom_arm.cpp
PULSESSRC = pulses_arm.cpp
@@ -674,25 +676,14 @@ remallsrc:
# Link: create ELF output file from object files.
ifeq ($(PCB), ARM)
%.elf: allsrc.cpp
%.o: %.c
$(CC) $(ALL_CPPFLAGS) $< -o $@
OBJS = $(SRC:.c=.o)
%.elf: allsrc.cpp $(OBJS)
@echo
@echo $(MSG_COMPILING) $@
$(CC) $(ALL_CPPFLAGS) CoOS/kernel/core.c -o core.o
$(CC) $(ALL_CPPFLAGS) CoOS/kernel/hook.c -o hook.o
$(CC) $(ALL_CPPFLAGS) CoOS/kernel/task.c -o task.o
#$(CC) $(ALL_CPPFLAGS) CoOS/kernel/mutex.c -o mutex.o
#$(CC) $(ALL_CPPFLAGS) CoOS/kernel/sem.c -o sem.o
#$(CC) $(ALL_CPPFLAGS) CoOS/kernel/queue.c -o queue.o
#$(CC) $(ALL_CPPFLAGS) CoOS/kernel/mbox.c -o mbox.o
#$(CC) $(ALL_CPPFLAGS) CoOS/kernel/flag.c -o flag.o
$(CC) $(ALL_CPPFLAGS) CoOS/kernel/event.c -o event.o
$(CC) $(ALL_CPPFLAGS) CoOS/kernel/time.c -o time.o
$(CC) $(ALL_CPPFLAGS) CoOS/kernel/timer.c -o timer.o
$(CC) $(ALL_CPPFLAGS) CoOS/kernel/serviceReq.c -o serviceReq.o
$(CC) $(ALL_CPPFLAGS) CoOS/portable/GCC/port.c -o port.o
$(CC) $(ALL_CPPFLAGS) CoOS/portable/arch.c -o arch.o
$(CC) $(ALL_CPPFLAGS) $< -o allsrc.o
$(CC) allsrc.o core.o hook.o task.o event.o time.o timer.o serviceReq.o port.o arch.o -mcpu=cortex-m3 -mthumb -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch -o $@
$(CC) allsrc.o $(OBJS) -mcpu=cortex-m3 -mthumb -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch -o $@
else
%.elf: allsrc.cpp
@echo
+1 -6
View File
@@ -34,12 +34,7 @@
#ifndef board_ersky9x_h
#define board_ersky9x_h
#ifdef REVA
#include "ersky9x/AT91SAM3S2.h"
#else
#include "ersky9x/AT91SAM3S4.h"
#endif
#include "ersky9x/board.h"
#include "ersky9x/sound_driver.h"
#include "ersky9x/haptic_driver.h"
#include "ersky9x/sdcard_driver.h"
+48
View File
@@ -0,0 +1,48 @@
/*
* Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny <shadow@privy.de>
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* open9x is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program 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.
*
*/
#ifndef board_h
#define board_h
#include <stdint.h>
#include <stdbool.h>
#ifdef REVA
#include "AT91SAM3S2.h"
#else
#include "chip.h"
#include "AT91SAM3S4.h"
#endif
#endif
+1 -1
View File
@@ -39,7 +39,7 @@
* Headers
*----------------------------------------------------------------------------*/
//#include "board.h"
#include "board.h"
/*----------------------------------------------------------------------------
* Local definitions
+30 -34
View File
@@ -1,30 +1,34 @@
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2008, Atmel Corporation
/*
* Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny <shadow@privy.de>
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* All rights reserved.
* open9x is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* This program 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.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ----------------------------------------------------------------------------
*/
//------------------------------------------------------------------------------
@@ -39,16 +43,8 @@
/// -# For misc, see "AT91SAM3S4 - Misc".
//------------------------------------------------------------------------------
#ifndef CHIP_H
#define CHIP_H
//------------------------------------------------------------------------------
// Headers
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Definitions
//------------------------------------------------------------------------------
#ifndef chip_h
#define chip_h
//------------------------------------------------------------------------------
/// \page "AT91SAM3S4 - ARM core features"
@@ -126,5 +122,5 @@
//Misc
#endif //#ifndef CHIP_H
#endif //#ifndef chip_h
+2 -3
View File
@@ -51,9 +51,8 @@ void BusFault_Handler (void) __attribute__((weak));
void UsageFault_Handler (void) __attribute__((weak));
void SVC_Handler (void) __attribute__((weak));
void DebugMon_Handler (void) __attribute__((weak));
extern void PendSV_Handler (void) __attribute__((weak));
extern void SysTick_Handler (void) __attribute__((weak));
void PendSV_Handler(void) __attribute__((weak));
void SysTick_Handler (void) __attribute__((weak));
void SUPC_IRQHandler (void) __attribute__((weak));
void RSTC_IRQHandler (void) __attribute__((weak));
void RTC_IRQHandler (void) __attribute__((weak));
-8
View File
@@ -2661,7 +2661,6 @@ OS_STK uartprintf_stk[1024];
extern "C" {
void vMainTask(void *) {
alert("START", "START");
while(1) {
#if defined(PCBARM)
@@ -2858,16 +2857,9 @@ int main(void)
uint8_t shutdown_state = 0;
#endif
if ((shutdown_state=check_soft_power()) <= e_power_trainer) {
alert("COOS", "START");
CoInitOS();
alert("COOS", "INIT");
//xTaskHandle taskHandle;
//xTaskCreate ((pdTASK_CODE)&vMainTask, (const signed portCHAR * const) "Main", 2048, NULL, (tskIDLE_PRIORITY + 1), &taskHandle);
//vTaskStartScheduler ();
uartprintfTask = CoCreateTask(vMainTask,NULL,0,&uartprintf_stk[1023],100);
alert("COOS", "TASK");
CoStartOS();
alert("COOS", "FIN");
}
#if defined(PCBARM) || defined(PCBV4)