diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 52818d3..8c37332 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1 +1,18 @@ FROM letssteam/makecode-toolchain:latest +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + cu \ + curl \ + make \ + software-properties-common \ + tar \ + udev \ + usbutils && \ + apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +RUN adduser vscode dialout && \ + adduser vscode plugdev + +USER vscode +RUN pyocd pack install STM32WB55RGVx && \ + pyocd pack install STM32L475VGTx \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f48e9d7..bdb9a11 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -71,11 +71,19 @@ "[cpp]": { "editor.defaultFormatter": "xaver.clang-format" }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, "editor.rulers": [130], "javascript.validate.enable": false, - "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false, + "javascript.format.semicolons": "insert", "typescript.format.semicolons": "insert", + "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false, "typescript.tsdk": "node_modules/typescript/lib", + "eslint.format.enable": true, "eslint.validate": ["typescript", "typescriptreact"], "C_Cpp.default.compilerPath": "/arm_toolchain/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc", "C_Cpp.default.cStandard": "c23", @@ -91,6 +99,7 @@ "amiralizadeh9480.cpp-helper", "augustocdias.tasks-shell-input", "dan-c-underwood.arm", + "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "github.vscode-pull-request-github", "keroc.hex-fmt", @@ -109,7 +118,9 @@ // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [3232, 3233], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "make setup build", + "postAttachCommand": "make setup build", + "postCreateCommand": "sudo /lib/systemd/systemd-udevd --daemon", + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode" } diff --git a/.gitignore b/.gitignore index ad53497..83b27fe 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ gh-pages _locales package-lock.json .vscode/ipch -*.code-workspace *.DS_STORE .pxt/ *.user diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index b7d2bb1..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recommendations": [ - "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode", - "github.vscode-pull-request-github", - "ms-python.python", - "ms-vscode.cpptools-extension-pack", - "marus25.cortex-debug" - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index bf412db..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,92 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "files.watcherExclude": { - "**/.git/objects/**": true, - "**/built/**": true, - "**/node_modules/**": true, - "**/yotta_modules/**": true, - "**/yotta_targets": true, - "**/pxt_modules/**": true - }, - "search.exclude": { - "**/node_modules": true, - "**/yotta_modules/**": true, - "**/yotta_targets": true, - "**/pxt_modules/**": true - }, - "typescript.tsdk": "./node_modules/typescript/lib", - "files.associations": { - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "*.tcc": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "condition_variable": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "map": "cpp", - "set": "cpp", - "unordered_map": "cpp", - "vector": "cpp", - "exception": "cpp", - "algorithm": "cpp", - "functional": "cpp", - "iterator": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "numeric": "cpp", - "optional": "cpp", - "random": "cpp", - "ratio": "cpp", - "string": "cpp", - "string_view": "cpp", - "system_error": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "utility": "cpp", - "fstream": "cpp", - "initializer_list": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "mutex": "cpp", - "new": "cpp", - "ostream": "cpp", - "ranges": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "stop_token": "cpp", - "streambuf": "cpp", - "thread": "cpp", - "cinttypes": "cpp", - "typeinfo": "cpp" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[jsonc]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "editor.formatOnSave": true, - "files.autoSave": "onFocusChange", - "cmake.configureOnOpen": false, - "terminal.integrated.defaultProfile.linux": "zsh", - "javascript.format.semicolons": "insert", - "typescript.format.semicolons": "insert", - "eslint.format.enable": true -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index f449229..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "build", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [], - "label": "build pxt-steami target", - "detail": "make build" - }, - { - "type": "npm", - "script": "clean", - "group": "build", - "problemMatcher": [], - "label": "clean pxt-steami target" - }, - { - "type": "npm", - "script": "package", - "group": "build", - "problemMatcher": [], - "label": "build static package of pxt-steami" - }, - { - "type": "npm", - "script": "staticserve", - "group": "test", - "problemMatcher": [], - "label": "serve static pxt-steami editor" - }, - { - "type": "npm", - "script": "serve", - "group": "test", - "problemMatcher": [], - "label": "serve pxt-steami editor" - } - ] -} diff --git a/makecode-steami.code-workspace b/makecode-steami.code-workspace new file mode 100644 index 0000000..fde7394 --- /dev/null +++ b/makecode-steami.code-workspace @@ -0,0 +1,263 @@ +{ + "folders": [ + { + "path": "." + }, + + { + "name": "pxt", + "path": "pxt/" + }, + { + "name": "pxt-common-packages", + "path": "pxt-common-packages/" + }, + { + "name": "pxt-steami", + "path": "pxt-steami/" + }, + { + "name": "pxt-steami-backend", + "path": "pxt-steami-backend/" + } + ], + + "settings": { + "C_Cpp.default.browse.path": [ + "${workspaceFolder}/**", + "/arm_toolchain/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/arm-none-eabi/include/**" + ], + + "cmake.generator": "Unix Makefiles", + "cmake.sourceDirectory": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/", + "cmake.buildDirectory": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/build", + + "C_Cpp.default.compileCommands": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/build/compile_commands.json", + "C_Cpp.default.includePath": [ + "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/utils/cmake/toolchains/ARM_GCC/*", + "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/build/libraries/codal-core/gen", + "${workspaceFolder:codal-core}/inc/core/*", + "${workspaceFolder:codal-core}/inc/driver-models/*", + "${workspaceFolder:codal-core}/inc/drivers/*", + "${workspaceFolder:codal-core}/inc/streams/*", + "${workspaceFolder:codal-core}/inc/types/*", + "${workspaceFolder:codal-core}/inc/*", + "${workspaceFolder:codal-stm32}/asm/*", + "${workspaceFolder:codal-stm32}/inc/drivers/*", + "${workspaceFolder:codal-stm32}/inc/*", + "${workspaceFolder:codal-stm32}/source/*", + "${workspaceFolder:codal-stm32}/source/stm32/*", + "${workspaceFolder:codal-stm32}/source/stm32/LL/*", + "${workspaceFolder:codal-stm32}/source/stm32/HAL/*", + "${workspaceFolder:codal-stm32}/source/stm32/OpenAMP/*", + "${workspaceFolder:codal-stm32}/source/stm32/usb/*", + "${workspaceFolder:codal-stm32}/source/stm32/usb/cdc/*", + "${workspaceFolder:codal-stm32}/source/stm32/usb/hid/*", + "${workspaceFolder:codal-stm32}/source/stm32/usb/webusb/*", + "${workspaceFolder:codal-stm32}/system/CMSIS_5/CMSIS/Core/Include/*", + "${workspaceFolder:codal-stm32}/variants/STM32WBxx/WB55R(C-E-G)V/*", + "${workspaceFolder:codal-stm32}/system/Drivers/CMSIS/Device/ST/STM32WBxx/Include/*", + "${workspaceFolder:codal-stm32}/system/Drivers/CMSIS/Device/ST/STM32WBxx/Source/Templates/gcc/*", + "${workspaceFolder:codal-stm32}/system/STM32WBxx/*", + "${workspaceFolder:codal-stm32}/system/Drivers/STM32WBxx_HAL_Driver/Inc/*", + "${workspaceFolder:codal-stm32}/system/Drivers/STM32WBxx_HAL_Driver/Src/*", + "${workspaceFolder:codal-stm32}/system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/*", + "${workspaceFolder:codal-stm32}/system/Middlewares/ST/STM32_USB_Device_Library/Core/Src/*", + "${workspaceFolder:codal-stm32}/system/Middlewares/ST/STM32_USB_Device_Library/Class/WebUSB/Inc/*", + "${workspaceFolder:codal-stm32}/system/Middlewares/ST/STM32_USB_Device_Library/Class/WebUSB/Src/*", + "${workspaceFolder:codal-stm32-STEAM32_WB55RG}/inc/*", + "${workspaceFolder:codal-stm32-STEAM32_WB55RG}/model/*", + "${workspaceFolder:codal-stm32-STEAM32_WB55RG}/samples/*" + ], + + "files.associations": { + "digital_io.h": "c", + "pinconfigured.h": "c", + "hw_config.h": "c", + "peripheralpins.h": "c", + "cstring": "cpp", + "spi_com.h": "c", + "usbd_ctlreq.h": "c", + "usbd_ioreq.h": "c", + "usbd_def.h": "c", + "usbd_webusb.h": "c", + "usbd_ep_conf.h": "c", + "usbd_conf.h": "c", + "stm32_def.h": "c", + "core_cm4.h": "c", + "variant.h": "c" + } + }, + "extensions": { + "recommendations": [ + "amiralizadeh9480.cpp-helper", + "augustocdias.tasks-shell-input", + "dan-c-underwood.arm", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "github.vscode-pull-request-github", + "keroc.hex-fmt", + "marus25.cortex-debug", + "ms-python.python", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor", + "rioj7.command-variable", + "trond-snekvik.gnu-mapfiles", + "vivaxy.vscode-conventional-commits", + "xaver.clang-format", + "ZixuanWang.linkerscript" + ] + }, + "tasks": { + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "label": "build pxt-steami target" + }, + { + "type": "npm", + "script": "clean", + "group": "build", + "problemMatcher": [], + "label": "clean pxt-steami target" + }, + { + "type": "npm", + "script": "package", + "group": "build", + "problemMatcher": [], + "label": "build static package of pxt-steami" + }, + { + "type": "npm", + "script": "staticserve", + "group": "test", + "problemMatcher": [], + "label": "serve static pxt-steami editor" + }, + { + "type": "npm", + "script": "serve", + "group": "test", + "problemMatcher": [], + "label": "serve pxt-steami editor" + }, + { + "label": "flash_openocd", + "args": [], + "type": "shell", + "command": "openocd -s /usr/share/openocd/scripts/ -s ./libraries/codal-stm32-STEAM32_WB55RG/scripts -f openocd.cfg -c 'program build/STM32 verify reset exit'", + "options": { + "cwd": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/" + }, + "presentation": { + "reveal": "silent" + }, + "group": { + "kind": "test", + "isDefault": true + } + }, + { + "label": "flash_pyocd", + "args": [], + "type": "shell", + + "command": "pyocd flash build/STM32 --format elf", + "options": { + "cwd": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal" + }, + "presentation": { + "reveal": "silent" + }, + "group": { + "kind": "test" + } + } + ] + }, + "launch": { + "version": "0.2.0", + "configurations": [ + { + "type": "cortex-debug", + "request": "launch", + "servertype": "openocd", + "cwd": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal", + "executable": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/build/STM32", + "name": "Debug (OpenOCD)", + "svdFile": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/scripts/STM32.svd", + "searchDir": [ + "/usr/share/openocd/scripts/", + "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/scripts/" + ], + "configFiles": ["openocd.cfg"], + "liveWatch": { + "enabled": true, + "samplesPerSecond": 4 + }, + "preLaunchTask": "flash_openocd", + "runToEntryPoint": "main", + "showDevDebugOutput": "parsed", + "preLaunchCommands": [ + "set mem inaccessible-by-default off", + "enable breakpoint", + "monitor reset" + ] + }, + { + "type": "cortex-debug", + "request": "launch", + "servertype": "pyocd", + "cwd": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal", + "executable": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/build/STM32", + "name": "Debug (PyOCD)", + "svdFile": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/scripts/STM32.svd", + "preLaunchTask": "flash_pyocd", + "runToEntryPoint": "main", + "showDevDebugOutput": "parsed" + }, + { + "type": "cortex-debug", + "request": "attach", + "servertype": "openocd", + "cwd": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal", + "executable": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/build/STM32", + "name": "Debug (OpenOCD) -- attach", + "svdFile": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/scripts/STM32.svd", + "searchDir": [ + "/usr/share/openocd/scripts/", + "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/scripts/" + ], + "configFiles": ["openocd.cfg"], + "liveWatch": { + "enabled": true, + "samplesPerSecond": 4 + }, + "preLaunchTask": "flash_openocd", + "runToEntryPoint": "main", + "showDevDebugOutput": "parsed" + }, + { + "type": "cortex-debug", + "request": "attach", + "servertype": "pyocd", + "cwd": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal", + "executable": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/build/STM32", + "name": "Debug (PyOCD) -- attach", + "svdFile": "${workspaceFolder:pxt-steami}/libs/blocksprj/built/codal/scripts/STM32.svd", + "preLaunchTask": "build current target", + "runToEntryPoint": "main", + "showDevDebugOutput": "parsed" + } + ], + "compounds": [] + } +} diff --git a/pxt-steami/pxtarget.json b/pxt-steami/pxtarget.json index 1375443..ee7c233 100644 --- a/pxt-steami/pxtarget.json +++ b/pxt-steami/pxtarget.json @@ -80,9 +80,9 @@ }, "codalBinary": "STM32", "githubCorePackage": "letssteam/codal", - "gittag": "v0.10.0", + "gittag": "main", "serviceId": "steami", - "dockerImage": "pext/yotta:latest" + "dockerImage": "letssteam/makecode-toolchain:latest" }, "multiVariants": ["codalsteami"], @@ -106,9 +106,9 @@ }, "codalBinary": "STM32", "githubCorePackage": "letssteam/codal", - "gittag": "v0.10.0", - "serviceId": "codalsteami", - "dockerImage": "pext/yotta:latest" + "gittag": "main", + "serviceId": "steami", + "dockerImage": "letssteam/makecode-toolchain:latest" } } },