├── requirements.txt ├── util ├── dsy_bootloader_v2.bin ├── venv_screenshot.png ├── Makefile ├── vscode │ ├── c_cpp_properties.json │ ├── launch.json │ └── tasks.json ├── template.cpp ├── custom_json_example.json ├── daisy_boards.h ├── default_linker_sdram.lds ├── sram_linker.lds ├── sram_linker_sdram.lds ├── qspi_linker.lds └── qspi_linker_sdram.lds ├── .gitmodules ├── examples ├── gui_projects │ ├── pod │ │ └── pod_example.pd2dsy │ ├── field │ │ └── field_example.pd2dsy │ ├── patch │ │ └── patch_example.pd2dsy │ ├── petal │ │ └── petal_example.pd2dsy │ └── patch_init │ │ └── patch_init_example.pd2dsy └── PdFiles │ ├── petal_test.pd │ ├── patch_init_test.pd │ ├── patch_test.pd │ ├── pod_test.pd │ ├── field_test.pd │ └── saw_test.pd ├── .gitignore ├── install.sh ├── makefile ├── pd2dsy_gui.py ├── pd2dsy.py ├── README.md ├── dsy_gui.py └── LICENSE /requirements.txt: -------------------------------------------------------------------------------- 1 | wheel 2 | es-hvcc-sensors==0.2.1 3 | sv_ttk 4 | darkdetect 5 | pyinstaller -------------------------------------------------------------------------------- /util/dsy_bootloader_v2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/electro-smith/pd2dsy/HEAD/util/dsy_bootloader_v2.bin -------------------------------------------------------------------------------- /util/venv_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/electro-smith/pd2dsy/HEAD/util/venv_screenshot.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libdaisy"] 2 | path = libdaisy 3 | url = https://github.com/electro-smith/libDaisy/ 4 | -------------------------------------------------------------------------------- /examples/gui_projects/pod/pod_example.pd2dsy: -------------------------------------------------------------------------------- 1 | {"w1": "../../PdFiles/pod_test.pd", "w5": ".", "w6": "", "w2": "Pod", "w3": "Speed", "w4": "Speed"} -------------------------------------------------------------------------------- /examples/gui_projects/field/field_example.pd2dsy: -------------------------------------------------------------------------------- 1 | {"w1": "../../PdFiles/field_test.pd", "w5": ".", "w6": "", "w2": "Field", "w3": "Speed", "w4": "Speed"} -------------------------------------------------------------------------------- /examples/gui_projects/patch/patch_example.pd2dsy: -------------------------------------------------------------------------------- 1 | {"w1": "../../PdFiles/patch_test.pd", "w5": ".", "w6": "", "w2": "Patch", "w3": "Speed", "w4": "Speed"} -------------------------------------------------------------------------------- /examples/gui_projects/petal/petal_example.pd2dsy: -------------------------------------------------------------------------------- 1 | {"w1": "../../PdFiles/petal_test.pd", "w5": ".", "w6": "", "w2": "Petal", "w3": "Speed", "w4": "Speed"} -------------------------------------------------------------------------------- /examples/gui_projects/patch_init/patch_init_example.pd2dsy: -------------------------------------------------------------------------------- 1 | {"w1": "../../PdFiles/patch_init_test.pd", "w5": ".", "w6": "", "w2": "Patch init", "w3": "Speed", "w4": "Speed"} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.pyb 3 | __pycache__ 4 | /**/build 5 | /**/VisualGDB 6 | *~ 7 | daisy.json 8 | pd_env 9 | pd2dsy_config.json 10 | dist/ 11 | pd2dsy_build.txt 12 | pd2dsy_gui.spec -------------------------------------------------------------------------------- /util/Makefile: -------------------------------------------------------------------------------- 1 | # Project Name 2 | # GENERATE TARGET 3 | 4 | # Library Locations 5 | LIBDAISY_DIR = # LIBDAISY PATH 6 | HVCC_DIR = source 7 | 8 | # HVCC Sources 9 | CPP_SOURCES = $(wildcard $(HVCC_DIR)/*.cpp) 10 | C_INCLUDES = -I$(HVCC_DIR)/ 11 | C_SOURCES = $(wildcard $(HVCC_DIR)/*.c) 12 | 13 | # Project Source 14 | CPP_SOURCES += $(TARGET).cpp 15 | 16 | # LINKER 17 | 18 | # BOOTLOADER 19 | 20 | # Core location, and generic makefile. 21 | SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core 22 | include $(SYSTEM_FILES_DIR)/Makefile -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Installing python packages..." 3 | 4 | rm -rf pd_env 5 | 6 | platform=$(uname) 7 | 8 | if [ $platform = "Linux" ] || [ $platform = "Darwin" ] 9 | then 10 | python3 -m venv pd_env 11 | source pd_env/bin/activate 12 | python3 -m pip install wheel 13 | python3 -m pip install -r requirements.txt 14 | else 15 | python -m venv pd_env 16 | source pd_env/Scripts/activate 17 | python -m pip install wheel 18 | python -m pip install -r requirements.txt 19 | fi 20 | 21 | echo "Building libDaisy..." 22 | git submodule update --init --recursive 23 | cd libdaisy 24 | make clean | grep "warningr:\|error:" 25 | make -j4 | grep "warning:r\|error:" 26 | echo "Setup complete!" -------------------------------------------------------------------------------- /examples/PdFiles/petal_test.pd: -------------------------------------------------------------------------------- 1 | #N canvas 754 73 659 567 12; 2 | #X obj 29 30 adc~; 3 | #X obj 29 375 dac~; 4 | #X obj 43 105 delwrite~ \$0-delay 1000; 5 | #X obj 28 252 *~; 6 | #X obj 256 132 r Knob3 @hv_param; 7 | #X obj 254 184 + 1; 8 | #X obj 254 158 * -1; 9 | #X obj 31 307 +~; 10 | #X obj 221 275 *~; 11 | #X obj 96 249 line~; 12 | #X obj 43 142 r Knob4 @hv_param; 13 | #X obj 43 168 * 999; 14 | #X obj 96 275 vd~ \$0-delay; 15 | #X obj 96 374 s~ feedback; 16 | #X obj 96 326 *~; 17 | #X obj 143 324 r Knob5 @hv_param; 18 | #X obj 43 77 +~; 19 | #X obj 70 30 r~ feedback; 20 | #X obj 96 187 t f 5; 21 | #X obj 96 218 pack f f; 22 | #X connect 0 0 3 0; 23 | #X connect 0 0 16 0; 24 | #X connect 3 0 7 0; 25 | #X connect 4 0 6 0; 26 | #X connect 4 0 8 1; 27 | #X connect 5 0 3 1; 28 | #X connect 6 0 5 0; 29 | #X connect 7 0 1 0; 30 | #X connect 7 0 1 1; 31 | #X connect 8 0 7 1; 32 | #X connect 9 0 12 0; 33 | #X connect 10 0 11 0; 34 | #X connect 11 0 18 0; 35 | #X connect 12 0 8 0; 36 | #X connect 12 0 14 0; 37 | #X connect 14 0 13 0; 38 | #X connect 15 0 14 1; 39 | #X connect 16 0 2 0; 40 | #X connect 17 0 16 1; 41 | #X connect 18 0 19 0; 42 | #X connect 18 1 19 1; 43 | #X connect 19 0 9 0; 44 | -------------------------------------------------------------------------------- /util/vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "cStandard": "c11", 5 | "compilerPath": "arm-none-eabi-g++.exe", 6 | "cppStandard": "c++17", 7 | "defines": [ 8 | "_DEBUG", 9 | "UNICODE", 10 | "_UNICODE" 11 | ], 12 | "includePath": [ 13 | "${workspaceFolder}/**", 14 | "${workspaceFolder}/# LIBDAISY DEPTHlibdaisy/**" 15 | ], 16 | "name": "Win32", 17 | "windowsSdkVersion": "10.0.17763.0" 18 | }, 19 | { 20 | "cStandard": "c11", 21 | "compilerPath": "/usr/local/bin/arm-none-eabi-g++", 22 | "cppStandard": "c++17", 23 | "defines": [ 24 | "_DEBUG", 25 | "UNICODE", 26 | "_UNICODE" 27 | ], 28 | "includePath": [ 29 | "${workspaceFolder}/**", 30 | "${workspaceFolder}/# LIBDAISY DEPTHlibdaisy/**" 31 | ], 32 | "name": "macOS" 33 | }, 34 | { 35 | "cStandard": "c11", 36 | "compilerPath": "/usr/local/bin/arm-none-eabi-g++", 37 | "cppStandard": "c++17", 38 | "defines": [ 39 | "_DEBUG", 40 | "UNICODE", 41 | "_UNICODE" 42 | ], 43 | "includePath": [ 44 | "${workspaceFolder}/**", 45 | "${workspaceFolder}/# LIBDAISY DEPTHlibdaisy/**" 46 | ], 47 | "name": "Linux" 48 | } 49 | ], 50 | "version": 4 51 | } 52 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | BUILD = build 2 | DIST = dist 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Linux) 6 | ACTIVATE_COMMAND = . pd_env/bin/activate 7 | SEPARATOR = : 8 | PYI_CMD = pyinstaller 9 | else ifeq ($(UNAME), Darwin) 10 | ACTIVATE_COMMAND = . pd_env/bin/activate 11 | SEPARATOR = : 12 | PYI_CMD = python3 -m PyInstaller 13 | else 14 | ACTIVATE_COMMAND = ./pd_env/Scripts/activate 15 | SEPARATOR = ; 16 | PYI_CMD = python -m PyInstaller 17 | endif 18 | 19 | DATA_ITEMS = \ 20 | libdaisy$(SEPARATOR)libdaisy \ 21 | examples$(SEPARATOR)examples \ 22 | util$(SEPARATOR)util \ 23 | LICENSE$(SEPARATOR). \ 24 | $(BUILD)/hvcc/hvcc$(SEPARATOR)hvcc \ 25 | $(BUILD)/Sun-Valley-ttk-theme/sun-valley.tcl$(SEPARATOR)sv_ttk/ \ 26 | $(BUILD)/Sun-Valley-ttk-theme/theme$(SEPARATOR)sv_ttk/theme \ 27 | $(BUILD)/json2daisy/src/json2daisy$(SEPARATOR)json2daisy 28 | 29 | DATA_CMDS = $(addprefix --add-data ",$(addsuffix ",$(DATA_ITEMS))) 30 | 31 | pyi-build: $(BUILD) 32 | ./install.sh 33 | 34 | git clone https://github.com/electro-smith/json2daisy $(BUILD)/json2daisy 35 | git clone https://github.com/rdbende/Sun-Valley-ttk-theme $(BUILD)/Sun-Valley-ttk-theme 36 | git clone -b feature/daisy_json https://github.com/CorvusPrudens/hvcc $(BUILD)/hvcc 37 | 38 | $(ACTIVATE_COMMAND); \ 39 | $(PYI_CMD) pd2dsy_gui.py --windowed --hidden-import darkdetect $(DATA_CMDS); 40 | 41 | $(BUILD): 42 | mkdir -p $@ 43 | 44 | clean: 45 | rm -rf $(BUILD) 46 | rm -rf $(DIST) 47 | -------------------------------------------------------------------------------- /examples/PdFiles/patch_init_test.pd: -------------------------------------------------------------------------------- 1 | #N canvas 2339 930 1122 792 10; 2 | #X obj 213 350 *~; 3 | #X obj 361 385 *~; 4 | #X obj 311 259 osc~; 5 | #X text 108 255 ctrls set volume per channel; 6 | #X obj 128 321 * 0.8; 7 | #X obj 360 331 * 0.8; 8 | #X obj 142 513 t b b; 9 | #X msg 174 543 1; 10 | #X msg 130 543 0 500; 11 | #X obj 227 381 *~; 12 | #X obj 336 445 dac~ 1 2; 13 | #X obj 310 182 mtof; 14 | #X obj 308 113 * 100; 15 | #X obj 309 149 + 24; 16 | #X obj 754 433 s cvout2 @hv_param; 17 | #X obj 306 78 r Ctrl1 @hv_param; 18 | #X obj 631 285 r Ctrl2 @hv_param; 19 | #X obj 125 291 r Ctrl3 @hv_param; 20 | #X obj 389 286 r Ctrl4 @hv_param; 21 | #X obj 48 471 r Gate1_Trig @hv_param; 22 | #X obj 555 356 s cvout1 @hv_param; 23 | #X obj 690 645 s GateOut2 @hv_param; 24 | #X obj 687 575 r Gate2 @hv_param; 25 | #X obj 543 570 r Gate1 @hv_param; 26 | #X text 24 427 gate in 1 triggers env for out1; 27 | #X obj 542 644 s GateOut1 @hv_param; 28 | #X obj 154 569 line~; 29 | #X obj 895 283 r cv_5 @hv_param; 30 | #X obj 897 366 * 5; 31 | #X obj 896 328 < -0.5; 32 | #X connect 0 0 9 0; 33 | #X connect 1 0 10 1; 34 | #X connect 2 0 1 0; 35 | #X connect 2 0 0 0; 36 | #X connect 4 0 0 1; 37 | #X connect 5 0 1 1; 38 | #X connect 6 0 8 0; 39 | #X connect 6 1 7 0; 40 | #X connect 7 0 26 0; 41 | #X connect 8 0 26 0; 42 | #X connect 9 0 10 0; 43 | #X connect 11 0 2 0; 44 | #X connect 12 0 13 0; 45 | #X connect 13 0 11 0; 46 | #X connect 15 0 12 0; 47 | #X connect 16 0 20 0; 48 | #X connect 17 0 4 0; 49 | #X connect 18 0 5 0; 50 | #X connect 19 0 6 0; 51 | #X connect 22 0 21 0; 52 | #X connect 23 0 25 0; 53 | #X connect 26 0 9 1; 54 | #X connect 27 0 29 0; 55 | #X connect 28 0 14 0; 56 | #X connect 29 0 28 0; 57 | -------------------------------------------------------------------------------- /util/template.cpp: -------------------------------------------------------------------------------- 1 | #define SAMPLE_RATE 48000.f 2 | 3 | #include "daisy_boards.h" 4 | 5 | // GENERATE INCLUDES 6 | 7 | using namespace daisy; 8 | 9 | DSY_BOARD* hardware; 10 | 11 | int num_params; 12 | 13 | // GENERATE GLOBALS 14 | 15 | void ProcessControls(); 16 | 17 | void audiocallback(AudioHandle::InputBuffer in, AudioHandle::OutputBuffer out, size_t size) 18 | { 19 | hv.process((float**) in, out, size); 20 | ProcessControls(); 21 | } 22 | 23 | static void sendHook(HeavyContextInterface *c, const char *receiverName, uint32_t receiverHash, const HvMessage * m) { 24 | // Do something with message sent from Pd patch through 25 | // [send receiverName @hv_event] object(s) 26 | } 27 | 28 | int main(void) 29 | { 30 | // GENERATE DEBUG 31 | hardware = &boardsHardware; 32 | // GENERATE PREINIT 33 | num_params = hv.getParameterInfo(0,NULL); 34 | 35 | hv.setSendHook(sendHook); 36 | 37 | hardware->Init(); 38 | 39 | // GENERATE ADC 40 | 41 | hardware->StartAudio(audiocallback); 42 | // GENERATE POSTINIT 43 | for(;;) 44 | { 45 | // GENERATE INFINITELOOP 46 | } 47 | } 48 | 49 | void ProcessControls() 50 | { 51 | // GENERATE DEBOUNCE 52 | 53 | for (int i = 0; i < num_params; i++) 54 | { 55 | HvParameterInfo info; 56 | hv.getParameterInfo(i, &info); 57 | 58 | // GENERATE CONTROLS 59 | 60 | std::string name(info.name); 61 | 62 | for (int j = 0; j < DaisyNumParameters; j++){ 63 | if (DaisyParameters[j].name == name) 64 | { 65 | float sig = DaisyParameters[j].Process(); 66 | 67 | if (DaisyParameters[j].mode == ENCODER || DaisyParameters[j].mode == KNOB) 68 | hv.sendFloatToReceiver(info.hash, sig); 69 | else if(sig) 70 | hv.sendBangToReceiver(info.hash); 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /util/vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "configFiles": [ 5 | "interface/stlink.cfg", 6 | "target/stm32h7x.cfg" 7 | ], 8 | "cwd": "${workspaceFolder}", 9 | "debuggerArgs": [ 10 | "-d", 11 | "${workspaceRoot}" 12 | ], 13 | "executable": "${workspaceRoot}/build/# GENERATE TARGET.elf", 14 | "interface": "swd", 15 | "name": "Default Debug", 16 | "openOCDLaunchCommands": [ 17 | "init", 18 | "reset init" 19 | ], 20 | "preLaunchTask": "build_all_debug", 21 | "preRestartCommands": [ 22 | "load", 23 | "enable breakpoint", 24 | "monitor reset" 25 | ], 26 | "request": "launch", 27 | "runToMain": true, 28 | "servertype": "openocd", 29 | "showDevDebugOutput": true, 30 | "svdFile": "${workspaceRoot}/.vscode/STM32H750x.svd", 31 | "type": "cortex-debug" 32 | }, 33 | { 34 | "configFiles": [ 35 | "interface/stlink.cfg", 36 | "target/stm32h7x.cfg" 37 | ], 38 | "cwd": "${workspaceFolder}", 39 | "debuggerArgs": [ 40 | "-d", 41 | "${workspaceRoot}" 42 | ], 43 | "executable": "${workspaceRoot}/build/# GENERATE TARGET.elf", 44 | "interface": "swd", 45 | "name": "Bootloader Debug", 46 | "openOCDLaunchCommands": [ 47 | "init", 48 | "reset init" 49 | ], 50 | "preRestartCommands": [ 51 | "load", 52 | "enable breakpoint", 53 | "monitor reset" 54 | ], 55 | "request": "launch", 56 | "runToMain": true, 57 | "servertype": "openocd", 58 | "showDevDebugOutput": true, 59 | "svdFile": "${workspaceRoot}/.vscode/STM32H750x.svd", 60 | "type": "cortex-debug" 61 | } 62 | ], 63 | "version": "0.2.0" 64 | } 65 | -------------------------------------------------------------------------------- /util/custom_json_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "daisy": { 3 | "description": { 4 | "name": "patch", 5 | "driver": "seed", 6 | "defines": { 7 | "OOPSY_TARGET_HAS_MIDI_INPUT": 1 8 | }, 9 | "display": {}, 10 | "external_codecs": [ 11 | { 12 | "periph": "SAI_2", 13 | "a_sync": "SLAVE", 14 | "b_sync": "MASTER", 15 | "a_dir": "TRANSMIT", 16 | "b_dir": "RECEIVE", 17 | "pin": { 18 | "fs": 27, 19 | "mclk": 24, 20 | "sck": 28, 21 | "sb": 25, 22 | "sa": 26 23 | } 24 | } 25 | ], 26 | "components": { 27 | "knob1": { 28 | "component": "AnalogControl", 29 | "pin": 15 30 | }, 31 | "knob2": { 32 | "component": "AnalogControl", 33 | "pin": 16 34 | }, 35 | "knob3": { 36 | "component": "AnalogControl", 37 | "pin": 21 38 | }, 39 | "knob4": { 40 | "component": "AnalogControl", 41 | "pin": 18 42 | }, 43 | "encoder": { 44 | "component": "Encoder", 45 | "pin": { 46 | "a": 12, 47 | "b": 11, 48 | "click": 0 49 | } 50 | }, 51 | "gateout": { 52 | "component": "GateOut", 53 | "pin": 17, 54 | "display": "" 55 | }, 56 | "cvout1": { 57 | "component": "CVOuts" 58 | }, 59 | "cvout2": { 60 | "component": "CVOuts" 61 | }, 62 | "gatein1": { 63 | "component": "GateIn", 64 | "pin": 20 65 | }, 66 | "gatein2": { 67 | "component": "GateIn", 68 | "pin": 19 69 | } 70 | }, 71 | "aliases": { 72 | "gate": "gatein1", 73 | "gate1": "gatein1", 74 | "gate2": "gatein2", 75 | "cvout": "cvout1", 76 | "encswitch": "encoder_rise", 77 | "enp": "encoder_press", 78 | "press": "encoder_press", 79 | "knob": "knob1", 80 | "ctrl": "knob1", 81 | "ctrl1": "knob1", 82 | "ctrl2": "knob2", 83 | "ctrl3": "knob3", 84 | "ctrl4": "knob4" 85 | } 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /examples/PdFiles/patch_test.pd: -------------------------------------------------------------------------------- 1 | #N canvas 3989 1037 960 820 10; 2 | #X obj 336 445 dac~ 1 2 3 4; 3 | #X obj 213 350 *~; 4 | #X obj 363 369 *~; 5 | #X obj 404 371 *~; 6 | #X obj 559 366 *~; 7 | #X obj 336 291 r Ctrl2 @hv_param; 8 | #X obj 471 296 r Ctrl3 @hv_param; 9 | #X obj 617 292 r Ctrl4 @hv_param; 10 | #X obj 412 239 osc~; 11 | #X obj 354 143 loadbang; 12 | #X msg 354 164 440; 13 | #X obj 373 194 f; 14 | #X obj 413 196 +; 15 | #X obj 416 145 r Encoder @hv_param; 16 | #X obj 413 169 * 20; 17 | #X msg 548 143 1; 18 | #X msg 589 144 -1; 19 | #X floatatom 459 218 5 0 0 0 - - -; 20 | #X text 594 119 turn encoder to set pitch; 21 | #X text 603 268 ctrls set volume per channel; 22 | #X obj 329 111 r EncSwitch @hv_param; 23 | #X text 110 116 press encoder to reset osc pitch; 24 | #X obj 125 291 r Ctrl1 @hv_param; 25 | #X obj 128 321 * 0.8; 26 | #X obj 333 316 * 0.8; 27 | #X obj 472 323 * 0.8; 28 | #X obj 606 328 * 0.8; 29 | #X obj 142 513 t b b; 30 | #X msg 174 543 1; 31 | #X msg 130 543 0 500; 32 | #X obj 227 381 *~; 33 | #X obj 272 514 t b b; 34 | #X msg 295 540 1; 35 | #X msg 250 540 0 500; 36 | #X obj 364 395 *~; 37 | #X text 389 486 gate ins trigger env for outs 1-2; 38 | #X obj 154 569 line~; 39 | #X obj 282 567 line~; 40 | #X obj 76 484 r Gate1_trig @hv_param; 41 | #X obj 231 484 r Gate2_trig @hv_param; 42 | #X connect 1 0 30 0; 43 | #X connect 2 0 34 0; 44 | #X connect 3 0 0 2; 45 | #X connect 4 0 0 3; 46 | #X connect 5 0 24 0; 47 | #X connect 6 0 25 0; 48 | #X connect 7 0 26 0; 49 | #X connect 8 0 2 0; 50 | #X connect 8 0 3 0; 51 | #X connect 8 0 4 0; 52 | #X connect 8 0 1 0; 53 | #X connect 9 0 10 0; 54 | #X connect 10 0 11 0; 55 | #X connect 11 0 12 1; 56 | #X connect 12 0 11 0; 57 | #X connect 12 0 17 0; 58 | #X connect 12 0 8 0; 59 | #X connect 13 0 14 0; 60 | #X connect 14 0 12 0; 61 | #X connect 15 0 14 0; 62 | #X connect 16 0 14 0; 63 | #X connect 20 0 10 0; 64 | #X connect 22 0 23 0; 65 | #X connect 23 0 1 1; 66 | #X connect 24 0 2 1; 67 | #X connect 25 0 3 1; 68 | #X connect 26 0 4 1; 69 | #X connect 27 0 29 0; 70 | #X connect 27 1 28 0; 71 | #X connect 28 0 36 0; 72 | #X connect 29 0 36 0; 73 | #X connect 30 0 0 0; 74 | #X connect 31 0 33 0; 75 | #X connect 31 1 32 0; 76 | #X connect 32 0 37 0; 77 | #X connect 33 0 37 0; 78 | #X connect 34 0 0 1; 79 | #X connect 36 0 30 1; 80 | #X connect 37 0 34 1; 81 | #X connect 38 0 27 0; 82 | #X connect 39 0 31 0; 83 | -------------------------------------------------------------------------------- /util/vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasks": [ 3 | { 4 | "command": "make clean; make", 5 | "group": { 6 | "isDefault": true, 7 | "kind": "build" 8 | }, 9 | "label": "build", 10 | "options": { 11 | "cwd": "${workspaceFolder}" 12 | }, 13 | "problemMatcher": [ 14 | "$gcc" 15 | ], 16 | "type": "shell" 17 | }, 18 | { 19 | "command": "make clean; make; make program", 20 | "label": "build_and_program", 21 | "options": { 22 | "cwd": "${workspaceFolder}" 23 | }, 24 | "problemMatcher": [ 25 | "$gcc" 26 | ], 27 | "type": "shell" 28 | }, 29 | { 30 | "command": "make clean; make; make program-dfu", 31 | "label": "build_and_program_dfu", 32 | "options": { 33 | "cwd": "${workspaceFolder}" 34 | }, 35 | "problemMatcher": [ 36 | "$gcc" 37 | ], 38 | "type": "shell" 39 | }, 40 | { 41 | "command": "make clean;make", 42 | "dependsOn": [ 43 | "build_libdaisy" 44 | ], 45 | "label": "build_all", 46 | "options": { 47 | "cwd": "${workspaceFolder}" 48 | }, 49 | "problemMatcher": [ 50 | "$gcc" 51 | ], 52 | "type": "shell" 53 | }, 54 | { 55 | "command": "make clean;DEBUG=1 make", 56 | "dependsOn": [ 57 | "build_libdaisy" 58 | ], 59 | "label": "build_all_debug", 60 | "options": { 61 | "cwd": "${workspaceFolder}" 62 | }, 63 | "problemMatcher": [ 64 | "$gcc" 65 | ], 66 | "type": "shell" 67 | }, 68 | { 69 | "command": "make program-dfu", 70 | "label": "program-dfu", 71 | "problemMatcher": [], 72 | "type": "shell" 73 | }, 74 | { 75 | "command": "make program", 76 | "label": "program", 77 | "problemMatcher": [], 78 | "type": "shell" 79 | }, 80 | { 81 | "command": "make program-target", 82 | "label": "program_target", 83 | "problemMatcher": [], 84 | "type": "shell" 85 | }, 86 | { 87 | "command": "make program-boot", 88 | "label": "program_boot", 89 | "problemMatcher": [], 90 | "type": "shell" 91 | }, 92 | { 93 | "command": "make program-boot-dfu", 94 | "label": "program_boot_dfu", 95 | "problemMatcher": [], 96 | "type": "shell" 97 | }, 98 | { 99 | "command": "make", 100 | "label": "build_libdaisy", 101 | "options": { 102 | "cwd": "${workspaceFolder}/# LIBDAISY DEPTHlibdaisy/" 103 | }, 104 | "problemMatcher": [ 105 | "$gcc" 106 | ], 107 | "type": "shell" 108 | }, 109 | { 110 | "command": "make clean; make VOLATILE=1", 111 | "label": "build_libdaisy_volatile", 112 | "options": { 113 | "cwd": "${workspaceFolder}/# LIBDAISY DEPTHlibdaisy/" 114 | }, 115 | "problemMatcher": [ 116 | "$gcc" 117 | ], 118 | "type": "shell" 119 | }, 120 | { 121 | "command": "make clean; make VOLATILE=1 DEBUG=1", 122 | "label": "build_libdaisy_volatile_debug", 123 | "options": { 124 | "cwd": "${workspaceFolder}/# LIBDAISY DEPTHlibdaisy/" 125 | }, 126 | "problemMatcher": [ 127 | "$gcc" 128 | ], 129 | "type": "shell" 130 | } 131 | ], 132 | "version": "2.0.0" 133 | } 134 | -------------------------------------------------------------------------------- /examples/PdFiles/pod_test.pd: -------------------------------------------------------------------------------- 1 | #N canvas 4227 1072 1440 679 10; 2 | #X obj 785 449 dac~; 3 | #X obj 863 354 osc~; 4 | #X obj 588 372 osc~; 5 | #X obj 658 389 *~; 6 | #X msg 1016 325 1; 7 | #X obj 922 390 *~; 8 | #X obj 977 271 r Button2 @hv_param; 9 | #X obj 708 274 r Button1 @hv_param; 10 | #X obj 978 299 t b b; 11 | #X msg 968 326 0 500; 12 | #X obj 707 299 t b b; 13 | #X msg 740 326 1; 14 | #X msg 697 326 0 500; 15 | #X obj 592 276 r Knob1 @hv_param; 16 | #X obj 861 273 r Knob2 @hv_param; 17 | #X obj 591 301 * 2000; 18 | #X obj 861 298 * 2000; 19 | #X obj 762 54 r EncSwitch @hv_param; 20 | #X text 253 292 knob1 adjusts left pitch; 21 | #X text 253 313 button1 triggers left envelope; 22 | #X text 1135 273 knob2 adjusts right pitch; 23 | #X text 1135 292 button2 triggers right envelope; 24 | #X obj 509 290 vsl 15 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144 25 | -1 -1 0 1; 26 | #X text 485 30 pressing encoder toggles vibrato; 27 | #X obj 859 134 osc~; 28 | #X obj 859 86 loadbang; 29 | #X obj 590 341 +~; 30 | #X obj 861 331 +~; 31 | #X obj 859 198 *~; 32 | #X obj 708 234 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 33 | -1 -1; 34 | #X obj 754 83 f; 35 | #X obj 784 84 + 1; 36 | #X obj 813 84 % 2; 37 | #X obj 711 33 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 38 | -1; 39 | #X floatatom 755 115 5 0 0 0 - - -; 40 | #X msg 858 109 10; 41 | #X obj 982 232 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 42 | -1 -1; 43 | #X obj 1088 241 vsl 15 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144 44 | -1 -1 0 1; 45 | #X obj 933 84 r Encoder @hv_param; 46 | #X obj 930 134 f; 47 | #X obj 958 133 +; 48 | #X floatatom 958 162 5 0 0 0 - - -; 49 | #X msg 1093 82 1; 50 | #X msg 1142 82 -1; 51 | #X obj 857 166 *~; 52 | #X obj 932 109 * 25; 53 | #X text 1196 85 rotating encoder sets vibrato depth; 54 | #X msg 827 108 0; 55 | #X msg 891 109 100; 56 | #X obj 695 357 line~; 57 | #X obj 972 356 line~; 58 | #X obj 1066 471 r button1_press @hv_param; 59 | #X obj 1238 472 r button2_press @hv_param; 60 | #X obj 1066 537 s led1 @hv_param; 61 | #X obj 1238 539 s led2 @hv_param; 62 | #X connect 1 0 5 0; 63 | #X connect 2 0 3 0; 64 | #X connect 3 0 0 0; 65 | #X connect 4 0 50 0; 66 | #X connect 5 0 0 1; 67 | #X connect 6 0 8 0; 68 | #X connect 7 0 10 0; 69 | #X connect 8 0 9 0; 70 | #X connect 8 1 4 0; 71 | #X connect 9 0 50 0; 72 | #X connect 10 0 12 0; 73 | #X connect 10 1 11 0; 74 | #X connect 11 0 49 0; 75 | #X connect 12 0 49 0; 76 | #X connect 13 0 15 0; 77 | #X connect 14 0 16 0; 78 | #X connect 15 0 26 0; 79 | #X connect 16 0 27 0; 80 | #X connect 17 0 30 0; 81 | #X connect 22 0 15 0; 82 | #X connect 24 0 44 0; 83 | #X connect 25 0 35 0; 84 | #X connect 25 0 47 0; 85 | #X connect 25 0 48 0; 86 | #X connect 26 0 2 0; 87 | #X connect 27 0 1 0; 88 | #X connect 28 0 26 1; 89 | #X connect 28 0 27 1; 90 | #X connect 29 0 10 0; 91 | #X connect 30 0 31 0; 92 | #X connect 30 0 28 1; 93 | #X connect 30 0 34 0; 94 | #X connect 31 0 32 0; 95 | #X connect 32 0 30 1; 96 | #X connect 33 0 30 0; 97 | #X connect 35 0 24 0; 98 | #X connect 36 0 8 0; 99 | #X connect 37 0 16 0; 100 | #X connect 38 0 45 0; 101 | #X connect 39 0 40 1; 102 | #X connect 40 0 41 0; 103 | #X connect 40 0 39 0; 104 | #X connect 40 0 44 1; 105 | #X connect 42 0 45 0; 106 | #X connect 43 0 45 0; 107 | #X connect 44 0 28 0; 108 | #X connect 45 0 40 0; 109 | #X connect 47 0 30 0; 110 | #X connect 48 0 39 0; 111 | #X connect 49 0 3 1; 112 | #X connect 50 0 5 1; 113 | #X connect 51 0 53 0; 114 | #X connect 52 0 54 0; 115 | -------------------------------------------------------------------------------- /util/daisy_boards.h: -------------------------------------------------------------------------------- 1 | #ifndef DSY_BOARDS_H 2 | #define DSY_BOARDS_H 3 | #ifndef DSY_BOARD 4 | // GENERATE BOARD 5 | #endif 6 | #endif 7 | #include "daisy_seed.h" 8 | #include "daisy_pod.h" 9 | #include "daisy_patch.h" 10 | #include "daisy_field.h" 11 | #include "daisy_petal.h" 12 | #include 13 | 14 | using namespace daisy; 15 | 16 | enum ControlType 17 | { 18 | ENCODER, 19 | SWITCH, 20 | KNOB, 21 | GATE, 22 | }; 23 | 24 | 25 | //All the info we need for our parameters 26 | struct DaisyHvParam{ 27 | 28 | std::string name; 29 | void* control; 30 | ControlType mode; 31 | 32 | float Process() 33 | { 34 | if (control == nullptr) 35 | return 0.f; 36 | 37 | switch (mode) 38 | { 39 | case ENCODER: 40 | { 41 | Encoder* enc = static_cast(control); 42 | return enc->Increment(); 43 | } 44 | 45 | case SWITCH: 46 | { 47 | Switch* sw = static_cast(control); 48 | return sw->RisingEdge(); 49 | } 50 | 51 | case KNOB: 52 | { 53 | AnalogControl* knob = static_cast(control); 54 | return knob->Process(); 55 | } 56 | 57 | case GATE: 58 | { 59 | GateIn* gate = static_cast(control); 60 | return gate->Trig(); 61 | } 62 | 63 | } 64 | 65 | return 0.f; 66 | } 67 | }; 68 | 69 | DSY_BOARD boardsHardware; 70 | 71 | /* seed 72 | int DaisyNumParameters = 0; 73 | DaisyHvParam DaisyParameters[0]; 74 | seed */ 75 | 76 | /* pod 77 | int DaisyNumParameters = 6; 78 | DaisyHvParam DaisyParameters[6] = { 79 | {"Encoder", &boardsHardware.encoder, ENCODER}, 80 | {"EncSwitch", &boardsHardware.encoder, SWITCH}, 81 | {"Knob1", &boardsHardware.knob1, KNOB}, 82 | {"Knob2", &boardsHardware.knob2, KNOB}, 83 | {"Button1", &boardsHardware.button1, SWITCH}, 84 | {"Button2", &boardsHardware.button2, SWITCH}, 85 | }; 86 | pod */ 87 | 88 | /* patch 89 | int DaisyNumParameters = 8; 90 | DaisyHvParam DaisyParameters[8] = { 91 | {"Encoder", &boardsHardware.encoder, ENCODER}, 92 | {"EncSwitch", &boardsHardware.encoder, SWITCH}, 93 | {"Ctrl1", &boardsHardware.controls[0], KNOB}, 94 | {"Ctrl2", &boardsHardware.controls[1], KNOB}, 95 | {"Ctrl3", &boardsHardware.controls[2], KNOB}, 96 | {"Ctrl4", &boardsHardware.controls[3], KNOB}, 97 | {"Gate1", &boardsHardware.gate_input[0], GATE}, 98 | {"Gate2", &boardsHardware.gate_input[1], GATE}, 99 | }; 100 | patch */ 101 | 102 | /* petal 103 | int DaisyNumParameters = 15; 104 | DaisyHvParam DaisyParameters[15] = { 105 | {"Encoder", &boardsHardware.encoder, ENCODER}, 106 | {"EncSwitch", &boardsHardware.encoder, SWITCH}, 107 | {"Knob1", &boardsHardware.knob[0], KNOB}, 108 | {"Knob2", &boardsHardware.knob[1], KNOB}, 109 | {"Knob3", &boardsHardware.knob[2], KNOB}, 110 | {"Knob4", &boardsHardware.knob[3], KNOB}, 111 | {"Knob5", &boardsHardware.knob[4], KNOB}, 112 | {"Knob6", &boardsHardware.knob[5], KNOB}, 113 | {"Switch1", &boardsHardware.switches[0], SWITCH}, 114 | {"Switch2", &boardsHardware.switches[1], SWITCH}, 115 | {"Switch3", &boardsHardware.switches[2], SWITCH}, 116 | {"Switch4", &boardsHardware.switches[3], SWITCH}, 117 | {"Switch5", &boardsHardware.switches[4], SWITCH}, 118 | {"Switch6", &boardsHardware.switches[5], SWITCH}, 119 | {"Switch7", &boardsHardware.switches[6], SWITCH}, 120 | }; 121 | petal */ 122 | -------------------------------------------------------------------------------- /examples/PdFiles/field_test.pd: -------------------------------------------------------------------------------- 1 | #N canvas 5898 994 949 766 12; 2 | #X obj 56 352 dac~; 3 | #X obj 212 370 r PadB2_press @hv_param; 4 | #X obj 214 399 s led_Key_B2 @hv_param; 5 | #X obj 397 225 s led_knob_1 @hv_param; 6 | #X obj 397 189 r knob1 @hv_param; 7 | #X obj 576 190 r knob2 @hv_param; 8 | #X obj 576 224 s led_knob_2 @hv_param; 9 | #X obj 397 255 r knob3 @hv_param; 10 | #X obj 397 289 s led_knob_3 @hv_param; 11 | #X obj 576 256 r knob4 @hv_param; 12 | #X obj 576 290 s led_knob_4 @hv_param; 13 | #X obj 398 322 r knob5 @hv_param; 14 | #X obj 398 356 s led_knob_5 @hv_param; 15 | #X obj 577 323 r knob6 @hv_param; 16 | #X obj 577 357 s led_knob_6 @hv_param; 17 | #X obj 398 388 r knob7 @hv_param; 18 | #X obj 398 422 s led_knob_7 @hv_param; 19 | #X obj 577 389 r knob8 @hv_param; 20 | #X obj 577 423 s led_knob_8 @hv_param; 21 | #X obj 35 456 r PadA1_press @hv_param; 22 | #X obj 35 491 s led_Key_A1 @hv_param; 23 | #X obj 215 492 s led_Key_A2 @hv_param; 24 | #X obj 36 526 r PadA3_press @hv_param; 25 | #X obj 36 561 s led_Key_A3 @hv_param; 26 | #X obj 216 527 r PadA4_press @hv_param; 27 | #X obj 216 562 s led_Key_A4 @hv_param; 28 | #X obj 36 594 r PadA5_press @hv_param; 29 | #X obj 36 629 s led_Key_A5 @hv_param; 30 | #X obj 216 595 r PadA6_press @hv_param; 31 | #X obj 216 630 s led_Key_A6 @hv_param; 32 | #X obj 37 664 r PadA7_press @hv_param; 33 | #X obj 37 699 s led_Key_A7 @hv_param; 34 | #X obj 217 665 r PadA8_press @hv_param; 35 | #X obj 217 700 s led_Key_A8 @hv_param; 36 | #X obj 392 458 r PadB1_press @hv_param; 37 | #X obj 572 459 r PadB2_press @hv_param; 38 | #X obj 392 493 s led_Key_B1 @hv_param; 39 | #X obj 572 494 s led_Key_B2 @hv_param; 40 | #X obj 573 529 r PadB4_press @hv_param; 41 | #X obj 393 528 r PadB3_press @hv_param; 42 | #X obj 393 563 s led_Key_B3 @hv_param; 43 | #X obj 573 564 s led_Key_B4 @hv_param; 44 | #X obj 393 596 r PadB5_press @hv_param; 45 | #X obj 573 597 r PadB6_press @hv_param; 46 | #X obj 393 631 s led_Key_B5 @hv_param; 47 | #X obj 573 632 s led_Key_B6 @hv_param; 48 | #X obj 394 666 r PadB7_press @hv_param; 49 | #X obj 574 667 r PadB8_press @hv_param; 50 | #X obj 394 701 s led_Key_B7 @hv_param; 51 | #X obj 574 702 s led_Key_B8 @hv_param; 52 | #X obj 772 88 s gateout @hv_param; 53 | #X obj 772 35 r gatein @hv_param; 54 | #X obj 398 128 s gateout @hv_param; 55 | #X obj 397 76 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 56 | 1; 57 | #X obj 397 30 r sw1 @hv_param; 58 | #X obj 215 457 r PadA2_press @hv_param; 59 | #X obj 524 26 r PadA2 @hv_param; 60 | #X obj 160 65 int 1; 61 | #X obj 221 65 + 1; 62 | #X floatatom 159 128 5 0 0 0 - - -; 63 | #X obj 160 96 % 7; 64 | #X obj 159 226 mtof; 65 | #X obj 159 193 + 60; 66 | #X obj 159 160 * 2; 67 | #X obj 131 258 osc~ 440; 68 | #X obj 159 29 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 69 | -1; 70 | #X obj 286 85 int 1; 71 | #X obj 347 85 + 1; 72 | #X floatatom 285 148 5 0 0 0 - - -; 73 | #X obj 286 116 % 2; 74 | #X connect 1 0 2 0; 75 | #X connect 4 0 3 0; 76 | #X connect 5 0 6 0; 77 | #X connect 7 0 8 0; 78 | #X connect 9 0 10 0; 79 | #X connect 11 0 12 0; 80 | #X connect 13 0 14 0; 81 | #X connect 15 0 16 0; 82 | #X connect 17 0 18 0; 83 | #X connect 22 0 23 0; 84 | #X connect 24 0 25 0; 85 | #X connect 26 0 27 0; 86 | #X connect 28 0 29 0; 87 | #X connect 30 0 31 0; 88 | #X connect 32 0 33 0; 89 | #X connect 34 0 36 0; 90 | #X connect 35 0 37 0; 91 | #X connect 38 0 41 0; 92 | #X connect 39 0 40 0; 93 | #X connect 42 0 44 0; 94 | #X connect 43 0 45 0; 95 | #X connect 46 0 48 0; 96 | #X connect 47 0 49 0; 97 | #X connect 51 0 50 0; 98 | #X connect 53 0 52 0; 99 | #X connect 54 0 53 0; 100 | #X connect 54 0 57 0; 101 | #X connect 54 0 66 0; 102 | #X connect 55 0 21 0; 103 | #X connect 56 0 53 0; 104 | #X connect 56 0 57 0; 105 | #X connect 56 0 66 0; 106 | #X connect 57 0 58 0; 107 | #X connect 57 0 60 0; 108 | #X connect 58 0 57 1; 109 | #X connect 59 0 63 0; 110 | #X connect 60 0 59 0; 111 | #X connect 61 0 64 0; 112 | #X connect 62 0 61 0; 113 | #X connect 63 0 62 0; 114 | #X connect 64 0 0 0; 115 | #X connect 64 0 0 1; 116 | #X connect 65 0 57 0; 117 | #X connect 66 0 67 0; 118 | #X connect 66 0 69 0; 119 | #X connect 67 0 66 1; 120 | #X connect 68 0 20 0; 121 | #X connect 69 0 68 0; 122 | -------------------------------------------------------------------------------- /examples/PdFiles/saw_test.pd: -------------------------------------------------------------------------------- 1 | #N canvas 624 80 1066 837 10; 2 | #X obj 226 56 hsl 128 15 0 1 0 0 empty empty Parameter_B -2 -8 0 10 3 | -262144 -1 -1 7700 1; 4 | #X obj 434 56 hsl 128 15 0 1 0 0 empty empty Parameter_C -2 -8 0 10 5 | -262144 -1 -1 4900 1; 6 | #X obj 644 51 hsl 128 15 0 1 0 0 empty empty Parameter_D -2 -8 0 10 7 | -262144 -1 -1 11000 1; 8 | #X obj 21 55 hsl 128 15 0 1 0 0 empty empty Parameter_A -2 -8 0 10 9 | -262144 -1 -1 3800 1; 10 | #X text 72 4 OWL Puredata Template; 11 | #X obj 831 47 hsl 128 15 0 1 0 0 empty empty Parameter_E -2 -8 0 10 12 | -262144 -1 -1 1400 1; 13 | #X obj 826 114 + 0; 14 | #X obj 512 771 dac~; 15 | #X obj 326 568 phasor~; 16 | #X obj 328 614 *~ 2; 17 | #X obj 330 647 -~ 1; 18 | #X obj 330 282 hsl 128 15 0 1000 0 0 empty empty empty -2 -8 0 10 -262144 19 | -1 -1 1400 1; 20 | #X obj 507 546 phasor~; 21 | #X obj 509 592 *~ 2; 22 | #X obj 511 625 -~ 1; 23 | #X obj 644 599 phasor~; 24 | #X obj 646 645 *~ 2; 25 | #X obj 648 678 -~ 1; 26 | #X obj 753 621 phasor~; 27 | #X obj 755 667 *~ 2; 28 | #X obj 757 700 -~ 1; 29 | #X floatatom 428 526 5 0 0 0 - - -; 30 | #X floatatom 579 569 5 0 0 0 - - -; 31 | #X floatatom 699 572 5 0 0 0 - - -; 32 | #X obj 510 510 +, f 4; 33 | #X obj 617 532 +, f 4; 34 | #X obj 733 528 +, f 4; 35 | #X obj 732 296 vsl 15 128 -100 100 0 0 empty empty empty 0 -9 0 10 36 | -262144 -1 -1 7700 1; 37 | #X obj 563 445 t b f; 38 | #X obj 647 463 t b f; 39 | #X obj 728 481 t b f; 40 | #X floatatom 278 440 5 0 0 0 - - -; 41 | #X obj 757 295 vsl 15 128 -100 100 0 0 empty empty empty 0 -9 0 10 42 | -262144 -1 -1 4900 1; 43 | #X obj 783 294 vsl 15 128 -100 100 0 0 empty empty empty 0 -9 0 10 44 | -262144 -1 -1 11000 1; 45 | #X floatatom 381 400 5 0 0 0 - - -; 46 | #X obj 460 379 +, f 4; 47 | #X obj 516 319 t b f; 48 | #X obj 597 266 hsl 64 15 -10 10 0 0 empty empty empty -2 -8 0 10 -262144 49 | -1 -1 1885 1; 50 | #X obj 532 274 / 1; 51 | #X obj 662 226 loadbang; 52 | #X msg 701 246 0; 53 | #X obj 828 94 * 1000; 54 | #X obj 662 142 - 100; 55 | #X obj 655 112 * 200; 56 | #X obj 430 123 - 100; 57 | #X obj 221 124 - 100; 58 | #X obj 223 103 * 200; 59 | #X obj 430 103 * 200; 60 | #X obj 18 102 * 20; 61 | #X obj 17 123 - 10; 62 | #X obj 508 735 *~ 0.75; 63 | #X obj 28 76 r ChannelA @hv_param 0 1 0.5; 64 | #X obj 441 77 r ChannelC @hv_param 0 1 0.5; 65 | #X obj 650 72 r ChannelD @hv_param 0 1 0.5; 66 | #X obj 837 68 r ChannelE @hv_param 0 1 0.5; 67 | #X obj 236 77 r ChannelB @hv_param 0 1 0.5; 68 | #X connect 0 0 46 0; 69 | #X connect 1 0 47 0; 70 | #X connect 2 0 43 0; 71 | #X connect 3 0 48 0; 72 | #X connect 5 0 41 0; 73 | #X connect 6 0 11 0; 74 | #X connect 8 0 9 0; 75 | #X connect 9 0 10 0; 76 | #X connect 10 0 50 0; 77 | #X connect 11 0 8 0; 78 | #X connect 11 0 31 0; 79 | #X connect 11 0 35 0; 80 | #X connect 12 0 13 0; 81 | #X connect 13 0 14 0; 82 | #X connect 14 0 50 0; 83 | #X connect 15 0 16 0; 84 | #X connect 16 0 17 0; 85 | #X connect 17 0 50 0; 86 | #X connect 18 0 19 0; 87 | #X connect 19 0 20 0; 88 | #X connect 20 0 50 0; 89 | #X connect 24 0 12 0; 90 | #X connect 24 0 21 0; 91 | #X connect 25 0 15 0; 92 | #X connect 25 0 22 0; 93 | #X connect 26 0 18 0; 94 | #X connect 26 0 23 0; 95 | #X connect 27 0 28 0; 96 | #X connect 28 0 24 0; 97 | #X connect 28 1 24 1; 98 | #X connect 29 0 25 0; 99 | #X connect 29 1 25 1; 100 | #X connect 30 0 26 0; 101 | #X connect 30 1 26 1; 102 | #X connect 32 0 29 0; 103 | #X connect 33 0 30 0; 104 | #X connect 35 0 34 0; 105 | #X connect 35 0 24 0; 106 | #X connect 35 0 25 0; 107 | #X connect 35 0 26 0; 108 | #X connect 36 0 35 0; 109 | #X connect 36 1 35 1; 110 | #X connect 37 0 38 0; 111 | #X connect 38 0 36 0; 112 | #X connect 39 0 40 0; 113 | #X connect 40 0 27 0; 114 | #X connect 40 0 32 0; 115 | #X connect 40 0 33 0; 116 | #X connect 40 0 37 0; 117 | #X connect 41 0 6 0; 118 | #X connect 42 0 33 0; 119 | #X connect 43 0 42 0; 120 | #X connect 44 0 32 0; 121 | #X connect 45 0 27 0; 122 | #X connect 46 0 45 0; 123 | #X connect 47 0 44 0; 124 | #X connect 48 0 49 0; 125 | #X connect 49 0 37 0; 126 | #X connect 50 0 7 0; 127 | #X connect 50 0 7 1; 128 | #X connect 51 0 48 0; 129 | #X connect 52 0 47 0; 130 | #X connect 53 0 43 0; 131 | #X connect 54 0 41 0; 132 | #X connect 55 0 46 0; 133 | -------------------------------------------------------------------------------- /util/default_linker_sdram.lds: -------------------------------------------------------------------------------- 1 | /* Generated by LinkerScriptGenerator [http://visualgdb.com/tools/LinkerScriptGenerator] 2 | * Target: STM32H750IB 3 | * The file is provided under the BSD license. 4 | */ 5 | 6 | ENTRY(Reset_Handler) 7 | 8 | MEMORY 9 | { 10 | FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K 11 | DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K 12 | SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K 13 | RAM_D2 (RWX) : ORIGIN = 0x30000000, LENGTH = 288K 14 | RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K 15 | ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K 16 | SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M 17 | QSPIFLASH (RX) : ORIGIN = 0x90000000, LENGTH = 8M 18 | } 19 | 20 | _estack = 0x20020000; 21 | 22 | SECTIONS 23 | { 24 | .isr_vector : 25 | { 26 | . = ALIGN(4); 27 | KEEP(*(.isr_vector)) 28 | . = ALIGN(4); 29 | } > FLASH 30 | 31 | .text : 32 | { 33 | . = ALIGN(4); 34 | _stext = .; 35 | 36 | *(.text) 37 | *(.text*) 38 | *(.rodata) 39 | *(.rodata*) 40 | *(.glue_7) 41 | *(.glue_7t) 42 | KEEP(*(.init)) 43 | KEEP(*(.fini)) 44 | . = ALIGN(4); 45 | _etext = .; 46 | 47 | } > FLASH 48 | 49 | .ARM.extab : 50 | { 51 | . = ALIGN(4); 52 | *(.ARM.extab) 53 | *(.gnu.linkonce.armextab.*) 54 | . = ALIGN(4); 55 | } > FLASH 56 | 57 | .exidx : 58 | { 59 | . = ALIGN(4); 60 | PROVIDE(__exidx_start = .); 61 | *(.ARM.exidx*) 62 | . = ALIGN(4); 63 | PROVIDE(__exidx_end = .); 64 | } > FLASH 65 | 66 | .ARM.attributes : 67 | { 68 | *(.ARM.attributes) 69 | } > FLASH 70 | 71 | .preinit_array : 72 | { 73 | PROVIDE(__preinit_array_start = .); 74 | KEEP(*(.preinit_array*)) 75 | PROVIDE(__preinit_array_end = .); 76 | } > FLASH 77 | 78 | .init_array : 79 | { 80 | PROVIDE(__init_array_start = .); 81 | KEEP(*(SORT(.init_array.*))) 82 | KEEP(*(.init_array*)) 83 | PROVIDE(__init_array_end = .); 84 | } > FLASH 85 | 86 | .fini_array : 87 | { 88 | PROVIDE(__fini_array_start = .); 89 | KEEP(*(.fini_array*)) 90 | KEEP(*(SORT(.fini_array.*))) 91 | PROVIDE(__fini_array_end = .); 92 | } > FLASH 93 | 94 | .data : 95 | { 96 | . = ALIGN(4); 97 | _sdata = .; 98 | 99 | PROVIDE(__data_start__ = _sdata); 100 | *(.data) 101 | *(.data*) 102 | . = ALIGN(4); 103 | _edata = .; 104 | 105 | PROVIDE(__data_end__ = _edata); 106 | } > SRAM AT >FLASH 107 | 108 | _sidata = LOADADDR(.data); 109 | 110 | .bss (NOLOAD) : 111 | { 112 | . = ALIGN(4); 113 | _sbss = .; 114 | 115 | PROVIDE(__bss_start__ = _sbss); 116 | *(.bss) 117 | *(.bss*) 118 | *(COMMON) 119 | . = ALIGN(4); 120 | _ebss = .; 121 | 122 | PROVIDE(__bss_end__ = _ebss); 123 | } > SRAM 124 | 125 | .dtcmram_bss (NOLOAD) : 126 | { 127 | . = ALIGN(4); 128 | _sdtcmram_bss = .; 129 | 130 | PROVIDE(__dtcmram_bss_start__ = _sdtcmram_bss); 131 | *(.dtcmram_bss) 132 | *(.dtcmram_bss*) 133 | . = ALIGN(4); 134 | _edtcmram_bss = .; 135 | 136 | PROVIDE(__dtcmram_bss_end__ = _edtcmram_bss); 137 | } > DTCMRAM 138 | 139 | .sram1_bss (NOLOAD) : 140 | { 141 | . = ALIGN(4); 142 | _ssram1_bss = .; 143 | 144 | PROVIDE(__sram1_bss_start__ = _sram1_bss); 145 | *(.sram1_bss) 146 | *(.sram1_bss*) 147 | . = ALIGN(4); 148 | _esram1_bss = .; 149 | 150 | PROVIDE(__sram1_bss_end__ = _esram1_bss); 151 | } > RAM_D2 152 | 153 | /* 154 | .sdram_text : 155 | { 156 | . = ALIGN(4); 157 | _ssdram_text = .; 158 | 159 | PROVIDE(__sdram_text_start = _ssdram_text); 160 | *(.sdram_text) 161 | *(.sdram_text*) 162 | . = ALIGN(4); 163 | _esdram_text = .; 164 | 165 | PROVIDE(__sdram_text_end = _esdram_text); 166 | } > SDRAM AT >FLASH 167 | _sisdram_text = LOADADDR(.sdram_text); 168 | */ 169 | 170 | .sdram_bss (NOLOAD) : 171 | { 172 | . = ALIGN(4); 173 | _ssdram_bss = .; 174 | 175 | PROVIDE(__sdram_bss_start = _ssdram_bss); 176 | *(.sdram_bss) 177 | *(.sdram_bss*) 178 | . = ALIGN(4); 179 | _esdram_bss = .; 180 | 181 | PROVIDE(__sdram_bss_end = _esdram_bss); 182 | } > SDRAM 183 | 184 | 185 | .qspiflash_text : 186 | { 187 | . = ALIGN(4); 188 | _sqspiflash_text = .; 189 | 190 | PROVIDE(__qspiflash_text_start = _sqspiflash_text); 191 | *(.qspiflash_text) 192 | *(.qspiflash_text*) 193 | . = ALIGN(4); 194 | _eqspiflash_text = .; 195 | 196 | PROVIDE(__qspiflash_text_end = _eqspiflash_text); 197 | } > QSPIFLASH 198 | 199 | .qspiflash_data : 200 | { 201 | . = ALIGN(4); 202 | _sqspiflash_data = .; 203 | 204 | PROVIDE(__qspiflash_data_start = _sqspiflash_data); 205 | *(.qspiflash_data) 206 | *(.qspiflash_data*) 207 | . = ALIGN(4); 208 | _eqspiflash_data = .; 209 | 210 | PROVIDE(__qspiflash_data_end = _eqspiflash_data); 211 | } > QSPIFLASH 212 | 213 | .qspiflash_bss (NOLOAD) : 214 | { 215 | . = ALIGN(4); 216 | _sqspiflash_bss = .; 217 | 218 | PROVIDE(__qspiflash_bss_start = _sqspiflash_bss); 219 | *(.qspiflash_bss) 220 | *(.qspiflash_bss*) 221 | . = ALIGN(4); 222 | _eqspiflash_bss = .; 223 | 224 | PROVIDE(__qspiflash_bss_end = _eqspiflash_bss); 225 | } > QSPIFLASH 226 | 227 | .heap (NOLOAD) : 228 | { 229 | . = ALIGN(4); 230 | PROVIDE(__heap_start__ = .); 231 | KEEP(*(.heap)) 232 | . = ALIGN(4); 233 | PROVIDE(__heap_end__ = .); 234 | } > SDRAM 235 | 236 | PROVIDE(end = .); 237 | 238 | .reserved_for_stack (NOLOAD) : 239 | { 240 | . = ALIGN(4); 241 | PROVIDE(__reserved_for_stack_start__ = .); 242 | KEEP(*(.reserved_for_stack)) 243 | . = ALIGN(4); 244 | PROVIDE(__reserved_for_stack_end__ = .); 245 | } > DTCMRAM 246 | 247 | DISCARD : 248 | { 249 | libc.a ( * ) 250 | libm.a ( * ) 251 | libgcc.a ( * ) 252 | } 253 | 254 | } 255 | 256 | -------------------------------------------------------------------------------- /util/sram_linker.lds: -------------------------------------------------------------------------------- 1 | /* Generated by LinkerScriptGenerator [http://visualgdb.com/tools/LinkerScriptGenerator] 2 | * Target: STM32H750IB 3 | * The file is provided under the BSD license. 4 | */ 5 | 6 | ENTRY(Reset_Handler) 7 | 8 | MEMORY 9 | { 10 | FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K 11 | DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K 12 | SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K 13 | RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K 14 | RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K 15 | RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K 16 | ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K 17 | SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M 18 | QSPIFLASH (RX): ORIGIN = 0x90040000, LENGTH = 7936K 19 | } 20 | 21 | _estack = 0x20020000; 22 | 23 | SECTIONS 24 | { 25 | .isr_vector : 26 | { 27 | . = ALIGN(4); 28 | KEEP(*(.isr_vector)) 29 | . = ALIGN(4); 30 | } > SRAM 31 | 32 | .text : 33 | { 34 | . = ALIGN(4); 35 | _stext = .; 36 | 37 | *(.text) 38 | *(.text*) 39 | *(.rodata) 40 | *(.rodata*) 41 | *(.glue_7) 42 | *(.glue_7t) 43 | KEEP(*(.init)) 44 | KEEP(*(.fini)) 45 | . = ALIGN(4); 46 | _etext = .; 47 | 48 | } > SRAM 49 | 50 | .ARM.extab : 51 | { 52 | . = ALIGN(4); 53 | *(.ARM.extab) 54 | *(.gnu.linkonce.armextab.*) 55 | . = ALIGN(4); 56 | } > SRAM 57 | 58 | .exidx : 59 | { 60 | . = ALIGN(4); 61 | PROVIDE(__exidx_start = .); 62 | *(.ARM.exidx*) 63 | . = ALIGN(4); 64 | PROVIDE(__exidx_end = .); 65 | } > SRAM 66 | 67 | .ARM.attributes : 68 | { 69 | *(.ARM.attributes) 70 | } > SRAM 71 | 72 | .preinit_array : 73 | { 74 | PROVIDE(__preinit_array_start = .); 75 | KEEP(*(.preinit_array*)) 76 | PROVIDE(__preinit_array_end = .); 77 | } > SRAM 78 | 79 | .init_array : 80 | { 81 | PROVIDE(__init_array_start = .); 82 | KEEP(*(SORT(.init_array.*))) 83 | KEEP(*(.init_array*)) 84 | PROVIDE(__init_array_end = .); 85 | } > SRAM 86 | 87 | .fini_array : 88 | { 89 | PROVIDE(__fini_array_start = .); 90 | KEEP(*(.fini_array*)) 91 | KEEP(*(SORT(.fini_array.*))) 92 | PROVIDE(__fini_array_end = .); 93 | } > SRAM 94 | 95 | .sram1_bss (NOLOAD) : 96 | { 97 | . = ALIGN(4); 98 | _ssram1_bss = .; 99 | 100 | PROVIDE(__sram1_bss_start__ = _sram1_bss); 101 | *(.sram1_bss) 102 | *(.sram1_bss*) 103 | . = ALIGN(4); 104 | _esram1_bss = .; 105 | 106 | PROVIDE(__sram1_bss_end__ = _esram1_bss); 107 | } > RAM_D2_DMA 108 | 109 | .data : 110 | { 111 | . = ALIGN(4); 112 | _sdata = .; 113 | 114 | PROVIDE(__data_start__ = _sdata); 115 | *(.data) 116 | *(.data*) 117 | . = ALIGN(4); 118 | _edata = .; 119 | 120 | PROVIDE(__data_end__ = _edata); 121 | } > DTCMRAM AT > SRAM 122 | 123 | _sidata = LOADADDR(.data); 124 | 125 | .bss (NOLOAD) : 126 | { 127 | . = ALIGN(4); 128 | _sbss = .; 129 | 130 | PROVIDE(__bss_start__ = _sbss); 131 | *(.bss) 132 | *(.bss*) 133 | *(COMMON) 134 | . = ALIGN(4); 135 | _ebss = .; 136 | 137 | PROVIDE(__bss_end__ = _ebss); 138 | } > DTCMRAM 139 | 140 | .dtcmram_bss (NOLOAD) : 141 | { 142 | . = ALIGN(4); 143 | _sdtcmram_bss = .; 144 | 145 | PROVIDE(__dtcmram_bss_start__ = _sdtcmram_bss); 146 | *(.dtcmram_bss) 147 | *(.dtcmram_bss*) 148 | . = ALIGN(4); 149 | _edtcmram_bss = .; 150 | 151 | PROVIDE(__dtcmram_bss_end__ = _edtcmram_bss); 152 | } > DTCMRAM 153 | 154 | /* 155 | .sdram_text : 156 | { 157 | . = ALIGN(4); 158 | _ssdram_text = .; 159 | 160 | PROVIDE(__sdram_text_start = _ssdram_text); 161 | *(.sdram_text) 162 | *(.sdram_text*) 163 | . = ALIGN(4); 164 | _esdram_text = .; 165 | 166 | PROVIDE(__sdram_text_end = _esdram_text); 167 | } > SDRAM AT >FLASH 168 | _sisdram_text = LOADADDR(.sdram_text); 169 | */ 170 | 171 | .sdram_bss (NOLOAD) : 172 | { 173 | . = ALIGN(4); 174 | _ssdram_bss = .; 175 | 176 | PROVIDE(__sdram_bss_start = _ssdram_bss); 177 | *(.sdram_bss) 178 | *(.sdram_bss*) 179 | . = ALIGN(4); 180 | _esdram_bss = .; 181 | 182 | PROVIDE(__sdram_bss_end = _esdram_bss); 183 | } > SDRAM 184 | 185 | 186 | .qspiflash_text : 187 | { 188 | . = ALIGN(4); 189 | _sqspiflash_text = .; 190 | 191 | PROVIDE(__qspiflash_text_start = _sqspiflash_text); 192 | *(.qspiflash_text) 193 | *(.qspiflash_text*) 194 | . = ALIGN(4); 195 | _eqspiflash_text = .; 196 | 197 | PROVIDE(__qspiflash_text_end = _eqspiflash_text); 198 | } > QSPIFLASH 199 | 200 | .qspiflash_data : 201 | { 202 | . = ALIGN(4); 203 | _sqspiflash_data = .; 204 | 205 | PROVIDE(__qspiflash_data_start = _sqspiflash_data); 206 | *(.qspiflash_data) 207 | *(.qspiflash_data*) 208 | . = ALIGN(4); 209 | _eqspiflash_data = .; 210 | 211 | PROVIDE(__qspiflash_data_end = _eqspiflash_data); 212 | } > QSPIFLASH 213 | 214 | .qspiflash_bss (NOLOAD) : 215 | { 216 | . = ALIGN(4); 217 | _sqspiflash_bss = .; 218 | 219 | PROVIDE(__qspiflash_bss_start = _sqspiflash_bss); 220 | *(.qspiflash_bss) 221 | *(.qspiflash_bss*) 222 | . = ALIGN(4); 223 | _eqspiflash_bss = .; 224 | 225 | PROVIDE(__qspiflash_bss_end = _eqspiflash_bss); 226 | } > QSPIFLASH 227 | 228 | .heap (NOLOAD) : 229 | { 230 | . = ALIGN(4); 231 | PROVIDE(__heap_start__ = .); 232 | KEEP(*(.heap)) 233 | . = ALIGN(4); 234 | PROVIDE(__heap_end__ = .); 235 | } > RAM_D2 236 | 237 | PROVIDE(end = .); 238 | 239 | .reserved_for_stack (NOLOAD) : 240 | { 241 | . = ALIGN(4); 242 | PROVIDE(__reserved_for_stack_start__ = .); 243 | KEEP(*(.reserved_for_stack)) 244 | . = ALIGN(4); 245 | PROVIDE(__reserved_for_stack_end__ = .); 246 | } > DTCMRAM 247 | 248 | DISCARD : 249 | { 250 | libc.a ( * ) 251 | libm.a ( * ) 252 | libgcc.a ( * ) 253 | } 254 | 255 | } 256 | 257 | -------------------------------------------------------------------------------- /util/sram_linker_sdram.lds: -------------------------------------------------------------------------------- 1 | /* Generated by LinkerScriptGenerator [http://visualgdb.com/tools/LinkerScriptGenerator] 2 | * Target: STM32H750IB 3 | * The file is provided under the BSD license. 4 | */ 5 | 6 | ENTRY(Reset_Handler) 7 | 8 | MEMORY 9 | { 10 | FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K 11 | DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K 12 | SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K 13 | RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K 14 | RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K 15 | RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K 16 | ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K 17 | SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M 18 | QSPIFLASH (RX): ORIGIN = 0x90040000, LENGTH = 7936K 19 | } 20 | 21 | _estack = 0x20020000; 22 | 23 | SECTIONS 24 | { 25 | .isr_vector : 26 | { 27 | . = ALIGN(4); 28 | KEEP(*(.isr_vector)) 29 | . = ALIGN(4); 30 | } > SRAM 31 | 32 | .text : 33 | { 34 | . = ALIGN(4); 35 | _stext = .; 36 | 37 | *(.text) 38 | *(.text*) 39 | *(.rodata) 40 | *(.rodata*) 41 | *(.glue_7) 42 | *(.glue_7t) 43 | KEEP(*(.init)) 44 | KEEP(*(.fini)) 45 | . = ALIGN(4); 46 | _etext = .; 47 | 48 | } > SRAM 49 | 50 | .ARM.extab : 51 | { 52 | . = ALIGN(4); 53 | *(.ARM.extab) 54 | *(.gnu.linkonce.armextab.*) 55 | . = ALIGN(4); 56 | } > SRAM 57 | 58 | .exidx : 59 | { 60 | . = ALIGN(4); 61 | PROVIDE(__exidx_start = .); 62 | *(.ARM.exidx*) 63 | . = ALIGN(4); 64 | PROVIDE(__exidx_end = .); 65 | } > SRAM 66 | 67 | .ARM.attributes : 68 | { 69 | *(.ARM.attributes) 70 | } > SRAM 71 | 72 | .preinit_array : 73 | { 74 | PROVIDE(__preinit_array_start = .); 75 | KEEP(*(.preinit_array*)) 76 | PROVIDE(__preinit_array_end = .); 77 | } > SRAM 78 | 79 | .init_array : 80 | { 81 | PROVIDE(__init_array_start = .); 82 | KEEP(*(SORT(.init_array.*))) 83 | KEEP(*(.init_array*)) 84 | PROVIDE(__init_array_end = .); 85 | } > SRAM 86 | 87 | .fini_array : 88 | { 89 | PROVIDE(__fini_array_start = .); 90 | KEEP(*(.fini_array*)) 91 | KEEP(*(SORT(.fini_array.*))) 92 | PROVIDE(__fini_array_end = .); 93 | } > SRAM 94 | 95 | .sram1_bss (NOLOAD) : 96 | { 97 | . = ALIGN(4); 98 | _ssram1_bss = .; 99 | 100 | PROVIDE(__sram1_bss_start__ = _sram1_bss); 101 | *(.sram1_bss) 102 | *(.sram1_bss*) 103 | . = ALIGN(4); 104 | _esram1_bss = .; 105 | 106 | PROVIDE(__sram1_bss_end__ = _esram1_bss); 107 | } > RAM_D2_DMA 108 | 109 | .data : 110 | { 111 | . = ALIGN(4); 112 | _sdata = .; 113 | 114 | PROVIDE(__data_start__ = _sdata); 115 | *(.data) 116 | *(.data*) 117 | . = ALIGN(4); 118 | _edata = .; 119 | 120 | PROVIDE(__data_end__ = _edata); 121 | } > DTCMRAM AT > SRAM 122 | 123 | _sidata = LOADADDR(.data); 124 | 125 | .bss (NOLOAD) : 126 | { 127 | . = ALIGN(4); 128 | _sbss = .; 129 | 130 | PROVIDE(__bss_start__ = _sbss); 131 | *(.bss) 132 | *(.bss*) 133 | *(COMMON) 134 | . = ALIGN(4); 135 | _ebss = .; 136 | 137 | PROVIDE(__bss_end__ = _ebss); 138 | } > RAM_D2 139 | 140 | .dtcmram_bss (NOLOAD) : 141 | { 142 | . = ALIGN(4); 143 | _sdtcmram_bss = .; 144 | 145 | PROVIDE(__dtcmram_bss_start__ = _sdtcmram_bss); 146 | *(.dtcmram_bss) 147 | *(.dtcmram_bss*) 148 | . = ALIGN(4); 149 | _edtcmram_bss = .; 150 | 151 | PROVIDE(__dtcmram_bss_end__ = _edtcmram_bss); 152 | } > DTCMRAM 153 | 154 | /* 155 | .sdram_text : 156 | { 157 | . = ALIGN(4); 158 | _ssdram_text = .; 159 | 160 | PROVIDE(__sdram_text_start = _ssdram_text); 161 | *(.sdram_text) 162 | *(.sdram_text*) 163 | . = ALIGN(4); 164 | _esdram_text = .; 165 | 166 | PROVIDE(__sdram_text_end = _esdram_text); 167 | } > SDRAM AT >FLASH 168 | _sisdram_text = LOADADDR(.sdram_text); 169 | */ 170 | 171 | /* To maintain compatibility, this section will remain. */ 172 | .sdram_bss (NOLOAD) : 173 | { 174 | . = ALIGN(4); 175 | _ssdram_bss = .; 176 | 177 | PROVIDE(__sdram_bss_start = _ssdram_bss); 178 | *(.sdram_bss) 179 | *(.sdram_bss*) 180 | . = ALIGN(4); 181 | _esdram_bss = .; 182 | 183 | PROVIDE(__sdram_bss_end = _esdram_bss); 184 | } > SDRAM 185 | 186 | 187 | .qspiflash_text : 188 | { 189 | . = ALIGN(4); 190 | _sqspiflash_text = .; 191 | 192 | PROVIDE(__qspiflash_text_start = _sqspiflash_text); 193 | *(.qspiflash_text) 194 | *(.qspiflash_text*) 195 | . = ALIGN(4); 196 | _eqspiflash_text = .; 197 | 198 | PROVIDE(__qspiflash_text_end = _eqspiflash_text); 199 | } > QSPIFLASH 200 | 201 | .qspiflash_data : 202 | { 203 | . = ALIGN(4); 204 | _sqspiflash_data = .; 205 | 206 | PROVIDE(__qspiflash_data_start = _sqspiflash_data); 207 | *(.qspiflash_data) 208 | *(.qspiflash_data*) 209 | . = ALIGN(4); 210 | _eqspiflash_data = .; 211 | 212 | PROVIDE(__qspiflash_data_end = _eqspiflash_data); 213 | } > QSPIFLASH 214 | 215 | .qspiflash_bss (NOLOAD) : 216 | { 217 | . = ALIGN(4); 218 | _sqspiflash_bss = .; 219 | 220 | PROVIDE(__qspiflash_bss_start = _sqspiflash_bss); 221 | *(.qspiflash_bss) 222 | *(.qspiflash_bss*) 223 | . = ALIGN(4); 224 | _eqspiflash_bss = .; 225 | 226 | PROVIDE(__qspiflash_bss_end = _eqspiflash_bss); 227 | } > QSPIFLASH 228 | 229 | .heap (NOLOAD) : 230 | { 231 | . = ALIGN(4); 232 | PROVIDE(__heap_start__ = .); 233 | KEEP(*(.heap)) 234 | . = ALIGN(4); 235 | PROVIDE(__heap_end__ = .); 236 | } > SDRAM 237 | 238 | PROVIDE(end = .); 239 | 240 | .reserved_for_stack (NOLOAD) : 241 | { 242 | . = ALIGN(4); 243 | PROVIDE(__reserved_for_stack_start__ = .); 244 | KEEP(*(.reserved_for_stack)) 245 | . = ALIGN(4); 246 | PROVIDE(__reserved_for_stack_end__ = .); 247 | } > DTCMRAM 248 | 249 | DISCARD : 250 | { 251 | libc.a ( * ) 252 | libm.a ( * ) 253 | libgcc.a ( * ) 254 | } 255 | 256 | } 257 | 258 | -------------------------------------------------------------------------------- /util/qspi_linker.lds: -------------------------------------------------------------------------------- 1 | /* Generated by LinkerScriptGenerator [http://visualgdb.com/tools/LinkerScriptGenerator] 2 | * Target: STM32H750IB 3 | * The file is provided under the BSD license. 4 | * yeah okay but i also modified it a lot so like, give me some credit too mr BSD 5 | */ 6 | 7 | ENTRY(Reset_Handler) 8 | 9 | MEMORY 10 | { 11 | FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K 12 | DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K 13 | SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K 14 | RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K 15 | RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K 16 | RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K 17 | ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K 18 | SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M 19 | QSPIFLASH (RX): ORIGIN = 0x90040000, LENGTH = 7936K 20 | } 21 | 22 | _estack = 0x20020000; 23 | 24 | SECTIONS 25 | { 26 | .isr_vector : 27 | { 28 | . = ALIGN(4); 29 | KEEP(*(.isr_vector)) 30 | . = ALIGN(4); 31 | } > QSPIFLASH 32 | 33 | .text : 34 | { 35 | . = ALIGN(4); 36 | _stext = .; 37 | 38 | *(.text) 39 | *(.text*) 40 | *(.rodata) 41 | *(.rodata*) 42 | *(.glue_7) 43 | *(.glue_7t) 44 | KEEP(*(.init)) 45 | KEEP(*(.fini)) 46 | . = ALIGN(4); 47 | _etext = .; 48 | 49 | } > QSPIFLASH 50 | 51 | .ARM.extab : 52 | { 53 | . = ALIGN(4); 54 | *(.ARM.extab) 55 | *(.gnu.linkonce.armextab.*) 56 | . = ALIGN(4); 57 | } > QSPIFLASH 58 | 59 | .exidx : 60 | { 61 | . = ALIGN(4); 62 | PROVIDE(__exidx_start = .); 63 | *(.ARM.exidx*) 64 | . = ALIGN(4); 65 | PROVIDE(__exidx_end = .); 66 | } > QSPIFLASH 67 | 68 | .ARM.attributes : 69 | { 70 | *(.ARM.attributes) 71 | } > QSPIFLASH 72 | 73 | .preinit_array : 74 | { 75 | PROVIDE(__preinit_array_start = .); 76 | KEEP(*(.preinit_array*)) 77 | PROVIDE(__preinit_array_end = .); 78 | } > QSPIFLASH 79 | 80 | .init_array : 81 | { 82 | PROVIDE(__init_array_start = .); 83 | KEEP(*(SORT(.init_array.*))) 84 | KEEP(*(.init_array*)) 85 | PROVIDE(__init_array_end = .); 86 | } > QSPIFLASH 87 | 88 | .fini_array : 89 | { 90 | PROVIDE(__fini_array_start = .); 91 | KEEP(*(.fini_array*)) 92 | KEEP(*(SORT(.fini_array.*))) 93 | PROVIDE(__fini_array_end = .); 94 | } > QSPIFLASH 95 | 96 | .sram1_bss (NOLOAD) : 97 | { 98 | . = ALIGN(4); 99 | _ssram1_bss = .; 100 | 101 | PROVIDE(__sram1_bss_start__ = _sram1_bss); 102 | *(.sram1_bss) 103 | *(.sram1_bss*) 104 | . = ALIGN(4); 105 | _esram1_bss = .; 106 | 107 | PROVIDE(__sram1_bss_end__ = _esram1_bss); 108 | } > RAM_D2_DMA 109 | 110 | .data : 111 | { 112 | . = ALIGN(4); 113 | _sdata = .; 114 | 115 | PROVIDE(__data_start__ = _sdata); 116 | *(.data) 117 | *(.data*) 118 | . = ALIGN(4); 119 | _edata = .; 120 | 121 | PROVIDE(__data_end__ = _edata); 122 | } > SRAM AT > QSPIFLASH 123 | 124 | _sidata = LOADADDR(.data); 125 | 126 | .bss (NOLOAD) : 127 | { 128 | . = ALIGN(4); 129 | _sbss = .; 130 | 131 | PROVIDE(__bss_start__ = _sbss); 132 | *(.bss) 133 | *(.bss*) 134 | *(COMMON) 135 | . = ALIGN(4); 136 | _ebss = .; 137 | 138 | PROVIDE(__bss_end__ = _ebss); 139 | } > SRAM 140 | 141 | .dtcmram_bss (NOLOAD) : 142 | { 143 | . = ALIGN(4); 144 | _sdtcmram_bss = .; 145 | 146 | PROVIDE(__dtcmram_bss_start__ = _sdtcmram_bss); 147 | *(.dtcmram_bss) 148 | *(.dtcmram_bss*) 149 | . = ALIGN(4); 150 | _edtcmram_bss = .; 151 | 152 | PROVIDE(__dtcmram_bss_end__ = _edtcmram_bss); 153 | } > DTCMRAM 154 | 155 | /* 156 | .sdram_text : 157 | { 158 | . = ALIGN(4); 159 | _ssdram_text = .; 160 | 161 | PROVIDE(__sdram_text_start = _ssdram_text); 162 | *(.sdram_text) 163 | *(.sdram_text*) 164 | . = ALIGN(4); 165 | _esdram_text = .; 166 | 167 | PROVIDE(__sdram_text_end = _esdram_text); 168 | } > SDRAM AT >FLASH 169 | _sisdram_text = LOADADDR(.sdram_text); 170 | */ 171 | 172 | .sdram_bss (NOLOAD) : 173 | { 174 | . = ALIGN(4); 175 | _ssdram_bss = .; 176 | 177 | PROVIDE(__sdram_bss_start = _ssdram_bss); 178 | *(.sdram_bss) 179 | *(.sdram_bss*) 180 | . = ALIGN(4); 181 | _esdram_bss = .; 182 | 183 | PROVIDE(__sdram_bss_end = _esdram_bss); 184 | } > SDRAM 185 | 186 | 187 | /* .qspiflash_text : 188 | { 189 | . = ALIGN(4); 190 | _sqspiflash_text = .; 191 | 192 | PROVIDE(__qspiflash_text_start = _sqspiflash_text); 193 | *(.qspiflash_text) 194 | *(.qspiflash_text*) 195 | . = ALIGN(4); 196 | _eqspiflash_text = .; 197 | 198 | PROVIDE(__qspiflash_text_end = _eqspiflash_text); 199 | } > QSPIFLASH 200 | 201 | .qspiflash_data : 202 | { 203 | . = ALIGN(4); 204 | _sqspiflash_data = .; 205 | 206 | PROVIDE(__qspiflash_data_start = _sqspiflash_data); 207 | *(.qspiflash_data) 208 | *(.qspiflash_data*) 209 | . = ALIGN(4); 210 | _eqspiflash_data = .; 211 | 212 | PROVIDE(__qspiflash_data_end = _eqspiflash_data); 213 | } > QSPIFLASH 214 | 215 | .qspiflash_bss (NOLOAD) : 216 | { 217 | . = ALIGN(4); 218 | _sqspiflash_bss = .; 219 | 220 | PROVIDE(__qspiflash_bss_start = _sqspiflash_bss); 221 | *(.qspiflash_bss) 222 | *(.qspiflash_bss*) 223 | . = ALIGN(4); 224 | _eqspiflash_bss = .; 225 | 226 | PROVIDE(__qspiflash_bss_end = _eqspiflash_bss); 227 | } > QSPIFLASH */ 228 | 229 | .heap (NOLOAD) : 230 | { 231 | . = ALIGN(4); 232 | PROVIDE(__heap_start__ = .); 233 | KEEP(*(.heap)) 234 | . = ALIGN(4); 235 | PROVIDE(__heap_end__ = .); 236 | } > SRAM 237 | 238 | PROVIDE(end = .); 239 | 240 | .reserved_for_stack (NOLOAD) : 241 | { 242 | . = ALIGN(4); 243 | PROVIDE(__reserved_for_stack_start__ = .); 244 | KEEP(*(.reserved_for_stack)) 245 | . = ALIGN(4); 246 | PROVIDE(__reserved_for_stack_end__ = .); 247 | } > DTCMRAM 248 | 249 | DISCARD : 250 | { 251 | libc.a ( * ) 252 | libm.a ( * ) 253 | libgcc.a ( * ) 254 | } 255 | 256 | } -------------------------------------------------------------------------------- /util/qspi_linker_sdram.lds: -------------------------------------------------------------------------------- 1 | /* Generated by LinkerScriptGenerator [http://visualgdb.com/tools/LinkerScriptGenerator] 2 | * Target: STM32H750IB 3 | * The file is provided under the BSD license. 4 | * yeah okay but i also modified it a lot so like, give me some credit too mr BSD 5 | */ 6 | 7 | ENTRY(Reset_Handler) 8 | 9 | MEMORY 10 | { 11 | FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 128K 12 | DTCMRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 128K 13 | SRAM (RWX) : ORIGIN = 0x24000000, LENGTH = 512K 14 | RAM_D2_DMA (RWX) : ORIGIN = 0x30000000, LENGTH = 32K 15 | RAM_D2 (RWX) : ORIGIN = 0x30008000, LENGTH = 256K 16 | RAM_D3 (RWX) : ORIGIN = 0x38000000, LENGTH = 64K 17 | ITCMRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 64K 18 | SDRAM (RWX) : ORIGIN = 0xc0000000, LENGTH = 64M 19 | QSPIFLASH (RX): ORIGIN = 0x90040000, LENGTH = 7936K 20 | } 21 | 22 | _estack = 0x20020000; 23 | 24 | SECTIONS 25 | { 26 | .isr_vector : 27 | { 28 | . = ALIGN(4); 29 | KEEP(*(.isr_vector)) 30 | . = ALIGN(4); 31 | } > QSPIFLASH 32 | 33 | .text : 34 | { 35 | . = ALIGN(4); 36 | _stext = .; 37 | 38 | *(.text) 39 | *(.text*) 40 | *(.rodata) 41 | *(.rodata*) 42 | *(.glue_7) 43 | *(.glue_7t) 44 | KEEP(*(.init)) 45 | KEEP(*(.fini)) 46 | . = ALIGN(4); 47 | _etext = .; 48 | 49 | } > QSPIFLASH 50 | 51 | .ARM.extab : 52 | { 53 | . = ALIGN(4); 54 | *(.ARM.extab) 55 | *(.gnu.linkonce.armextab.*) 56 | . = ALIGN(4); 57 | } > QSPIFLASH 58 | 59 | .exidx : 60 | { 61 | . = ALIGN(4); 62 | PROVIDE(__exidx_start = .); 63 | *(.ARM.exidx*) 64 | . = ALIGN(4); 65 | PROVIDE(__exidx_end = .); 66 | } > QSPIFLASH 67 | 68 | .ARM.attributes : 69 | { 70 | *(.ARM.attributes) 71 | } > QSPIFLASH 72 | 73 | .preinit_array : 74 | { 75 | PROVIDE(__preinit_array_start = .); 76 | KEEP(*(.preinit_array*)) 77 | PROVIDE(__preinit_array_end = .); 78 | } > QSPIFLASH 79 | 80 | .init_array : 81 | { 82 | PROVIDE(__init_array_start = .); 83 | KEEP(*(SORT(.init_array.*))) 84 | KEEP(*(.init_array*)) 85 | PROVIDE(__init_array_end = .); 86 | } > QSPIFLASH 87 | 88 | .fini_array : 89 | { 90 | PROVIDE(__fini_array_start = .); 91 | KEEP(*(.fini_array*)) 92 | KEEP(*(SORT(.fini_array.*))) 93 | PROVIDE(__fini_array_end = .); 94 | } > QSPIFLASH 95 | 96 | .sram1_bss (NOLOAD) : 97 | { 98 | . = ALIGN(4); 99 | _ssram1_bss = .; 100 | 101 | PROVIDE(__sram1_bss_start__ = _sram1_bss); 102 | *(.sram1_bss) 103 | *(.sram1_bss*) 104 | . = ALIGN(4); 105 | _esram1_bss = .; 106 | 107 | PROVIDE(__sram1_bss_end__ = _esram1_bss); 108 | } > RAM_D2_DMA 109 | 110 | .data : 111 | { 112 | . = ALIGN(4); 113 | _sdata = .; 114 | 115 | PROVIDE(__data_start__ = _sdata); 116 | *(.data) 117 | *(.data*) 118 | . = ALIGN(4); 119 | _edata = .; 120 | 121 | PROVIDE(__data_end__ = _edata); 122 | } > SRAM AT > QSPIFLASH 123 | 124 | _sidata = LOADADDR(.data); 125 | 126 | .bss (NOLOAD) : 127 | { 128 | . = ALIGN(4); 129 | _sbss = .; 130 | 131 | PROVIDE(__bss_start__ = _sbss); 132 | *(.bss) 133 | *(.bss*) 134 | *(COMMON) 135 | . = ALIGN(4); 136 | _ebss = .; 137 | 138 | PROVIDE(__bss_end__ = _ebss); 139 | } > SRAM 140 | 141 | .dtcmram_bss (NOLOAD) : 142 | { 143 | . = ALIGN(4); 144 | _sdtcmram_bss = .; 145 | 146 | PROVIDE(__dtcmram_bss_start__ = _sdtcmram_bss); 147 | *(.dtcmram_bss) 148 | *(.dtcmram_bss*) 149 | . = ALIGN(4); 150 | _edtcmram_bss = .; 151 | 152 | PROVIDE(__dtcmram_bss_end__ = _edtcmram_bss); 153 | } > DTCMRAM 154 | 155 | /* 156 | .sdram_text : 157 | { 158 | . = ALIGN(4); 159 | _ssdram_text = .; 160 | 161 | PROVIDE(__sdram_text_start = _ssdram_text); 162 | *(.sdram_text) 163 | *(.sdram_text*) 164 | . = ALIGN(4); 165 | _esdram_text = .; 166 | 167 | PROVIDE(__sdram_text_end = _esdram_text); 168 | } > SDRAM AT >FLASH 169 | _sisdram_text = LOADADDR(.sdram_text); 170 | */ 171 | 172 | .sdram_bss (NOLOAD) : 173 | { 174 | . = ALIGN(4); 175 | _ssdram_bss = .; 176 | 177 | PROVIDE(__sdram_bss_start = _ssdram_bss); 178 | *(.sdram_bss) 179 | *(.sdram_bss*) 180 | . = ALIGN(4); 181 | _esdram_bss = .; 182 | 183 | PROVIDE(__sdram_bss_end = _esdram_bss); 184 | } > SDRAM 185 | 186 | 187 | /* .qspiflash_text : 188 | { 189 | . = ALIGN(4); 190 | _sqspiflash_text = .; 191 | 192 | PROVIDE(__qspiflash_text_start = _sqspiflash_text); 193 | *(.qspiflash_text) 194 | *(.qspiflash_text*) 195 | . = ALIGN(4); 196 | _eqspiflash_text = .; 197 | 198 | PROVIDE(__qspiflash_text_end = _eqspiflash_text); 199 | } > QSPIFLASH 200 | 201 | .qspiflash_data : 202 | { 203 | . = ALIGN(4); 204 | _sqspiflash_data = .; 205 | 206 | PROVIDE(__qspiflash_data_start = _sqspiflash_data); 207 | *(.qspiflash_data) 208 | *(.qspiflash_data*) 209 | . = ALIGN(4); 210 | _eqspiflash_data = .; 211 | 212 | PROVIDE(__qspiflash_data_end = _eqspiflash_data); 213 | } > QSPIFLASH 214 | 215 | .qspiflash_bss (NOLOAD) : 216 | { 217 | . = ALIGN(4); 218 | _sqspiflash_bss = .; 219 | 220 | PROVIDE(__qspiflash_bss_start = _sqspiflash_bss); 221 | *(.qspiflash_bss) 222 | *(.qspiflash_bss*) 223 | . = ALIGN(4); 224 | _eqspiflash_bss = .; 225 | 226 | PROVIDE(__qspiflash_bss_end = _eqspiflash_bss); 227 | } > QSPIFLASH */ 228 | 229 | .heap (NOLOAD) : 230 | { 231 | . = ALIGN(4); 232 | PROVIDE(__heap_start__ = .); 233 | KEEP(*(.heap)) 234 | . = ALIGN(4); 235 | PROVIDE(__heap_end__ = .); 236 | } > SDRAM 237 | 238 | PROVIDE(end = .); 239 | 240 | .reserved_for_stack (NOLOAD) : 241 | { 242 | . = ALIGN(4); 243 | PROVIDE(__reserved_for_stack_start__ = .); 244 | KEEP(*(.reserved_for_stack)) 245 | . = ALIGN(4); 246 | PROVIDE(__reserved_for_stack_end__ = .); 247 | } > DTCMRAM 248 | 249 | DISCARD : 250 | { 251 | libc.a ( * ) 252 | libm.a ( * ) 253 | libgcc.a ( * ) 254 | } 255 | 256 | } -------------------------------------------------------------------------------- /pd2dsy_gui.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import threading 4 | from sys import platform 5 | import tkinter as tk 6 | from tkinter import ttk 7 | import sv_ttk 8 | import darkdetect 9 | 10 | import pd2dsy 11 | import dsy_gui 12 | 13 | # USE_DARK_THEME = darkdetect.isDark() and not (platform == 'linux') 14 | USE_DARK_THEME = darkdetect.isDark() 15 | PROJECT_DIRECTORY = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) 16 | 17 | LOG_PATH = os.path.join(PROJECT_DIRECTORY, 'pd2dsy_build.txt') 18 | 19 | root = tk.Tk() 20 | 21 | upper_frame = ttk.Frame(root, padding="3 3 12 12") 22 | lower_frame = ttk.Frame(root, padding="5 5 5 5") 23 | 24 | status_style = ttk.Style() 25 | status_frame = ttk.Frame(root) 26 | 27 | upper_frame.pack(fill=tk.BOTH, expand=False) 28 | lower_frame.pack(fill=tk.BOTH, expand=True) 29 | status_frame.pack(fill=tk.BOTH, anchor=tk.S) 30 | 31 | # Top bar 32 | menubar = tk.Menu(root) 33 | filemenu = tk.Menu(menubar, tearoff=0) 34 | config_name = os.path.join(PROJECT_DIRECTORY, 'pd2dsy_config.json') 35 | 36 | examples_dir = os.path.join(PROJECT_DIRECTORY, 'examples', 'gui_projects') 37 | project_examples = ( 38 | ('Field example', os.path.join(examples_dir, 'field', 'field_example.pd2dsy')), 39 | ('Patch example', os.path.join(examples_dir, 'patch', 'patch_example.pd2dsy')), 40 | ('patch.init() example', os.path.join(examples_dir, 'patch_init', 'patch_init_example.pd2dsy')), 41 | ('Petal example', os.path.join(examples_dir, 'petal', 'petal_example.pd2dsy')), 42 | ('Pod example', os.path.join(examples_dir, 'pod', 'pod_example.pd2dsy')), 43 | ) 44 | project_manager = dsy_gui.ProjectManager(root, filemenu, window_title='pd2dsy', 45 | configuration_file=config_name, examples=project_examples) 46 | menubar.add_cascade(label="File", menu=filemenu) 47 | 48 | # helpmenu = tk.Menu(menubar, tearoff=0) 49 | # helpmenu.add_command(label="Help Index", command=lambda: 0) 50 | # helpmenu.add_command(label="About...", command=lambda: 0) 51 | # menubar.add_cascade(label="Help", menu=helpmenu) 52 | 53 | root.config(menu=menubar) 54 | 55 | # Status bar 56 | status_bar = dsy_gui.StatusBarWrapper(status_frame, darktheme_override=USE_DARK_THEME) 57 | 58 | # Main UI elements 59 | pd_browser = dsy_gui.FileBrowserWrapper(upper_frame, 0, 0, 'Pd File', id='w1', 60 | filetypes=(('Pd file', '*.pd'), ('all files', '*.*'))) 61 | 62 | json_browser = dsy_gui.FileBrowserWrapper(upper_frame, 3, 0, 'Custom JSON', id='w6', 63 | filetypes=(('JSON file', '*.json'), ('all files', '*.*'))) 64 | 65 | def board_dropdown_callback(value): 66 | json_browser.enable(value == 'Custom') 67 | 68 | board_dropdown_options = pd2dsy.BOARDLIST 69 | board_dropdown_options.append('custom') 70 | board_dropdown_options = [name.replace('_', ' ').capitalize() for name in board_dropdown_options] 71 | board_dropdown_translation = {name: original for name, original in zip(board_dropdown_options, pd2dsy.BOARDLIST)} 72 | 73 | board_dropdown = dsy_gui.OptionWrapper(upper_frame, 0, 2, 'Board', board_dropdown_options, id='w2', 74 | callback=board_dropdown_callback) 75 | 76 | ram_options = dsy_gui.RadioWrapper(upper_frame, 0, 4, 'RAM Option', ('Speed', 'Size'), id='w3') 77 | 78 | terminal_output = dsy_gui.TextFieldWrapper(lower_frame) 79 | 80 | output_browser = dsy_gui.FileBrowserWrapper(upper_frame, 0, 7, 'Output Folder', files=False, id='w5') 81 | 82 | def print_error(error, message): 83 | terminal_output.append('Error: ', color="#df3626") 84 | terminal_output.append(error + '\n', color='#59b8f7') 85 | terminal_output.append(message + '\n') 86 | 87 | BUILD_ERRORS = { 88 | 'cannot find -ldaisy': f"""This probably means you haven't compiled 89 | libDaisy. The libDaisy folder this program 90 | uses is located in {os.path.join(PROJECT_DIRECTORY, 'libdaisy')}. 91 | If you open this path up in your terminal 92 | (type in "cd {os.path.join(PROJECT_DIRECTORY, 'libdaisy')}" 93 | without the quotes and hit enter), then 94 | type in "make" without quotes and hit enter, 95 | you should be able to build libDaisy without 96 | a problem.""", 97 | 'region .+? overflowed by .+? bytes': f"""This probably means your Pd patch 98 | is too large for the settings you've chosen. 99 | If your ROM option is set to "Speed", 100 | consider using "Size." 101 | (If you're already using "Size", post 102 | about it on the Daisy forum and ask 103 | for bigger sizes!)""", 104 | '^.+?: .+?: not found': f"""This probably means you 105 | don't have the Daisy toolchain installed. 106 | You can find instructions on how to install 107 | it here: https://github.com/electro-smith/DaisyWiki/wiki/1.-Setting-Up-Your-Development-Environment#1-Install-the-Toolchain""" 108 | } 109 | 110 | NORMAL_FLASH_ERRORS = { 111 | 'No DFU capable USB device available': f"""This probably means your daisy isn't 112 | in DFU mode. For the normal system bootloader, 113 | you can enter DFU mode by holding the BOOT button 114 | down and then pressing the RESET button. Then once 115 | you release the RESET button, you can also let go of 116 | the BOOT button.""", 117 | 'Last page at 0x9[A-Fa-f0-9]+? is not writeable': f"""This probably means you're attempting 118 | to write Daisy Bootloader programs to the 119 | normal system bootloader (ROM option set to 120 | size). If you want to flash programs to the 121 | Daisy bootloader, ensure that you flash the 122 | bootloader itself first.""", 123 | 'Last page at 0x08[A-Fa-f0-9]+? is not writeable': f"""This probably means you're attempting 124 | to write a normal Daisy program to the Daisy 125 | bootloader. When using the Daisy bootloader, 126 | make sure your ROM is set to "Size." If you 127 | don't want to use the Daisy bootloader, 128 | simply overwrite it with your program by 129 | entering the normal system bootloader.""" 130 | } 131 | 132 | BOOTLOADER_FLASH_ERRORS = { 133 | 'No DFU capable USB device available': f"""This probably means your daisy isn't 134 | in DFU mode. For the Daisy bootloader, 135 | simply restart the device (press and release 136 | the RESET button) and you'll enter DFU mode. 137 | It only lasts a couple seconds before entering 138 | your application, however, so you can extend 139 | this period by presssing the BOOT button 140 | shortly after reset. The daisy bootloader 141 | can be identified by the pulsing USER_LED.""", 142 | 'Last page at 0x9[A-Fa-f0-9]+? is not writeable': f"""This probably means you're attempting 143 | to write Daisy Bootloader programs to the 144 | normal system bootloader (ROM option set to 145 | size). If you want to flash programs to the 146 | Daisy bootloader, ensure that you flash the 147 | bootloader itself first.""", 148 | 'Last page at 0x08[A-Fa-f0-9]+? is not writeable': f"""This probably means you're attempting 149 | to write a normal Daisy program to the Daisy 150 | bootloader. When using the Daisy bootloader, 151 | make sure your ROM is set to "Size." If you 152 | don't want to use the Daisy bootloader, 153 | simply overwrite it with your program by 154 | entering the normal system bootloader.""" 155 | } 156 | 157 | 158 | def check_for_common_errors(error_dict, logfile, spurious_errors=['Error during download get_status']): 159 | errors = [] 160 | 161 | compiled_errors = [] 162 | for error, message in error_dict.items(): 163 | error_re = re.compile(error) 164 | compiled_errors.append([error_re, message]) 165 | 166 | compiled_spurious = [] 167 | for error in spurious_errors: 168 | error_re = re.compile(error) 169 | compiled_spurious.append(error_re) 170 | 171 | with open(logfile, 'r') as file: 172 | for line in file: 173 | for error, response in compiled_errors: 174 | match = error.search(line) 175 | if match is not None: 176 | errors.append([match.group(0), response]) 177 | for error in compiled_spurious: 178 | match = error.search(line) 179 | if match is not None: 180 | return None 181 | 182 | # If no errors are found, the user may need to get involved 183 | if len(errors) == 0: 184 | errors.append(['unkown error', f"""If your problem persists, 185 | check the log file at "{LOG_PATH}" 186 | to check for errors and consider posting 187 | it to the Daisy Forum."""]) 188 | 189 | return errors 190 | 191 | 192 | def bootloader_thread(): 193 | terminal_output.append("Flashing daisy bootloader...\n") 194 | return_code, logfile = pd2dsy.flash_bootloader(LOG_PATH) 195 | 196 | if return_code: 197 | errors = check_for_common_errors(NORMAL_FLASH_ERRORS, logfile) 198 | if errors is not None: 199 | for error, response in errors: 200 | print_error(error, response) 201 | 202 | terminal_output.append('\n') 203 | return 204 | 205 | terminal_output.append("Daisy bootloader successfully flashed!\n\n") 206 | 207 | 208 | def bootloader(): 209 | thread = threading.Thread(target=bootloader_thread) 210 | thread.start() 211 | 212 | flash_bootloader = dsy_gui.ButtonWrapper(upper_frame, 0, 9, 'Flash Bootloader', bootloader) 213 | 214 | def rom_callback(value): 215 | is_size = value == 'Size' 216 | flash_bootloader.enable(is_size) 217 | ram_options.enable(is_size) 218 | if not is_size: 219 | ram_options.variable.set('Speed') 220 | 221 | rom_options = dsy_gui.RadioWrapper(upper_frame, 1, 4, 'ROM Option', ('Speed', 'Size'), id='w4', callback=rom_callback) 222 | 223 | 224 | def compile_thread(): 225 | inputs = { 226 | 'pd_input': pd_browser.get_value(), 227 | 'board': board_dropdown_translation.get(board_dropdown.get_value(), None), 228 | 'custom_json': json_browser.get_value(), 229 | 'search_paths': [], 230 | 'directory': output_browser.get_value(), 231 | 'force': True, 232 | 'ram': ram_options.get_value().lower(), 233 | 'rom': rom_options.get_value().lower(), 234 | 'no_build': False, 235 | 'log': LOG_PATH, 236 | } 237 | 238 | encountered_error = False 239 | 240 | # Validate arguments 241 | if inputs['pd_input'] == '': 242 | print_error("file error", "Please provide an input Pd file.") 243 | encountered_error = True 244 | elif not os.path.exists(inputs['pd_input']): 245 | print_error("file error", f"unable to open Pd file at \"{inputs['pd_input']}\"") 246 | encountered_error = True 247 | 248 | if board_dropdown.get_value() == 'Custom': 249 | if inputs['custom_json'] == '': 250 | print_error("file error", "Please provide a custom JSON file.") 251 | encountered_error = True 252 | elif not os.path.exists(inputs['custom_json']): 253 | print_error("file error", f"unable to open JSON file at \"{inputs['custom_json']}\"") 254 | encountered_error = True 255 | 256 | if inputs['directory'] != '': 257 | # if not os.path.exists(inputs['directory']): 258 | # print_error("unable to open selected output ") 259 | # return 260 | pass 261 | else: 262 | inputs['directory'] = os.path.dirname(inputs['pd_input']) 263 | 264 | if encountered_error: 265 | # terminal_output.append('\n') 266 | return 267 | 268 | terminal_output.append('Compiling...\n') 269 | 270 | args = pd2dsy.InputObject(**inputs) 271 | try: 272 | output, meta, linker_file, args = pd2dsy.run_hvcc(args) 273 | return_code, main_file, logfile = pd2dsy.compile_project(output, meta, linker_file, args) 274 | if return_code: 275 | errors = check_for_common_errors(BUILD_ERRORS, logfile) 276 | 277 | if errors is not None: 278 | for error, response in errors: 279 | print_error(error, response) 280 | 281 | terminal_output.append('\n') 282 | return 283 | 284 | terminal_output.append("Flashing Daisy...\n") 285 | 286 | return_code, logfile = pd2dsy.flash_project(output, meta, main_file, args) 287 | if return_code: 288 | error_dict = BOOTLOADER_FLASH_ERRORS if args.rom != 'speed' else NORMAL_FLASH_ERRORS 289 | errors = check_for_common_errors(error_dict, logfile) 290 | if errors is not None: 291 | for error, response in errors: 292 | print_error(error, response) 293 | 294 | terminal_output.append('\n') 295 | return 296 | 297 | terminal_output.append('Daisy successfully flashed!\n\n') 298 | 299 | except Exception as e: 300 | # An exception almost certainly means an hvcc generated error 301 | terminal_output.append('Pd translation error:\n', color="#df3626") 302 | terminal_output.append(str(e) + '\n') 303 | 304 | def compile(): 305 | thread = threading.Thread(target=compile_thread) 306 | thread.start() 307 | 308 | compile_button = dsy_gui.ButtonWrapper(upper_frame, 0, 10, 'Flash Program', compile) 309 | 310 | for child in upper_frame.winfo_children(): 311 | child.grid_configure(padx=5, pady=5) 312 | 313 | project_manager.set_file_browsers([pd_browser, output_browser, json_browser]) 314 | project_manager.set_saveable_wrappers([pd_browser, output_browser, json_browser, board_dropdown, ram_options, rom_options]) 315 | project_manager.startup() 316 | 317 | if USE_DARK_THEME: 318 | sv_ttk.use_dark_theme() 319 | else: 320 | sv_ttk.use_light_theme() 321 | 322 | root.update() 323 | root.update() 324 | # After one update cycle, we can set the initial rendered size as the minimum 325 | # root.minsize(root.winfo_width(), root.winfo_height()) 326 | root.minsize(500, 550) 327 | 328 | root.mainloop() -------------------------------------------------------------------------------- /pd2dsy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import pathlib 5 | import re 6 | import time 7 | import json 8 | import sys 9 | import argparse 10 | import subprocess 11 | import shutil 12 | import hvcc 13 | 14 | BOARDLIST = ['pod', 'patch', 'patch_init', 'field', 'petal'] 15 | PD2DSY_DIRECTORY = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) 16 | 17 | class Colours: 18 | purple = "\033[95m" 19 | cyan = "\033[96m" 20 | dark_cyan = "\033[36m" 21 | blue = "\033[94m" 22 | green = "\033[92m" 23 | yellow = "\033[93m" 24 | red = "\033[91m" 25 | bold = "\033[1m" 26 | underline = "\033[4m" 27 | end = "\033[0m" 28 | 29 | class InputObject: 30 | def __init__(self, pd_input, **kwargs): 31 | self.pd_input = pd_input 32 | self.board = kwargs.get('board', BOARDLIST[0]) 33 | self.custom_json = kwargs.get('custom_json', None) 34 | self.search_paths = kwargs.get('search_paths', None) 35 | self.directory = kwargs.get('directory', None) 36 | self.force = kwargs.get('force', False) 37 | self.ram = kwargs.get('ram', 'speed') 38 | self.rom = kwargs.get('rom', 'speed') 39 | self.libdaisy_path = kwargs.get('libdaisy_path', None) 40 | self.no_build = kwargs.get('no_build', False) 41 | self.log = kwargs.get('log', None) 42 | self.flash_bootloader = kwargs.get('flash_bootloader', False) 43 | 44 | # # Note -- this probably already exists as a module, but here's mine 45 | def queryUser(prompt, fallback='n'): 46 | trueTuple = ('y', 'yes') 47 | falseTuple = ('n', 'no') 48 | if fallback.lower() in trueTuple: 49 | response = input(prompt + ' [Y/n] ') 50 | return response.lower().strip() not in falseTuple 51 | elif fallback.lower() in falseTuple: 52 | response = input(prompt + ' [y/N] ') 53 | return response.lower().strip() in trueTuple 54 | else: 55 | response = input(prompt + ' [y/n] ') 56 | while (response.lower().strip() not in ('y', 'yes', 'n', 'no')): 57 | response = input(prompt + 'please provide a valid yes/no input ') 58 | return True if response.lower().strip() in trueTuple else False 59 | 60 | 61 | def halt(): 62 | print('No files generated.') 63 | sys.exit(1) 64 | 65 | 66 | def to_posix(input_path): 67 | return str(pathlib.PureWindowsPath(input_path).as_posix()) 68 | 69 | 70 | def construct_relative_libdaisy_path(libdaisy, output): 71 | relative_path = os.path.relpath(output, libdaisy) 72 | return to_posix(relative_path) 73 | 74 | 75 | def run_hvcc(args): 76 | tick = time.time() 77 | 78 | inpath = os.path.abspath(args.pd_input) 79 | search_paths = args.search_paths or [] 80 | copyright = "" 81 | 82 | results = {} 83 | verbose = False 84 | 85 | basename = os.path.basename(inpath).split('.')[0] 86 | parent = args.directory 87 | output = os.path.normpath(os.path.join(parent, basename)) 88 | 89 | if args.libdaisy_path is None: 90 | args.libdaisy_path = os.path.join(PD2DSY_DIRECTORY, 'libdaisy') 91 | 92 | args.libdaisy_path = os.path.normpath(args.libdaisy_path) 93 | 94 | if os.path.isdir(output) and os.path.exists(output) and not args.force: 95 | if queryUser(f'"{output}" already exists. Overwrite?'): 96 | pass 97 | else: 98 | halt() 99 | 100 | print(f'Generating project in "{output}"') 101 | 102 | if args.custom_json == '': 103 | args.custom_json = os.path.normpath(args.custom_json) 104 | if args.board is None: 105 | print(f'{Colours.red}Error:{Colours.end} when not using custom JSON (-c), the board must be specified (-b)') 106 | halt() 107 | else: 108 | meta = {"daisy": {"board": args.board}} 109 | else: 110 | try: 111 | with open(args.custom_json, 'rb') as file: 112 | custom_json = json.load(file) 113 | except FileNotFoundError: 114 | print(f'{Colours.red}Error:{Colours.end} unable to open custom json file "{args.custom_json}"') 115 | halt() 116 | meta = {"daisy": {"board": custom_json['name'], "board_file": args.custom_json}} 117 | 118 | meta_path = os.path.join(os.path.dirname(__file__), "util/daisy.json") 119 | meta_path = os.path.normpath(meta_path) 120 | ram_type = args.ram 121 | 122 | if ram_type not in ('size', 'speed'): 123 | print(f'{Colours.red}Error:{Colours.end} unknown ram option "{ram_type}"') 124 | halt() 125 | 126 | global rom_type 127 | rom_type = args.rom 128 | 129 | if rom_type not in ('size', 'speed', 'double_size'): 130 | print(f'{Colours.red}Error:{Colours.end} unknown rom option "{rom_type}"') 131 | halt() 132 | 133 | if rom_type in ('size', 'double_size'): 134 | print(f'\n{Colours.green}Note: a rom type of "{rom_type}" means you\'ll be running your project with the Daisy bootloader.{Colours.end}') 135 | 136 | linker_file = '' 137 | if rom_type == 'double_size': 138 | linker_file = 'qspi_linker_sdram.lds' if ram_type == 'size' else 'qspi_linker.lds' 139 | meta['daisy']['bootloader'] = True 140 | elif rom_type == 'size': 141 | linker_file = 'sram_linker_sdram.lds' if ram_type == 'size' else 'sram_linker.lds' 142 | meta['daisy']['bootloader'] = True 143 | elif ram_type == 'size': 144 | linker_file = 'default_linker_sdram.lds' 145 | 146 | meta['daisy']['linker_script'] = linker_file 147 | 148 | with open(meta_path, 'w') as file: 149 | json.dump(meta, file) 150 | 151 | results = hvcc.compile_dataflow( 152 | in_path=inpath, 153 | out_dir=output, 154 | patch_name=basename, 155 | patch_meta_file=meta_path, 156 | search_paths=search_paths, 157 | generators=('daisy'), 158 | verbose=verbose, 159 | copyright=copyright, 160 | ) 161 | 162 | for r in list(results.values()): 163 | # print any errors 164 | if r["notifs"].get("has_error", False): 165 | for i, error in enumerate(r["notifs"].get("errors", [])): 166 | print("{4:3d}) {2}Error{3} {0}: {1}".format( 167 | r["stage"], error["message"], Colours.red, Colours.end, i + 1)) 168 | 169 | # only print exception if no errors are indicated 170 | if len(r["notifs"].get("errors", [])) == 0 and r["notifs"].get("exception", None) is not None: 171 | print("{2}Error{3} {0} exception: {1}".format( 172 | r["stage"], r["notifs"]["exception"], Colours.red, Colours.end)) 173 | 174 | sys.exit(1) 175 | # # clear any exceptions such that results can be JSONified if necessary 176 | # r["notifs"]["exception"] = [] 177 | 178 | # print any warnings 179 | for i, warning in enumerate(r["notifs"].get("warnings", [])): 180 | print("{4:3d}) {2}Warning{3} {0}: {1}".format( 181 | r["stage"], warning["message"], Colours.yellow, Colours.end, i + 1)) 182 | 183 | if verbose: 184 | print("Total compile time: {0:.2f}ms".format(1000 * (time.time() - tick))) 185 | 186 | return output, meta, linker_file, args 187 | 188 | 189 | def compile_project(output, meta, linker_file, args): 190 | # Reorganize project structure to be more friendly 191 | 192 | # delete unused folders 193 | shutil.rmtree(os.path.join(output, 'c')) 194 | shutil.rmtree(os.path.join(output, 'hv')) 195 | shutil.rmtree(os.path.join(output, 'ir')) 196 | shutil.copytree(os.path.join(output, 'daisy'), output, dirs_exist_ok=True) 197 | shutil.rmtree(os.path.join(output, 'daisy')) 198 | os.unlink(os.path.join(output, 'build.json')) 199 | 200 | # Find main file 201 | main_file = None 202 | target = None 203 | main_regex = re.compile('(HeavyDaisy_.+?).cpp') 204 | for file in os.listdir(os.path.join(output, 'source')): 205 | match = main_regex.search(file) 206 | if match is not None: 207 | main_file = file 208 | target = match.group(1) 209 | break 210 | 211 | # If we can find the main file, then we can easily make the project structure even a bit nicer 212 | if main_file is not None: 213 | shutil.move(os.path.join(output, 'source', main_file), os.path.join(output, main_file)) 214 | os.unlink(os.path.join(output, 'source', 'Makefile')) 215 | 216 | makefile_path = os.path.join(PD2DSY_DIRECTORY, 'util', 'Makefile') 217 | with open(makefile_path, 'r') as file: 218 | makefile = file.read() 219 | 220 | makefile = makefile.replace('# GENERATE TARGET', f'TARGET={target}') 221 | libdaisy_path = construct_relative_libdaisy_path(output, args.libdaisy_path) 222 | makefile = makefile.replace('# LIBDAISY PATH', libdaisy_path) 223 | if args.rom == 'size': 224 | makefile = makefile.replace('# BOOTLOADER', 'APP_TYPE = BOOT_SRAM') 225 | elif args.rom == 'double_size': 226 | makefile = makefile.replace('# BOOTLOADER', 'APP_TYPE = BOOT_QSPI') 227 | 228 | if linker_file: 229 | linker_file = os.path.normpath(linker_file) 230 | makefile = makefile.replace('# LINKER', f'LDSCRIPT = {linker_file}') 231 | src = os.path.normpath(os.path.join(PD2DSY_DIRECTORY, 'util', linker_file)) 232 | dest = os.path.normpath(os.path.join(output, linker_file)) 233 | shutil.copy2(src, dest) 234 | with open(os.path.join(output, 'Makefile'), 'w') as file: 235 | file.write(makefile) 236 | 237 | 238 | # If we weren't able to find the main file, then just resort to normal building 239 | daisy_src = output if main_file is not None else os.path.join(output, 'source') 240 | logfile = None 241 | return_code = 0 242 | 243 | if not args.no_build: 244 | if args.log is not None: 245 | logfile = open(args.log, 'w') 246 | 247 | build_process = subprocess.Popen(f'make -C {daisy_src}', 248 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 249 | 250 | for line in build_process.stdout: 251 | decoded = line.decode('utf-8') 252 | sys.stdout.write(decoded) 253 | if logfile: 254 | logfile.write(decoded) 255 | 256 | return_code = build_process.wait() 257 | if logfile: 258 | logfile.close() 259 | 260 | return return_code, main_file, args.log 261 | 262 | 263 | def flash_project(output, meta, main_file, args): 264 | 265 | daisy_src = output if main_file is not None else os.path.join(output, 'source') 266 | 267 | logfile = None 268 | return_code = 0 269 | 270 | if not args.no_build: 271 | if args.log is not None: 272 | logfile = open(args.log, 'a') 273 | 274 | build_process = subprocess.Popen(f'make program-dfu -C {daisy_src}', 275 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 276 | 277 | for line in build_process.stdout: 278 | decoded = line.decode('utf-8') 279 | sys.stdout.write(decoded) 280 | if logfile: 281 | logfile.write(decoded) 282 | 283 | return_code = build_process.wait() 284 | if logfile: 285 | logfile.close() 286 | 287 | return return_code, args.log 288 | 289 | def flash_bootloader(log): 290 | return_code = 0 291 | logfile = None 292 | 293 | if log is not None: 294 | logfile = open(log, 'w') 295 | 296 | core_path = to_posix(os.path.join(PD2DSY_DIRECTORY, "libdaisy", "core")) 297 | 298 | build_process = subprocess.Popen(f'make program-boot -C {core_path}', 299 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 300 | 301 | for line in build_process.stdout: 302 | decoded = line.decode('utf-8') 303 | sys.stdout.write(decoded) 304 | if logfile: 305 | logfile.write(decoded) 306 | 307 | return_code = build_process.wait() 308 | if logfile: 309 | logfile.close() 310 | 311 | return return_code, log 312 | 313 | 314 | def main(args): 315 | output, meta, linker_file, args = run_hvcc(args) 316 | return_code, main_file, logfile = compile_project(output, meta, linker_file, args) 317 | if return_code: 318 | sys.exit(return_code) 319 | 320 | return_code, logfile = flash_project(output, meta, main_file, args) 321 | if return_code: 322 | sys.exit(return_code) 323 | 324 | 325 | if __name__ == "__main__": 326 | 327 | class FlashBootloaderAction(argparse.Action): 328 | 329 | def __init__(self, *args, **kwargs): 330 | super().__init__(*args, **kwargs, nargs=0) 331 | 332 | def __call__(self, parser, namespace, values, option_string=None): 333 | return_code, logfile = flash_bootloader(None) 334 | if return_code: 335 | sys.exit(return_code) 336 | parser.exit() 337 | 338 | parser = argparse.ArgumentParser(description='Utility for converting Puredate files to Daisy projects, uses HVCC inside') 339 | parser.register('action', 'flash_bootloader', FlashBootloaderAction) 340 | 341 | parser.add_argument('pd_input', help='path to puredata file.') 342 | parser.add_argument('-b', '--board', help=f'hardware platform for generated output. The supported boards are: {", ".join(BOARDLIST)}', default=None) 343 | parser.add_argument('-c', '--custom-json', type=str, help='provide a custom JSON board description', default='') 344 | parser.add_argument('-p', '--search_paths', action='append', help="Add a list of directories to search through for abstractions.") 345 | parser.add_argument('-d', '--directory', type=str, help="set the parent directory of the output.", default='.') 346 | parser.add_argument('-f', '--force', help='replace existing files without prompt', action='store_true') 347 | parser.add_argument('--ram', type=str, help='follow with "speed" or "size" to optimize RAM usage for your desired parameter (defaults to speed).', default='speed') 348 | parser.add_argument('--rom', type=str, help='follow with "speed", "size", or "double_size" to optimize ROM usage for your desired parameter (defaults to speed).', default='speed') 349 | parser.add_argument('--libdaisy-path', type=str, help='specify the path to libDaisy (usually not necessary)', default=None) 350 | parser.add_argument('--no-build', help='prevent automatic building and flashing after hvcc generation', action='store_true') 351 | parser.add_argument('--log', type=str, help='print build output to a log file instead of console', default=None) 352 | parser.add_argument('--flash-bootloader', help='flash the Daisy bootloader and exit', action='flash_bootloader') 353 | 354 | args = parser.parse_args() 355 | print(args) 356 | main(args) 357 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pd2dsy 2 | 3 | **This repo has been archived, in favor of the [Plug Data](https://plugdata.org/) project** 4 | 5 | Utility for converting Pure Data (Vanilla) patches to Daisy projects. 6 | 7 | ## Installation/Setup 8 | 9 | If you've already followed the guides or watched the videos for [Setting Up Your Development Enviornment](https://github.com/electro-smith/DaisyWiki/wiki/1.-Setting-Up-Your-Development-Environment), and [Creating a New Project](https://github.com/electro-smith/DaisyWiki/wiki/How-To:-Create-a-New-Project) you can skip straight to step 3 10 | 11 | 1. Follow the instructions for [installing the Daisy Toolchain for your OS](https://github.com/electro-smith/DaisyWiki/wiki/1.-Setting-Up-Your-Development-Environment#1-install-the-toolchain) 12 | 2. Install python for your OS 13 | * On Mac OS/Linux you can use your favorite package manager, and python3 may already be installed. (i.e. `brew install python`) 14 | * Details for [installing python on windows](https://github.com/electro-smith/DaisyWiki/wiki/1c.-Installing-the-Toolchain-on-Windows#python-optional). 15 | 3. Clone the repo with `git clone https://github.com/electro-smith/pd2dsy` 16 | 4. Navigate into the cloned repository (`cd pd2dsy`) 17 | 5. Type in `./install.sh` and hit enter (make sure you're in the root directry of the project). This should install required python modules, update your libdaisy, and build it for you. It also creates a _virtual environment_, which is a self-contained python environment for specific projects. 18 | 19 | At this point you should be ready to use the tool! 20 | 21 | ## Usage 22 | 23 | The first time you start a new session and want to use pd2dsy you will have to activate your virtual environment. This essentially loads a version of python with all of the specific libraries ready to go: 24 | 25 | * On Mac OS / Linux: `source ./pd_env/bin/activate` 26 | * On Windows (from git-bash): `source ./pd_env/Scripts/activate` 27 | 28 | Once activated you should see something like: 29 | 30 | ![venv prompt example](util/venv_screenshot.png?raw=true) 31 | 32 | Once you see this you can start to use pd2dsy. 33 | 34 | After you've made your patch in puredata, you can turn it into cpp by running the command: 35 | ~~~ 36 | python pd2dsy.py --board .pd 37 | ~~~ 38 | 39 | \ should be replaced with the board you're using (pod, patch, patch_init, field, petal). 40 | 41 | \ is the filename of your pd patch. 42 | 43 | Your patch will be built and uploaded automatically, assuming you have a Daisy in DFU mode plugged into USB. If you'd like to build and upload manually, you can navigate to the folder that it created and run `make`, then `make program-dfu`. 44 | 45 | **For now, the script leaves the path to libdaisy as `../libdaisy`, which works if the generated folder is placed within the root directory. 46 | Otherwise, the Makefile should be edited (or the `--libdaisy-depth` option should be used) to point to a valid libdaisy repository.** 47 | 48 | ## Optional features 49 | 50 | ### -c, --custom-json 51 | 52 | If you've designed your own prototype or board based on the Daisy platform, you can specify the I/O in a custom JSON file. Details for how this works can be found in the tool that actually performs this generation, [json2daisy](https://github.com/electro-smith/json2daisy). 53 | 54 | ### --ram 55 | 56 | You can specify whether you'd like to optimize your project's RAM usage for `speed` or `size`. The Daisy's internal SRAM has a fast access time, but it can be quite limited at 512kB (or even less if you're using the bootloader!). The external SDRAM (note the _D_), while it can be slower to access, affords a hefty 64MB of space. Currently, only the heap is placed in SDRAM if `size` is selected (meaning all dynamic allocations happen in SDRAM), but that's the best use-case for it anyway, since the largest program you could squeeze onto the Daisy would only be around 512kB. 57 | 58 | The appropriate linker is automatically supplied and chosen in the makefile if you select `size`, so all you need to do is rebuild the project. 59 | 60 | ### --rom 61 | 62 | You can specify whether you'd like to optimize your project's ROM usage for `speed` or `size`. The Daisy's internal flash allows programs to start very quickly, and offers very slightly better performance. However, if your program is too hefty to fit in the Daisy's 128kB of internal flash, then you'll need to execute the program from SRAM using the Daisy bootloader (for up to 512kB). Selecting `size` will configure your project for the bootloader, and all you need to do is upload the bootloader, build your program, then upload the resulting binary to the bootloader. If you need even more size, you can execute your programs directly from the 8MB QSPI flash chip with `double_size`, though performance may take a hit in certain scenarios. 63 | 64 | 65 | 66 | Both `--ram` and `--rom` default to `speed`. 67 | 68 | ### -d, --directory 69 | 70 | The parent directory of your project can be specified. This is convenient if you'd like to build from somewhere other than your intended project directory, for example: 71 | 72 | ~~~bash 73 | python pd2dsy.py -d build path/to/source.pd 74 | ~~~ 75 | 76 | This would place your project in the `build` subdirectory. If it doesn't exist, then pd2dsy will ask if you'd like to create it. 77 | 78 | ### --libdaisy-depth 79 | 80 | pd2dsy generates a number of helpful files that need to know where your libDaisy folder is located. If you don't want to change them all manually, then you can specify how far away the libDaisy folder is from your project folder: 81 | 82 | ~~~bash 83 | python pd2dsy.py --libdaisy-depth 2 path/to/source.pd 84 | ~~~ 85 | 86 | This will tell all the project files to look two directories above the current one to find libDaisy (as in `../../libDaisy`). This does require that libDaisy exists in _some_ parent directory of your project, but you can of course specify it manually if you prefer. 87 | 88 | # Interacting with the Daisy I/O 89 | 90 | Each board has a selection of physical I/O that can interact with your PD patch. Most components have an _alias_, which allows you to refer to the same input/output by different names if you have a preference. All names and aliases are _case insensitive_, so you can style them however you like (e.g. `GateIn`). 91 | 92 | Components that act as an input (like a Switch, for example) are accessible with Pd's `receive` object, and require the `@hv_param` attribute in order to be recognized as an external input. If your Switch is named `sw`, then the Pd object would look like `r sw @hv_param`. Outputs, like an LED, use the `send` object (i.e. `s led @hv_param`). The examples make this usage pretty clear. 93 | 94 | Some components have _variants_, which allow you to interact with them in multiple ways. For example, you can receive a bang from a `Gate In` instead of a float if you add `_trig` to the end of the gate's name (or any of its aliases). So, if a `Gate In`'s name is `gatein1`, you would use `gatein1_trig`. 95 | 96 | Here's what each component expects for its default behavior and variants: 97 | 98 | | Type | _variant | Behavior | 99 | | --- | --- | --- | 100 | | **Inputs** | --- | --- | 101 | | Voltage Input | --- | Returns a floating point representation of the voltage at its input. The typical range is 0-5 V, which is represented as 0-1. | 102 | | Bipolar Voltage Input | --- | Similar to a regular voltage input, but can represent negative voltages. | 103 | | Switch | --- | Returns a bang on the signal's rising edge (i.e. when the switch is actuated). | 104 | | Switch | _press | Returns a float representing the current state (1 = pressed, 0 = not pressed) | 105 | | Switch | _fall | Returns a bang on the signal's falling edge (i.e. when the switch is released). | 106 | | Switch | _seconds | Returns a float representing the number of seconds the switch has been held down. | 107 | | SPDT Switch | --- | Returns a float representing the current state, either 0 or 1. | 108 | | Encoder | --- | Returns a 1 if turned one direction, -1 if turned in the other, and 0 otherwise. | 109 | | Encoder | \_rise | Returns a bang when the encoder is pressed. The special alias _EncSwitch_ is always bound to this. | 110 | | Encoder | _press | Same as switch _press. | 111 | | Encoder | _fall | Same as switch _fall. | 112 | | Encoder | _seconds | Same as switch _seconds. | 113 | | Gate In | --- | Returns a float representing the current gate voltage, where a _high_ voltage is 1 and a _low_ voltage is 0. | 114 | | Gate In | _trig | Returns a bang on the rising edge of the gate signal. | 115 | | **Outputs** | --- | --- | 116 | | CV Out | --- | Expects a floating point value from 0-1, usually converted to 0-5V. | 117 | | Gate Out | --- | Expects a floating point value from 0-1. 0 sets the output low, and 1 sets it high. | 118 | | LED | --- | Expects a floating point value from 0-1. The brightness is PWM modulated to match the input. | 119 | | RGB LED | --- | Expects a floating point value from 0-1. The default behavior sets all three colors to the same brightness. | 120 | | RGB LED | _white | Same as default. | 121 | | RGB LED | _red | Expects a floating point value from 0-1. Sets the brightness of the red LED only. | 122 | | RGB LED | _green | Expects a floating point value from 0-1. Sets the brightness of the green LED only. | 123 | | RGB LED | _blue | Expects a floating point value from 0-1. Sets the brightness of the blue LED only. | 124 | 125 | Here's how the newly added sensors are addressed: 126 | 127 | | Type | _variant | Behavior | 128 | | --- | --- | --- | 129 | | **Inputs** | --- | --- | 130 | | BME280 | --- | Returns the temperature in degrees C. | 131 | | BME280 | _temp | Behaves the same as the default option. | 132 | | BME280 | _hum | Returns the humidity in relative percentage. | 133 | | BME280 | _press | Returns the pressure in pascals (1 atm ~= 100 kPa) | 134 | | BME280 | _alt | Returns the estimated altitude in meters | 135 | | BMP390 | --- | Returns the temperature in degrees C. | 136 | | BMP390 | _temp | Behaves the same as the default option. | 137 | | BMP390 | _press | Returns the pressure in pascals (1 atm ~= 100 kPa) | 138 | | BMP390 | _alt | Returns the estimated altitude in meters | 139 | | Hall Sensor | --- | Returns the current state of the sensor (0 if no field present, otherwise 1). | 140 | | Hall Sensor | _count | Returns the number of times the hall sensor has been activated. | 141 | | TLV93D | --- | Returns the magnitude of the field's force vector in uT (i.e. the amount of field). | 142 | | TLV93D | _x, _y, _z | Returns the field's strength in the given axis in uT. | 143 | | TLV93D | _amount | Behaves the same as the default option. | 144 | | TLV93D | _azimuth | Returns the field's azimuth for spherical coordinates. | 145 | | TLV93D | _polar | Returns the field's 3D inclination for spherical coordinates. | 146 | | MPR121 | --- | Returns whether channel 0 is touched according to the threshold. | 147 | | MPR121 | _ch0 ... _ch11 | Returns a 1 if the given channel is touched according to the threshold, otherwise 0. | 148 | | MPR121 | _ch0_raw ... _ch11_raw | Returns the raw sensor data for the given channel as a 10-bit unsigned integer. | 149 | | APDS9960 | --- | Returns the current read gesture (1-4) if detected, otherwise 0. | 150 | | APDS9960 | _gest | Behaves the same as the default option. | 151 | | APDS9960 | _prox | Returns the detected proximity in undefined units (meant for relative distance detection). | 152 | | APDS9960 | _red, _green, _blue, _clear | Returns the detected brightness of the given color as a 16-bit unsigned integer. | 153 | | VL53L1X | --- | Returns the distance measurement in mm. | 154 | | Neo Trellis | --- | Sends a bang when the first button (index 0) is pressed. | 155 | | Neo Trellis | _0 ... _15 | Sends a bang when the given button is pressed. | 156 | | Neo Trellis | \_0\_falling ... \_15\_falling | Sends a bang when the given button is released. | 157 | | Neo Trellis | \_0\_state ... \_15\_state | Returns the current state of the given button (1 = pressed, 0 = released). | 158 | | BNO055 | --- | Returns the X component of the accelerometer in m/s^2. | 159 | | BNO055 | \_accel\_x, \_accel\_y, \_accel\_z | Returns the given axis from the accelerometer in m/s^2. | 160 | | BNO055 | \_magnet\_x, \_magnet\_y, \_magnet\_z | Returns the given axis from the magnetometer in uT. | 161 | | BNO055 | \_gyro\_x, \_gyro\_y, \_gyro\_z | Returns the given axis from the gyroscope in dps (degrees per second). | 162 | | BNO055 | \_euler\_x, \_euler\_y, \_euler\_z | Returns the rotation along the given axis in degrees. | 163 | | BNO055 | \_linear\_accel\_x, \_linear\_accel\_y, \_linear\_accel\_z | Returns the linear acceleration in the given axis in m/s^2. | 164 | | BNO055 | \_grav\_x, \_grav\_y, \_grav\_z | Returns the acceleration due to gravity along the given axis in m/s^2. | 165 | | BNO055 | \_quat\_w, \_quat\_x, \_quat\_y, \_quat\_z | Returns the orientation represented as a quaternion. | 166 | | **Outputs** | --- | 167 | | Stepper Motor | --- | Expects a floating point value of any arbitrary size, representing the number of steps to rotate. The sign of the number determines direction. | 168 | | Stepper Motor | _release | Triggers the stepper motor to relax its fields when a positive value is received, allowing the motor to spin freely. | 169 | | DC Motor | --- | Expects a floating point value from -1 to 1. The magnitude controls the speed, the sign controls direction, and a value of zero stops the motor. | 170 | | Neo Trellis LEDs | _0 ... _15 | Expects an integer from 0-255 to control the led brightness of the corresponding pad. | 171 | 172 | # Daisy Board I/O 173 | 174 | ## patch 175 | 176 | | Name | Aliases | Type | Variants | 177 | | --- | --- | --- | --- | 178 | | knob1 | knob, ctrl, ctrl1 | Voltage Input | --- | 179 | | knob2 | ctrl2 | Voltage Input | --- | 180 | | knob3 | ctrl3 | Voltage Input | --- | 181 | | knob4 | ctrl4 | Voltage Input | --- | 182 | | encoder | --- | Encoder | encoder_press, encoder_rise, encoder_fall, encoder_seconds | 183 | | gateout | --- | Gate Out | --- | 184 | | cvout1 | cvout | CV Out | --- | 185 | | cvout2 | --- | CV Out | --- | 186 | | gatein1 | gate, gate1 | Gate In | gatein1_trig | 187 | | gatein2 | gate2 | Gate In | gatein2_trig | 188 | 189 | ## patch_init 190 | 191 | | Name | Aliases | Type | Variants | 192 | | --- | --- | --- | --- | 193 | | cv_1 | knob, knob1, ctrl, ctrl1 | Voltage Input | --- | 194 | | cv_2 | knob2, ctrl2 | Voltage Input | --- | 195 | | cv_3 | knob3, ctrl3 | Voltage Input | --- | 196 | | cv_4 | knob4, ctrl4 | Voltage Input | --- | 197 | | cv_5 | knob5, ctrl5 | Voltage Input | --- | 198 | | cv_6 | knob6, ctrl6 | Voltage Input | --- | 199 | | cv_7 | knob7, ctrl7 | Voltage Input | --- | 200 | | cv_8 | knob8, ctrl8 | Voltage Input | --- | 201 | | adc_9 | --- | Voltage Input | --- | 202 | | adc_10 | --- | Voltage Input | --- | 203 | | adc_11 | --- | Voltage Input | --- | 204 | | adc_12 | --- | Voltage Input | --- | 205 | | gate_out_1 | gateout, gateout1 | Gate Out | --- | 206 | | gate_out_2 | gateout2 | Gate Out | --- | 207 | | cvout1 | cvout, cv_out_1 | CV Out | --- | 208 | | cvout2 | cv_out_2 | CV Out | --- | 209 | | gate_in_1 | gate, gate1 | Gate In | gate_in_1_trig | 210 | | gate_in_2 | gate2 | Gate In | gate_in_2_trig | 211 | | sw1 | switch, switch1, button | Switch | sw1_press, sw1_fall, sw1_seconds | 212 | | sw2 | switch2, toggle | Switch | sw2_press, sw2_fall, sw2_seconds | 213 | 214 | ## petal 215 | 216 | | Name | Aliases | Type | Variants | 217 | | --- | --- | --- | --- | 218 | | sw1 | switch, switch1 | Switch | sw1_press, sw1_fall, sw1_seconds | 219 | | sw2 | switch2 | Switch | sw2_press, sw2_fall, sw2_seconds | 220 | | sw3 | switch3 | Switch | sw3_press, sw3_fall, sw3_seconds | 221 | | sw4 | switch4 | Switch | sw4_press, sw4_fall, sw4_seconds | 222 | | sw5 | switch5 | Switch | sw5_press, sw5_fall, sw5_seconds | 223 | | sw6 | switch6 | Switch | sw6_press, sw6_fall, sw6_seconds | 224 | | sw7 | switch7 | Switch | sw7_press, sw7_fall, sw7_seconds | 225 | | encoder | --- | Encoder | encoder_press, encoder_rise, encoder_fall, encoder_seconds | 226 | | knob1 | knob, ctrl, ctrl1 | Voltage Input | --- | 227 | | knob2 | ctrl2 | Voltage Input | --- | 228 | | knob3 | ctrl3 | Voltage Input | --- | 229 | | knob4 | ctrl4 | Voltage Input | --- | 230 | | knob5 | ctrl5 | Voltage Input | --- | 231 | | knob6 | ctrl6 | Voltage Input | --- | 232 | | expression | --- | Voltage Input | --- | 233 | | led_ring_1 ... led_ring_8 | --- | RGB LED | led_ring_1_red, led_ring_1_green, led_ring_1_blue, led_ring_1_white | 234 | | led_fs_1 | --- | LED | --- | 235 | | led_fs_2 | --- | LED | --- | 236 | | led_fs_3 | --- | LED | --- | 237 | | led_fs_4 | --- | LED | --- | 238 | 239 | ## pod 240 | 241 | | Name | Aliases | Type | Variants | 242 | | --- | --- | --- | --- | 243 | | sw1 | switch, button, switch1, button1 | Switch | sw1_press, sw1_fall, sw1_seconds | 244 | | sw2 | switch2, button2 | Switch | sw2_press, sw2_fall, sw2_seconds | 245 | | knob1 | knob, ctrl, ctrl1 | Voltage Input | --- | 246 | | knob2 | ctrl2 | Voltage Input | --- | 247 | | encoder | --- | Encoder | encoder_press, encoder_rise, encoder_fall, encoder_seconds | 248 | | led1 | led | RGB LED | led1_red, led1_green, led1_blue, led1_white | 249 | | led2 | --- | RGB LED | led2_red, led2_green, led2_blue, led2_white | 250 | | gatein | gate, gate1 | Gate In | gatein_trig | 251 | 252 | ## field 253 | 254 | | Name | Aliases | Type | Variants | 255 | | --- | --- | --- | --- | 256 | | sw1 | switch, button, switch1, button1 | Switch | sw1_press, sw1_fall, sw1_seconds | 257 | | sw2 | switch2, button2 | Switch | sw2_press, sw2_fall, sw2_seconds | 258 | | cv1 | --- | Bipolar Voltage Input | --- | 259 | | cv2 | --- | Bipolar Voltage Input | --- | 260 | | cv3 | --- | Bipolar Voltage Input | --- | 261 | | cv4 | --- | Bipolar Voltage Input | --- | 262 | | knob1 | knob, ctrl, ctrl1 | Voltage Input | --- | 263 | | knob2 | ctrl2 | Voltage Input | --- | 264 | | knob3 ... knob8 | --- | Voltage Input | --- | 265 | | cvout1 | cvout | CV Out | --- | 266 | | cvout2 | --- | CV Out | --- | 267 | | gatein | --- | Gate In | gatein_trig | 268 | | gateout | --- | Gate Out | --- | 269 | | pada1 ... pada8 | --- | Switch | pada1_press, pada1_fall | 270 | | padb1 ... padb8 | --- | Switch | padb1_press, padb1_fall | 271 | | led_key_a1 ... led_key_a8 | --- | LED | --- | 272 | | led_key_b1 ... led_key_b8 | --- | LED | --- | 273 | | led_knob_1 ... led_knob_8 | --- | LED | --- | 274 | 275 | ------------------- 276 | 277 | ## How It Works 278 | 279 | There are a few pieces to this: 280 | 281 | * HVCC - heavy compiler, a generator for creating portable source code based on Pure Data vanilla patches 282 | * json2daisy - a utility for converting json board descriptions to libDaisy-based C++ headers 283 | * Daisy Interface handling - The controls and features available on the daisy platform need to be accessible from a pure data patch (buttons, knobs, leds, etc.) 284 | * compilation - a distributable copy of the arm toolchain and scripts for building the code without installing extra tools. 285 | 286 | ## Next steps 287 | 288 | 1. Double check licensing requirements, etc. and bundle a pre-compiled binaries for the arm toolchain into the project for built-in compilation 289 | 2. Add a GUI? (Web app / built in tester, similar to OWL platform?) 290 | -------------------------------------------------------------------------------- /dsy_gui.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | import json 4 | from sys import platform 5 | import tkinter as tk 6 | from tkinter import ttk 7 | from tkinter import filedialog 8 | from tkinter import messagebox 9 | import darkdetect 10 | 11 | 12 | class SaveableWrapper: 13 | 14 | def __init__(self, id=None): 15 | self.variable = tk.StringVar() 16 | self.id = id 17 | 18 | def get_value(self): 19 | return self.variable.get() 20 | 21 | def load_from_save(self, value): 22 | self.variable.set(value) 23 | 24 | def reset_state(self): 25 | pass 26 | 27 | 28 | class FileBrowserWrapper(SaveableWrapper): 29 | 30 | def __init__(self, frame, column, row, label_text, callback=None, files=True, multiple=False, disable_input=True, filetypes=None, **kwargs): 31 | super().__init__(**kwargs) 32 | ttk.Label(frame, text=label_text).grid(column=column, row=row, sticky=tk.W) 33 | 34 | self.variable = tk.StringVar() 35 | self.display_variable = tk.StringVar() 36 | self.text_box = ttk.Entry(frame, width=16, textvariable=self.display_variable) 37 | if disable_input: 38 | self.text_box.config(state='readonly') 39 | self.text_box.grid(column=column, row=row + 1, sticky=(tk.W, tk.E)) 40 | 41 | self.browse = ttk.Button(frame, text="Browse", command=self.update_callback) 42 | self.browse.grid(column=column + 1, row=row + 1, sticky=tk.W) 43 | 44 | self.open_files = files 45 | self.open_multiple = multiple 46 | self.callback = callback 47 | 48 | self.call_matrix = { 49 | (False, False): filedialog.askdirectory, 50 | (False, True): filedialog.askdirectory, 51 | (True, False): filedialog.askopenfilename, 52 | (True, True): filedialog.askopenfilenames 53 | } 54 | 55 | self.initial_path = None 56 | self.initial_interaction = False 57 | self.filetypes = filetypes 58 | if not files: 59 | self.filetypes = None 60 | self.default_dir = None 61 | 62 | def update_callback(self, *args): 63 | kwargs = {} 64 | if self.filetypes is not None: 65 | kwargs['filetypes'] = self.filetypes 66 | if self.default_dir is not None: 67 | kwargs['initialdir'] = self.default_dir 68 | 69 | return_value = self.call_matrix[(self.open_files, self.open_multiple)](**kwargs) 70 | 71 | if return_value: 72 | if self.open_files: 73 | self.default_dir = os.path.dirname(os.path.abspath(return_value)) 74 | else: 75 | self.default_dir = os.path.abspath(return_value) 76 | 77 | if self.callback is not None: 78 | self.callback(return_value) 79 | self.variable.set(return_value) 80 | display_name = os.path.basename(return_value) 81 | self.display_variable.set(display_name) 82 | 83 | def load_from_save(self, value): 84 | self.variable.set(value) 85 | display_name = os.path.basename(value) 86 | self.display_variable.set(display_name) 87 | 88 | def reset_state(self): 89 | self.variable.set('') 90 | self.display_variable.set('') 91 | 92 | def enable(self, state: bool): 93 | new_state = tk.NORMAL if state else tk.DISABLED 94 | self.browse.config(state=new_state) 95 | 96 | 97 | class OptionWrapper(SaveableWrapper): 98 | 99 | def __init__(self, frame, column, row, label_text, options, callback=None, **kwargs): 100 | super().__init__(**kwargs) 101 | self.options = options 102 | self.variable = tk.StringVar(frame) 103 | self.variable.set(options[0]) 104 | 105 | self.variable.trace_add("write", self.trace_callback) 106 | self.callback = callback 107 | 108 | self.label = ttk.Label(frame, text=label_text).grid(column=column, row=row, sticky=tk.W) 109 | self.dropdown = ttk.OptionMenu(frame, self.variable, options[0], *options) 110 | self.dropdown.grid(column=column, row=row + 1, sticky=tk.W) 111 | 112 | def trace_callback(self, *args): 113 | if self.callback is not None: 114 | self.callback(self.variable.get()) 115 | 116 | def load_from_save(self, value): 117 | if value in self.options: 118 | self.variable.set(value) 119 | 120 | def reset_state(self): 121 | self.variable.set(self.options[0]) 122 | 123 | def enable(self, state: bool): 124 | new_state = tk.NORMAL if state else tk.DISABLED 125 | self.dropdown.config(state=new_state) 126 | 127 | 128 | class RadioWrapper(SaveableWrapper): 129 | 130 | def __init__(self, frame, column, row, label_text, options, callback=None, **kwargs): 131 | super().__init__(**kwargs) 132 | self.options = options 133 | ttk.Label(frame, text=label_text).grid(column=column, row=row, sticky=tk.W) 134 | 135 | self.variable = tk.StringVar(frame) 136 | self.variable.set(options[0]) 137 | 138 | self.variable.trace_add("write", self.trace_callback) 139 | self.callback = callback 140 | 141 | self.buttons = [] 142 | for i, option in zip(range(len(options)), options): 143 | button = ttk.Radiobutton(frame, text=option, value=option, variable=self.variable) 144 | button.grid(column=column, row=row + 1 + i, sticky=tk.W) 145 | self.buttons.append(button) 146 | 147 | def trace_callback(self, *args): 148 | if self.callback is not None: 149 | self.callback(self.variable.get()) 150 | 151 | def load_from_save(self, value): 152 | if value in self.options: 153 | self.variable.set(value) 154 | 155 | def reset_state(self): 156 | self.variable.set(self.options[0]) 157 | 158 | def enable(self, state: bool): 159 | new_state = tk.NORMAL if state else tk.DISABLED 160 | for button in self.buttons: 161 | button.config(state=new_state) 162 | 163 | 164 | class ButtonWrapper: 165 | 166 | def __init__(self, frame, column, row, label_text, callback): 167 | 168 | self.button = ttk.Button(frame, text=label_text, command=self.action_callback) 169 | self.button.grid(column=column, row=row, sticky=tk.W) 170 | 171 | self.callback = callback 172 | 173 | def action_callback(self, *args): 174 | self.callback() 175 | 176 | def enable(self, state: bool): 177 | new_state = tk.NORMAL if state else tk.DISABLED 178 | self.button.config(state=new_state) 179 | 180 | 181 | class TextFieldWrapper: 182 | 183 | foreground_color = "#FFFFFF" 184 | background_color = "#101010" 185 | 186 | def __init__(self, frame): 187 | 188 | self.field = tk.Text(frame, bg=self.background_color, 189 | fg=self.foreground_color, height=10, width=10, insertontime=0) 190 | self.field.pack(side='left', fill=tk.BOTH, expand=True) 191 | 192 | self.scrollbar = ttk.Scrollbar(frame) 193 | self.scrollbar.pack(side = 'right',fill='y') 194 | self.scrollbar.config(command=self.field.yview) 195 | self.field.config(yscrollcommand=self.scrollbar.set) 196 | 197 | # kill all events that can change the text, 198 | # including all typing (even shortcuts for 199 | # copy and select all) 200 | self.field.bind("<>", self._kill_event) 201 | self.field.bind("<>", self._kill_event) 202 | self.field.bind("<>", self._kill_event) 203 | self.field.bind("<>", self._kill_event) 204 | self.field.bind("", self._kill_event) 205 | # restore copy and select all 206 | for evt in self.field.event_info("<>"): 207 | self.field.bind(evt, self._do_copy) 208 | for evt in self.field.event_info("<>"): 209 | self.field.bind(evt, self._do_select_all) 210 | 211 | self.tags = {} 212 | 213 | def append(self, text, color=foreground_color): 214 | sticky = self.scrollbar.get()[1] >= 0.99 215 | 216 | if color != self.foreground_color: 217 | tag_to_use = None 218 | for key, item in self.tags.items(): 219 | if color == item: 220 | tag_to_use = key 221 | break 222 | 223 | if tag_to_use is None: 224 | new_tag_name = self._generate_tag_name() 225 | self.tags[new_tag_name] = color 226 | self.field.tag_configure(new_tag_name, foreground=color) 227 | tag_to_use = new_tag_name 228 | 229 | self.field.insert(tk.END, text, tag_to_use) 230 | 231 | else: 232 | self.field.insert(tk.END, text) 233 | 234 | if sticky: 235 | self.field.see(tk.END) 236 | 237 | def _kill_event(self, evt): 238 | return 'break' 239 | 240 | def _do_copy(self, evt): 241 | self.field.event_generate('<>') 242 | 243 | def _do_select_all(self, evt): 244 | self.field.event_generate('<>') 245 | 246 | def _generate_tag_name(self): 247 | return f'tag_{len(self.tags)}' 248 | 249 | 250 | class ProjectManager: 251 | 252 | def __init__(self, root, menu, configuration_file="config.json", window_title="Program", examples=None): 253 | 254 | modifier = 'Cmd' if platform == 'darwin' else 'Ctrl' 255 | 256 | menu.add_command(label="New", command=self.operation_new, accelerator=f'{modifier}+N') 257 | menu.add_command(label="Open", command=self.operation_open, accelerator=f'{modifier}+O') 258 | 259 | self.menu_recent = tk.Menu(menu, tearoff=False) 260 | menu.add_cascade(menu=self.menu_recent, label='Open recent') 261 | 262 | menu.add_separator() 263 | 264 | menu.add_command(label="Save", command=self.operation_save, accelerator=f'{modifier}+S') 265 | menu.add_command(label="Save as...", command=self.operation_save_as, accelerator=f'{modifier}+Shift+S') 266 | 267 | self.example_paths = [] 268 | 269 | if examples is not None: 270 | menu.add_separator() 271 | 272 | self.menu_examples = tk.Menu(menu, tearoff=False) 273 | menu.add_cascade(menu=self.menu_examples, label="Examples") 274 | 275 | for example in examples: 276 | self.menu_examples.add_command(label=example[0], command=lambda f=example[1]: self.load_recent_or_example(f)) 277 | self.example_paths.append(example[1]) 278 | 279 | modifier = 'Command' if platform == 'darwin' else 'Control' 280 | 281 | root.bind(f'<{modifier}-n>', self.operation_new) 282 | root.bind(f'<{modifier}-o>', self.operation_open) 283 | root.bind(f'<{modifier}-s>', self.operation_save) 284 | root.bind(f'<{modifier}-Shift-KeyPress-S>', self.operation_save_as) 285 | 286 | self.root = root 287 | self.window_title = window_title 288 | 289 | self.configuration_file = configuration_file 290 | self.config = { 291 | "current_project_path": None, 292 | "last_open_path": None, 293 | "last_save_as_path": None, 294 | "recent_paths": [], 295 | "file_browser_paths": {}, 296 | } 297 | 298 | root.protocol('WM_DELETE_WINDOW', self.on_close) 299 | self.current_project = None 300 | self.unchanged_settings = {} 301 | 302 | self.saveable_wrappers = [] 303 | self.fb_wrappers = [] 304 | 305 | def set_file_browsers(self, fb_wrappers): 306 | self.fb_wrappers = fb_wrappers 307 | for wrapper in self.fb_wrappers: 308 | self.config['file_browser_paths'][wrapper.id] = None 309 | 310 | def set_saveable_wrappers(self, saveable_wrappers): 311 | self.saveable_wrappers = saveable_wrappers 312 | for obj in self.saveable_wrappers: 313 | obj.variable.trace_add("write", self.update_project_state) 314 | 315 | def initialize_paths(self): 316 | home_dir = str(Path.home()) 317 | if self.config['last_open_path'] is None: 318 | self.config['last_open_path'] = home_dir 319 | if self.config['last_save_as_path'] is None: 320 | self.config['last_save_as_path'] = home_dir 321 | 322 | for browser in self.fb_wrappers: 323 | saved_path = self.config['file_browser_paths'].get(browser.id, None) 324 | if saved_path is not None: 325 | browser.default_dir = saved_path 326 | else: 327 | browser.default_dir = home_dir 328 | 329 | def startup(self): 330 | try: 331 | with open(self.configuration_file, 'r') as file: 332 | config_data = json.load(file) 333 | for key, item in config_data.items(): 334 | self.config[key] = item 335 | 336 | if len(self.config['recent_paths']) > 0: 337 | for path in self.config['recent_paths']: 338 | self.menu_recent.add_command(label=path, command=lambda f=path: self.load_recent_or_example(f)) 339 | else: 340 | self.menu_recent.add_command(label="no recent files") 341 | 342 | self.initialize_paths() 343 | 344 | if self.config['current_project_path'] is not None: 345 | self.load_project(self.config['current_project_path']) 346 | else: 347 | self.set_unchanged() 348 | self.update_project_state() 349 | except FileNotFoundError: 350 | self.menu_recent.add_command(label="no recent files") 351 | self.set_unchanged() 352 | self.update_project_state() 353 | self.initialize_paths() 354 | 355 | def set_unchanged(self): 356 | self.unchanged_settings = self.get_save_dict() 357 | 358 | def get_unchanged(self): 359 | current_settings = self.get_save_dict() 360 | for id, value in current_settings.items(): 361 | original = self.unchanged_settings.get(id, None) 362 | if original != value: 363 | return False 364 | return True 365 | 366 | def update_project_state(self, *args): 367 | project_title = self.config['current_project_path'] 368 | if self.config['current_project_path'] is None: 369 | project_title = 'Untitled Project' 370 | else: 371 | project_title = os.path.basename(self.config['current_project_path']).replace('.pd2dsy', '') 372 | unchanged_character = '' if self.get_unchanged() else '●' 373 | self.root.title(f'{unchanged_character} {project_title} - {self.window_title}') 374 | 375 | def update_recent_files(self, most_recent): 376 | if most_recent in self.config['recent_paths']: 377 | self.config['recent_paths'].remove(most_recent) 378 | self.config['recent_paths'].insert(0, most_recent) 379 | if len(self.config['recent_paths']) > 10: 380 | self.config['recent_paths'] = self.config['recent_paths'][:10] 381 | 382 | self.menu_recent.delete(0, tk.END) 383 | 384 | for path in self.config['recent_paths']: 385 | self.menu_recent.add_command(label=path, command=lambda f=path: self.load_recent_or_example(f)) 386 | 387 | def reset_objects(self): 388 | for obj in self.saveable_wrappers: 389 | obj.reset_state() 390 | 391 | def ask_to_save(self, end_message=''): 392 | if not self.get_unchanged(): 393 | return messagebox.askyesnocancel('Unsaved Changes', f'Save changes{end_message}?') 394 | return False 395 | 396 | def get_save_dict(self): 397 | save_dict = {} 398 | for obj in self.saveable_wrappers: 399 | if obj in self.fb_wrappers: 400 | # Convert project paths to relative for cross-platform compatibility 401 | full_path = obj.get_value() 402 | if not full_path or self.config['current_project_path'] is None: 403 | save_dict[obj.id] = full_path 404 | else: 405 | proj_path = os.path.dirname(self.config['current_project_path']) 406 | save_dict[obj.id] = os.path.relpath(full_path, proj_path) 407 | else: 408 | save_dict[obj.id] = obj.get_value() 409 | return save_dict 410 | 411 | def save_config(self): 412 | try: 413 | for browser in self.fb_wrappers: 414 | self.config['file_browser_paths'][browser.id] = browser.default_dir 415 | with open(self.configuration_file, 'w') as file: 416 | json.dump(self.config, file) 417 | except OSError as e: 418 | raise e 419 | 420 | def save_project(self, save_path): 421 | try: 422 | self.config['current_project_path'] = save_path 423 | with open(save_path, 'w') as file: 424 | json.dump(self.get_save_dict(), file) 425 | self.update_recent_files(save_path) 426 | self.save_config() 427 | self.set_unchanged() 428 | self.update_project_state() 429 | except OSError as e: 430 | raise e 431 | 432 | def get_is_fb(self, id): 433 | for obj in self.fb_wrappers: 434 | if obj.id == id: 435 | return True 436 | return False 437 | 438 | def load_project(self, load_path): 439 | try: 440 | with open(load_path, 'r') as file: 441 | project_data = json.load(file) 442 | wrappers_as_dict = {w.id: w for w in self.saveable_wrappers} 443 | for id, value in project_data.items(): 444 | if self.get_is_fb(id): 445 | # expand the relative path into a full one 446 | if value: 447 | proj_path = os.path.dirname(load_path) 448 | absolute_path = os.path.abspath(os.path.join(proj_path, value)) 449 | wrappers_as_dict[id].load_from_save(absolute_path) 450 | else: 451 | wrappers_as_dict[id].load_from_save(value) 452 | else: 453 | wrappers_as_dict[id].load_from_save(value) 454 | self.config['current_project_path'] = load_path 455 | self.update_recent_files(load_path) 456 | except FileNotFoundError as e: 457 | self.config['current_project_path'] = None 458 | self.reset_objects() 459 | 460 | self.save_config() 461 | self.set_unchanged() 462 | self.update_project_state() 463 | 464 | def load_recent_or_example(self, file): 465 | save_status = self.ask_to_save(end_message=' before opening') 466 | if save_status is None: 467 | return 468 | 469 | if save_status: 470 | self.operation_save() 471 | 472 | self.load_project(file) 473 | 474 | def operation_new(self, *args): 475 | save_status = self.ask_to_save(' before opening new project') 476 | if save_status is None: 477 | return 478 | 479 | if save_status: 480 | self.operation_save() 481 | 482 | self.config['current_project_path'] = None 483 | self.save_config() 484 | self.reset_objects() 485 | self.set_unchanged() 486 | self.update_project_state() 487 | 488 | def operation_open(self, *args): 489 | save_status = self.ask_to_save(end_message=' before opening') 490 | if save_status is None: 491 | return 492 | 493 | if save_status: 494 | self.operation_save() 495 | 496 | kwargs = {} 497 | if self.config['last_save_as_path'] is not None: 498 | kwargs['initialdir'] = self.config['last_save_as_path'] 499 | file_path = filedialog.askopenfilename(filetypes=(('pd2dsy project', '*.pd2dsy'), ('all files', '*.*')), **kwargs) 500 | if file_path: 501 | self.config['last_open_path'] = os.path.dirname(os.path.abspath(file_path)) 502 | self.load_project(file_path) 503 | 504 | def operation_save(self, *args): 505 | if self.config['current_project_path'] is None or self.config['current_project_path'] in self.example_paths: 506 | self.operation_save_as() 507 | else: 508 | if not self.get_unchanged(): 509 | self.save_project(self.config['current_project_path']) 510 | 511 | def operation_save_as(self, *args): 512 | kwargs = {} 513 | if self.config['last_save_as_path'] is not None: 514 | kwargs['initialdir'] = self.config['last_save_as_path'] 515 | file_path = filedialog.asksaveasfilename(filetypes=(('pd2dsy project', '*.pd2dsy'), ('all files', '*.*')), 516 | defaultextension="*.*", 517 | **kwargs) 518 | if file_path: 519 | self.config['last_save_as_path'] = os.path.dirname(os.path.abspath(file_path)) 520 | self.save_project(file_path) 521 | 522 | def on_close(self): 523 | save_status = self.ask_to_save(' before closing') 524 | if save_status is None: 525 | return 526 | 527 | if save_status: 528 | self.operation_save() 529 | self.save_config() 530 | else: 531 | self.save_config() 532 | 533 | self.root.destroy() 534 | 535 | 536 | class StatusBarWrapper: 537 | def __init__(self, frame, darktheme_override=None): 538 | self.status_bar = ttk.Label(frame, text="", anchor=tk.W, padding='5 2 5 2') 539 | self.status_bar.pack(side=tk.BOTTOM, fill=tk.X) 540 | 541 | darktheme_var = darkdetect.isDark() 542 | if darktheme_override is not None: 543 | darktheme_var = darktheme_override 544 | 545 | if darktheme_var: 546 | self.status_bar.config(background="#303030") 547 | else: 548 | self.status_bar.config(background="#CCCCCC") 549 | 550 | def set_value(self, value): 551 | self.status_bar.config(text=value) 552 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------