From 70568ab1ebb07bdeb3d06933b0af1bddbed05413 Mon Sep 17 00:00:00 2001 From: AceVest Date: Fri, 27 Jul 2018 13:35:22 +0800 Subject: [PATCH] ... --- .gitignore | 1 + arduino/hardware/README.md | 2 + .../hardware/ace/avr/cores/avr/PluggableUSB.h | 74 ------------------- arduino/hardware/ace/avr/cores/avr/kernel.cpp | 2 - arduino/hardware/ace/avr/cores/avr/kernel.h | 1 + arduino/hardware/ace/avr/cores/avr/timer.cpp | 2 - learn/doc/mac_bash_profile | 1 + rtos/CMakeLists.txt | 21 ++++++ rtos/components/CMakeLists.txt | 2 + rtos/components/debug/CMakeLists.txt | 6 ++ rtos/components/debug/asm_debug.S | 7 ++ rtos/components/debug/debug.c | 1 + rtos/components/debug/debug.h | 14 ++++ rtos/components/debug/entry.S | 3 - rtos/rtos.c | 18 +++++ rtos/rtos_config.h.in | 4 + 16 files changed, 78 insertions(+), 81 deletions(-) delete mode 100644 arduino/hardware/ace/avr/cores/avr/PluggableUSB.h create mode 100644 rtos/CMakeLists.txt create mode 100644 rtos/components/CMakeLists.txt create mode 100644 rtos/components/debug/CMakeLists.txt create mode 100644 rtos/components/debug/asm_debug.S create mode 100644 rtos/components/debug/debug.h delete mode 100644 rtos/components/debug/entry.S create mode 100644 rtos/rtos.c create mode 100644 rtos/rtos_config.h.in diff --git a/.gitignore b/.gitignore index 157739f..dafd856 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ ish *.diff *.d dvwa +build diff --git a/arduino/hardware/README.md b/arduino/hardware/README.md index 8a7f25d..b7e01ad 100644 --- a/arduino/hardware/README.md +++ b/arduino/hardware/README.md @@ -1 +1,3 @@ https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification +https://www.microchip.com/webdoc/AVRLibcReferenceManual/indexpage.html + diff --git a/arduino/hardware/ace/avr/cores/avr/PluggableUSB.h b/arduino/hardware/ace/avr/cores/avr/PluggableUSB.h deleted file mode 100644 index 507f0df..0000000 --- a/arduino/hardware/ace/avr/cores/avr/PluggableUSB.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - PluggableUSB.h - Copyright (c) 2015 Arduino LLC - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef PUSB_h -#define PUSB_h - -#include "USBAPI.h" -#include - -#if defined(USBCON) - -class PluggableUSBModule { -public: - PluggableUSBModule(uint8_t numEps, uint8_t numIfs, uint8_t *epType) : - numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType) - { } - -protected: - virtual bool setup(USBSetup& setup) = 0; - virtual int getInterface(uint8_t* interfaceCount) = 0; - virtual int getDescriptor(USBSetup& setup) = 0; - virtual uint8_t getShortName(char *name) { name[0] = 'A'+pluggedInterface; return 1; } - - uint8_t pluggedInterface; - uint8_t pluggedEndpoint; - - const uint8_t numEndpoints; - const uint8_t numInterfaces; - const uint8_t *endpointType; - - PluggableUSBModule *next = NULL; - - friend class PluggableUSB_; -}; - -class PluggableUSB_ { -public: - PluggableUSB_(); - bool plug(PluggableUSBModule *node); - int getInterface(uint8_t* interfaceCount); - int getDescriptor(USBSetup& setup); - bool setup(USBSetup& setup); - void getShortName(char *iSerialNum); - -private: - uint8_t lastIf; - uint8_t lastEp; - PluggableUSBModule* rootNode; -}; - -// Replacement for global singleton. -// This function prevents static-initialization-order-fiasco -// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use -PluggableUSB_& PluggableUSB(); - -#endif - -#endif diff --git a/arduino/hardware/ace/avr/cores/avr/kernel.cpp b/arduino/hardware/ace/avr/cores/avr/kernel.cpp index 0874436..eaa37d8 100644 --- a/arduino/hardware/ace/avr/cores/avr/kernel.cpp +++ b/arduino/hardware/ace/avr/cores/avr/kernel.cpp @@ -148,7 +148,6 @@ void yield(void) extern "C" void TIMER1_COMPA_vect() __attribute__ ((signal,used, externally_visible)); void TIMER1_COMPA_vect() { - SAVE_CONTEXT; ticks++; for(uint8_t i=0; i +#include "rtos_config.h" +#include "debug.h" + +int main(int argc, char *argv[]){ + printf("rtos: version %u.%u\n", RTOS_VERSION_MAJOR, RTOS_VERSION_MINOR); + debug(); + asm_debug(); + return 0; +} diff --git a/rtos/rtos_config.h.in b/rtos/rtos_config.h.in new file mode 100644 index 0000000..4187a01 --- /dev/null +++ b/rtos/rtos_config.h.in @@ -0,0 +1,4 @@ +#pragma once + +#define RTOS_VERSION_MAJOR @RTOS_VERSION_MAJOR@ +#define RTOS_VERSION_MINOR @RTOS_VERSION_MINOR@ -- 2.44.0