aboutsummaryrefslogtreecommitdiff
path: root/puzzle
diff options
context:
space:
mode:
Diffstat (limited to 'puzzle')
-rw-r--r--puzzle/dummy/CMakeLists.txt13
-rw-r--r--puzzle/dummy/FreeRTOSConfig.h52
-rw-r--r--puzzle/dummy/main.cpp35
-rw-r--r--puzzle/dummy/mod.c6
4 files changed, 72 insertions, 34 deletions
diff --git a/puzzle/dummy/CMakeLists.txt b/puzzle/dummy/CMakeLists.txt
index c485e74..6acc4c8 100644
--- a/puzzle/dummy/CMakeLists.txt
+++ b/puzzle/dummy/CMakeLists.txt
@@ -7,10 +7,19 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# enable debug features
set(CMAKE_BUILD_TYPE Debug)
add_compile_definitions(DEBUG)
+# add_compile_options(-O0) # no optimizations
# arduino
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/lib/Arduino-CMake-Toolchain/Arduino-toolchain.cmake)
-set(ARDUINO_BOARD "Arduino Uno [avr.uno]")
+# set(ARDUINO_BOARD "Arduino Uno [avr.uno]")
+set(ARDUINO_BOARD "Arduino Mega or Mega 2560 [avr.mega]")
+
+# freertos
+add_library(freertos_config INTERFACE)
+target_include_directories(freertos_config SYSTEM INTERFACE .)
+# set(FREERTOS_PORT GCC_ATMEGA) # Arduino Uno
+set(FREERTOS_PORT GCC_ATMEGA) # Arduino Uno
+set(FREERTOS_HEAP 4)
# used for testing
# set(ARDUINO_BOARD "Raspberry Pi Pico W [rp2040.rpipicow]")
@@ -20,9 +29,11 @@ set(ARDUINO_BOARD "Arduino Uno [avr.uno]")
project(pb_mod_dummy C CXX)
add_subdirectory(lib/pbdrv)
+add_subdirectory(lib/FreeRTOS-Kernel)
add_executable(main
main.cpp
+ mod.c
)
target_link_libraries(main
diff --git a/puzzle/dummy/FreeRTOSConfig.h b/puzzle/dummy/FreeRTOSConfig.h
new file mode 100644
index 0000000..1cfdd71
--- /dev/null
+++ b/puzzle/dummy/FreeRTOSConfig.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#define configUSE_PREEMPTION 1
+#define configUSE_IDLE_HOOK 0
+#define configUSE_TICK_HOOK 0
+#define configMAX_PRIORITIES 32
+#define configMINIMAL_STACK_SIZE ((configSTACK_DEPTH_TYPE) 192)
+#define configUSE_16_BIT_TICKS 1
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_MUTEXES 1
+#define configUSE_RECURSIVE_MUTEXES 1
+#define configUSE_APPLICATION_TASK_TAG 0
+#define configUSE_COUNTING_SEMAPHORES 1
+#define configQUEUE_REGISTRY_SIZE 8
+#define configUSE_QUEUE_SETS 0
+#define configUSE_TIME_SLICING 1
+#define configSTACK_DEPTH_TYPE uint16_t
+#define configSUPPORT_STATIC_ALLOCATION 0
+#define configSUPPORT_DYNAMIC_ALLOCATION 1
+// #define configTOTAL_HEAP_SIZE (1024)
+#define configTOTAL_HEAP_SIZE (7 * 1024)
+#define configCHECK_FOR_STACK_OVERFLOW 0
+#define configUSE_MALLOC_FAILED_HOOK 0
+#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
+#define configGENERATE_RUN_TIME_STATS 0
+#define configUSE_TRACE_FACILITY 0
+#define configUSE_STATS_FORMATTING_FUNCTIONS 0
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1)
+#define configTIMER_QUEUE_LENGTH 10
+#define configTIMER_TASK_STACK_DEPTH 92
+
+#include <assert.h>
+#define configASSERT(x) assert(x)
+
+#define INCLUDE_vTaskPrioritySet 1
+#define INCLUDE_uxTaskPriorityGet 1
+#define INCLUDE_vTaskDelete 1
+#define INCLUDE_vTaskSuspend 1
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_xTaskGetSchedulerState 1
+#define INCLUDE_xTaskGetCurrentTaskHandle 1
+#define INCLUDE_uxTaskGetStackHighWaterMark 1
+#define INCLUDE_xTaskGetIdleTaskHandle 1
+#define INCLUDE_eTaskGetState 1
+#define INCLUDE_xTimerPendFunctionCall 1
+#define INCLUDE_xTaskAbortDelay 1
+#define INCLUDE_xTaskGetHandle 1
+#define INCLUDE_xTaskResumeFromISR 1
+#define INCLUDE_xQueueGetMutexHolder 1
+
diff --git a/puzzle/dummy/main.cpp b/puzzle/dummy/main.cpp
index 3d84679..d611014 100644
--- a/puzzle/dummy/main.cpp
+++ b/puzzle/dummy/main.cpp
@@ -1,36 +1,5 @@
#include <Arduino.h>
-#include <Wire.h>
-#include "drv/arduino/mod.h"
-#include "pb-mod.h"
-
-#ifdef TEST_A
-#define ADDR_RX 0x69
-#define ADDR_TX 0x20
-#define MSG "aa"
-#define MSG_SIZE 3
-#define MSG_DELAY 10
-#endif
-
-#ifdef TEST_B
-#define ADDR_TX 0x69
-#define ADDR_RX 0x20
-#define MSG "bbbbbbbb"
-#define MSG_SIZE 9
-#define MSG_DELAY 10
-#endif
-
-const char * PBDRV_MOD_NAME = "dummy";
-const i2c_addr_t PBDRV_MOD_ADDR = ADDR_RX;
-
-void setup() {
- pbdrv_setup();
-}
-
-void loop() {
- pbdrv_i2c_send(ADDR_TX, (uint8_t *) MSG, MSG_SIZE);
- delay(MSG_DELAY);
-}
-
-void pbdrv_i2c_recv(const uint8_t * data, size_t size) { }
+void setup() { }
+void loop() { }
diff --git a/puzzle/dummy/mod.c b/puzzle/dummy/mod.c
new file mode 100644
index 0000000..058a585
--- /dev/null
+++ b/puzzle/dummy/mod.c
@@ -0,0 +1,6 @@
+#include "pb.h"
+#include "pb-mod.h"
+
+const char * PB_MOD_NAME = "dummy";
+const i2c_addr_t PB_MOD_ADDR = PB_ADDR_MOD_DUMMY;
+