]> Zhao Yanbai Git Server - acecode.git/commitdiff
...
authorAceVest <zhaoyanbai@126.com>
Fri, 27 Jul 2018 05:35:22 +0000 (13:35 +0800)
committerAceVest <zhaoyanbai@126.com>
Fri, 27 Jul 2018 05:35:22 +0000 (13:35 +0800)
16 files changed:
.gitignore
arduino/hardware/README.md
arduino/hardware/ace/avr/cores/avr/PluggableUSB.h [deleted file]
arduino/hardware/ace/avr/cores/avr/kernel.cpp
arduino/hardware/ace/avr/cores/avr/kernel.h
arduino/hardware/ace/avr/cores/avr/timer.cpp
learn/doc/mac_bash_profile
rtos/CMakeLists.txt [new file with mode: 0644]
rtos/components/CMakeLists.txt [new file with mode: 0644]
rtos/components/debug/CMakeLists.txt [new file with mode: 0644]
rtos/components/debug/asm_debug.S [new file with mode: 0644]
rtos/components/debug/debug.c
rtos/components/debug/debug.h [new file with mode: 0644]
rtos/components/debug/entry.S [deleted file]
rtos/rtos.c [new file with mode: 0644]
rtos/rtos_config.h.in [new file with mode: 0644]

index 157739fcaa047efe2cc2f28d833f9dc8d2bdf0b1..dafd856954bad2b58a5ba6a47d659223a2c2aaa6 100644 (file)
@@ -10,3 +10,4 @@ ish
 *.diff
 *.d
 dvwa
+build
index 8a7f25daa3f5ba569f17efa7cb5397017af15237..b7e01ade2ea88a0d4cb522d42fcfc10e54319f3f 100644 (file)
@@ -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 (file)
index 507f0df..0000000
+++ /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 <stdint.h>
-
-#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
index 08744363df96c168bb84961e1a9a542343abe9b9..eaa37d8cced94195ea383b12abaee8a5d6f8146f 100644 (file)
@@ -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<task_cnt; i++) {
@@ -167,7 +166,6 @@ void TIMER1_COMPA_vect()
     }
 
     task_scheduler();
-    RESTORE_CONTEXT;
 }
 
 void init_timer1() {
index 3f0fb5037ea6392d472cdd793aaa9cc8c3c138b3..b3e72cfb7b76a782fb0b47e6c1d809a8be46ccd8 100644 (file)
@@ -111,5 +111,6 @@ void task_delay(uint16_t ticks);
     "POP R29\n"    \
     "POP R30\n"    \
     "POP R31\n"    \
+    "reti\n"\
     );
 
index 7ec5d3af4b02fdb8eca8809e0f4512c3d75824d9..b101177c681225b6b01b7ee777cadb0dd864e783 100644 (file)
@@ -75,7 +75,6 @@ void init_timer0() {
 extern "C" void TIMER0_OVF_vect() __attribute__ ((signal,used, externally_visible));
 void TIMER0_OVF_vect()
 {
-    SAVE_CONTEXT;
     unsigned long m = timer0_millis;
     unsigned char f = timer0_fract;
 
@@ -90,7 +89,6 @@ void TIMER0_OVF_vect()
     timer0_millis = m;
 
     timer0_overflow_count++;
-    RESTORE_CONTEXT;
 }
 
 
index 2456f632cfc0cb6a92123c1825dadb023cfb46a7..3b0562a86766f4d73dd385badf09930f5e1a0c54 100644 (file)
@@ -21,3 +21,4 @@ alias grep='grep --color'
 alias egrep='egrep --color'
 alias msf='msfconsole'
 alias cdw='cd ~/workspace/'
+export PATH="/usr/local/opt/ncurses/bin:$PATH"
diff --git a/rtos/CMakeLists.txt b/rtos/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1bdf7ae
--- /dev/null
@@ -0,0 +1,21 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
+
+SET(RTOS_VERSION_MAJOR 0)
+SET(RTOS_VERSION_MINOR 1)
+
+
+PROJECT(rtos)
+
+CONFIGURE_FILE(
+       "${PROJECT_SOURCE_DIR}/rtos_config.h.in"
+       "${PROJECT_BINARY_DIR}/rtos_config.h"
+)
+
+add_subdirectory(components)
+
+include_directories("${PROJECT_BINARY_DIR}"
+                                       "components/debug")
+
+add_executable(rtos rtos.c)
+
+target_link_libraries(rtos components)
diff --git a/rtos/components/CMakeLists.txt b/rtos/components/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2f6b0dd
--- /dev/null
@@ -0,0 +1,2 @@
+AUX_SOURCE_DIRECTORY(debug COMPONENTS_SRCS)
+ADD_LIBRARY(components ${COMPONENTS_SRCS})
diff --git a/rtos/components/debug/CMakeLists.txt b/rtos/components/debug/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1c9d980
--- /dev/null
@@ -0,0 +1,6 @@
+SET(CMAKE_ASM_FLAGS "-c")
+ADD_LIBRARY(debug
+       debug.c
+       asm_debug.S
+)
+
diff --git a/rtos/components/debug/asm_debug.S b/rtos/components/debug/asm_debug.S
new file mode 100644 (file)
index 0000000..db026e7
--- /dev/null
@@ -0,0 +1,7 @@
+.global _asm_debug
+
+_asm_debug:
+    nop
+    nop
+    nop
+    ret
index 90a29197bf6d1e304e57bdd50e1e25243e374a0d..05062d97639c7b0cc308528acfa87f426ebc5490 100644 (file)
@@ -8,5 +8,6 @@
  */
 
 int debug() {
+
     return 0;
 }
diff --git a/rtos/components/debug/debug.h b/rtos/components/debug/debug.h
new file mode 100644 (file)
index 0000000..2abfbdc
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * ------------------------------------------------------------------------
+ *   File Name: debug.h
+ *      Author: Zhao Yanbai
+ *              2018-07-26 15:47:46 Thursday CST
+ * Description: none
+ * ------------------------------------------------------------------------
+ */
+
+#pragma once
+
+void debug();
+
+void asm_debug();
diff --git a/rtos/components/debug/entry.S b/rtos/components/debug/entry.S
deleted file mode 100644 (file)
index 92b4b7d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-.global _start
-_start:
-
diff --git a/rtos/rtos.c b/rtos/rtos.c
new file mode 100644 (file)
index 0000000..189d108
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * ------------------------------------------------------------------------
+ *   File Name: rtos.c
+ *      Author: Zhao Yanbai
+ *              2018-07-26 15:08:13 Thursday CST
+ * Description: none
+ * ------------------------------------------------------------------------
+ */
+#include<stdio.h>
+#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 (file)
index 0000000..4187a01
--- /dev/null
@@ -0,0 +1,4 @@
+#pragma once
+
+#define RTOS_VERSION_MAJOR @RTOS_VERSION_MAJOR@
+#define RTOS_VERSION_MINOR @RTOS_VERSION_MINOR@