/ CONTRIBUTING.org
CONTRIBUTING.org
  1  #+TITLE: CONTRIBUTING
  2  #+AUTHOR: Mumtahin Farabi
  3  #+auto_tangle: nil
  4  
  5  #+PROPERTY: header-args :comments link :noweb yes :mkdirp yes :padline no
  6  
  7  * microvisor.el ([[https://github.com/mohkale/compile-multi][compile-multi]] + [[https://github.com/rejeep/prodigy.el][prodigy]])
  8  #+begin_SRC emacs-lisp :tangle .dir-locals.el
  9  ;; Copyright (C) 2022-2025 Free Software Foundation, Inc.
 10  
 11  ;; This file is not part of GNU Emacs.
 12  
 13  ;; This program is free software: you can redistribute it and/or modify
 14  ;; it under the terms of the GNU General Public License as published by
 15  ;; the Free Software Foundation, either version 3 of the License, or
 16  ;; (at your option) any later version.
 17  
 18  ;; This program is distributed in the hope that it will be useful,
 19  ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 20  ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21  ;; GNU General Public License for more details.
 22  
 23  ;; You should have received a copy of the GNU General Public License
 24  ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 25  
 26  ((nil .
 27        ((compile-multi-annotate-cmds . t)
 28         (compile-multi-annotate-limit . 10)
 29         (compile-multi-annotate-string-cmds . nil)
 30         (compile-multi-group-cmds . group-and-replace)
 31         ;; ================================================================================================================================================================== ;;
 32         (compile-multi-dir-local-config
 33          . ((t
 34              ;; ======================================|=======|===============================================|=========|===========================|===========|============ ;;
 35              ("󱄅 microvisor :󰔡 activate"           :command "nix run .#activate"                                                                 :annotation "       nix ")
 36              ;; ======================================|=======|===============================================|=========|===========================|===========|============ ;;
 37              ("󱄅 microvisor :󰋽 info"               :command "devenv info"                                  :prodigy t                            :annotation "    devenv 󱄅")
 38              ("󱄅 microvisor :󰇺 tasks"              :command "devenv tasks list"                            :prodigy t                            :annotation "    devenv 󱄅")
 39              ("󱄅 microvisor :󰚦 down"               :command "devenv processes down"                        :prodigy t                            :annotation "    devenv 󱄅")
 40              ("󱄅 microvisor : sqld"               :command "devenv up sqld"                               :prodigy t :port 8080                 :annotation "    devenv 󱄅")
 41              ("󱄅 microvisor : caddy"              :command "devenv up caddy"                              :prodigy t :port   80                 :annotation "    devenv 󱄅")
 42              ("󱄅 microvisor :󰇮 mailpit"            :command "devenv up mailpit"                            :prodigy t :port 8025                 :annotation "    devenv 󱄅")
 43              ("󱄅 microvisor : postgres"           :command "devenv up postgres"                           :prodigy t :port 5432                 :annotation "    devenv 󱄅")
 44              ("󱄅 microvisor : tailscale"          :command "devenv up tailscale"                          :prodigy t :port 8080                 :annotation "    devenv 󱄅")
 45              ("󱄅 microvisor : prometheus"         :command "devenv up prometheus"                         :prodigy t :port 9090                 :annotation "    devenv 󱄅")
 46              ;; ======================================|=======|===============================================|=========|===========================|===========|============ ;;
 47              (" loco : start"                    :command "cargo loco start"                             :prodigy t :port 5150                 :annotation "     cargo ")
 48              (" loco : db"                       :command "cargo loco db"                                :prodigy t                            :annotation "     cargo ")
 49              (" loco :󱤟 db:status"                :command "cargo loco db status"                         :prodigy t                            :annotation "     cargo ")
 50              (" loco :󱘽 db:migrate:up"            :command "cargo loco db migrate up"                     :prodigy t                            :annotation "     cargo ")
 51              (" loco :󱘼 db:migrate:down"          :command "cargo loco db migrate up"                     :prodigy t                            :annotation "     cargo ")
 52              (" loco :󰆺 db:seed"                  :command "cargo loco db seed"                           :prodigy t                            :annotation "     cargo ")
 53              (" loco :󰑪 routes"                   :command "cargo loco routes"                            :prodigy t                            :annotation "     cargo ")
 54              (" loco :󰣖 jobs"                     :command "cargo loco jobs"                              :prodigy t                            :annotation "     cargo ")
 55              (" loco : doctor"                   :command "cargo loco doctor"                            :prodigy t                            :annotation "     cargo ")
 56              ;; ======================================|=======|===============================================|=========|===========================|===========|============ ;;
 57              ;; ======================================|=======|===============================================|=========|===========================|===========|============ ;;
 58              ;; ======================================|=======|===============================================|=========|===========================|===========|============ ;;
 59              ("󱄅 microvisor : openbsd:upgrade"    :command "doas pkg_add -u                  "                                                  :annotation "   pkg_add ")
 60              ("󱄅 microvisor :󰣠 freebsd:upgrade"    :command "sudo pkg update && pkg upgrade -y"                                                  :annotation "       pkg 󰣠")
 61              ("󱄅 microvisor : darwin:switch"      :command "darwin-rebuild switch --flake .  "                                                  :annotation "       nix ")
 62              ("󱄅 microvisor :󰘳 darwin:rebuild"     :command "darwin-rebuild build  --flake .  "                                                  :annotation "       nix ")
 63              ("󱄅 microvisor : guix:pull"          :command "guix pull                        "                                                  :annotation "      guix ")
 64              ("󱄅 microvisor : nixos:rebuild"      :command "nixos-rebuild  build  --flake .  "                                                  :annotation "       nix ")
 65              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 66              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 67              ("󱄅 microvisor : arch:upgrade"       :command "sudo pacman -Syu                 "                                                  :annotation "    pacman ")
 68              ("󱄅 microvisor : debian:upgrade"     :command "sudo apt update && sudo apt upgrade -y"                                             :annotation "       apt ")
 69              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 70              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 71              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 72              ("󰕮 microtop 󰕮:󰐊 run"                  :command "cargo r -rp microtop"                          :prodigy t                           :annotation "     cargo ")
 73              ("󰕮 microtop 󰕮:󰳽 serve"                :command "trunk serve --config apps/microtop/Trunk.toml" :prodigy t :port 8080                :annotation "     cargo ")
 74              ;; ======================================|=======|================================================|=========|=================================================== ;;
 75              ;; ======================================|=======|================================================|=========|=================================================== ;;
 76              ("󰦉 web 󰦉:󰳽 serve"                     :command "dx serve -p web"                               :prodigy t                           :annotation "    dioxus ")
 77              ("󰦉 web 󰦉:󰟀 serve:desktop"             :command "dx serve -p web"                               :prodigy t                           :annotation "    dioxus ")
 78              ("󰦉 web 󰦉: serve:ssg"                 :command "dx serve -rp web --ssg"                        :prodigy t :port 8080                :annotation "    dioxus ")
 79              ("󰦉 web 󰦉:󰡢 build"                     :command "dx build -p web"                               :prodigy t                           :annotation "    dioxus ")
 80              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 81              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 82              (" tui :󰐊 run"                       :command "cargo r -rp tui"                               :prodigy t                           :annotation "     cargo ")
 83              (" tui :󰍹 run:simulate"              :command "cargo r -rp tui --bin simulator"               :prodigy t                           :annotation "     cargo ")
 84              (" tui :󰇉 run:simulate(min) "        :command "cargo r -rp tui --bin simulator-minimal"       :prodigy t                           :annotation "     cargo ")
 85              (" tui :󰳽 serve"                     :command "trunk serve"                                   :prodigy t :port 8080                :annotation "     cargo ")
 86              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 87              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 88              ;; ======================================|=======|================================================|=========|==========================|===========|============ ;;
 89              (" ESP32 :󰐊 run"                     :command "cargo +esp rr"                                                                      :annotation "cargo +esp ")
 90              ;; ======================================|=======|=====================================================================================|===========|============ ;;
 91              ;; ======================================|=======|=====================================================================================|===========|============ ;;
 92  
 93              (" ESP32S3 :󰐊 build"                 :command "pio run"                                                                            :annotation "cargo +esp ")
 94              ;; (" ESP32S3 :󰐊 build"                 :command "cargo +esp bb -r"                                                                   :annotation "cargo +esp ")
 95              (" ESP32S3 :󱈝 build:partition"       :command "cargo espflash partition-table boards/esp32s3.partitions.csv"                       :annotation "cargo +esp ")
 96  
 97              (" ESP32S3 :󰔰 flash"                 :command "pio run -t upload --upload-port '/dev/cu.usbmodem2101'"                             :annotation "cargo +esp ")
 98              (" ESP32S3 : upload"                :command "pio run -t uploadfs"                                                                :annotation "cargo +esp ")
 99              ;; (" ESP32S3 :󰔰 flash"                 :command "cargo +esp flash --target xtensa-esp32s3-none-elf"                                  :annotation "cargo +esp ")
100              ;; (" ESP32S3 : upload"                :command "cargo loco t upload"                                                                :annotation "cargo +esp ")
101              (" ESP32S3 : debug"                 :command "cargo +esp rr"                                                                      :annotation "cargo +esp ")
102              (" ESP32S3 :󰭎 monitor"               :command "probe-rs run"                                  :prodigy nil                         :annotation "cargo +esp ")
103  
104              (" ESP32S3 :󱠡 test:hello"            :command "cargo +esp tt --test hello        "                                                 :annotation "cargo +esp ")
105              (" ESP32S3 :󰋊 test:spi"              :command "cargo +esp tt --test spi          "                                                 :annotation "cargo +esp ")
106              (" ESP32S3 :󱂛 test:http_api"         :command "cargo +esp tt --test http_api     "                                                 :annotation "cargo +esp ")
107              (" ESP32S3 :󰈘 test:sd_card_webpage"  :command "cargo +esp tt --test sd_card_webpage"                                               :annotation "cargo +esp ")
108              (" ESP32S3 : test:sdhost"           :command "cargo +esp tt --test sdhost       "                                                 :annotation "cargo +esp ")
109              (" ESP32S3 :󰹤 test:ota"              :command "cargo +esp tt --test ota_probe    "                                                 :annotation "cargo +esp ")
110              (" ESP32S3 : test:i2c"              :command "cargo +esp tt --test i2c          "                                                 :annotation "cargo +esp ")
111              (" ESP32S3 :󰒪 test:sntp"             :command "cargo +esp tt --test sntp         "                                                 :annotation "cargo +esp ")
112              (" ESP32S3 :󰜤 test:scd30"            :command "cargo +esp tt --test scd30        "                                                 :annotation "cargo +esp ")
113              (" ESP32S3 :󰟤 test:scd4x"            :command "cargo +esp tt --test scd4x        "                                                 :annotation "cargo +esp ")
114              (" ESP32S3 : test:ds3231"           :command "cargo +esp tt --test ds3231       "                                                 :annotation "cargo +esp ")
115              (" ESP32S3 : test:filesystem"       :command "cargo +esp tt --test filesystem   "                                                 :annotation "cargo +esp ")
116              (" ESP32S3 : test:ntc_formula"      :command "cargo +esp tt --test ntc_formula  "                                                 :annotation "cargo +esp ")
117              (" ESP32S3 : e2e:microvisor"        :command "cargo +esp tt --test microvisor   "                                                 :annotation "cargo +esp ")
118              (" ESP32S3 :󱡬 example:gpio"          :command "cargo +esp rr --example gpio      "                                                 :annotation "cargo +esp ")
119              ;; (" ESP32S3 : example:mdns"          :command "cargo +esp rr --example mdns_responder"                                             :annotation "cargo +esp ")
120              (" ESP32S3 :󰒲 example:deep_sleep"    :command "cargo +esp rr --example deep_sleep"                                                 :annotation "cargo +esp ")
121              (" ESP32S3 :󰒲 example:defmt-tcp"     :command "cargo +esp rr --example defmt-tcp "                                                 :annotation "cargo +esp ")
122              (" ESP32S3 :󰐊 pio run"               :command "pio run                                                                          "  :annotation "platformio ")
123              (" ESP32S3 :󰔰 pio run -t upload"     :command "pio run -t upload                                                                "  :annotation "platformio ")
124              (" ESP32S3 :󰭎 pio device monitor"    :command "pio device monitor                                                               "  :annotation "platformio ")
125              ;; ======================================|=======|============================================================================================================== ;;
126              ;; ======================================|=======|============================================================================================================== ;;
127              ;; ======================================|=======|============================================================================================================== ;;
128              ("󰚗 STM32H723ZG 󰚗:󰔰 flash"             :command "cargo r -r    --bin stm32h723zg                    --target thumbv7em-none-eabihf"  :annotation "     cargo ")
129              ("󰚗 STM32H723ZG 󰚗: debug"             :command "cargo r       --bin stm32h723zg                    --target thumbv7em-none-eabihf"  :annotation "     cargo ")
130              ;; ======================================|=======|============================================================================================================== ;;
131              )))
132         ;; ===========================================|=======|============================================================================================================== ;;
133         (eval . (progn
134                   (require 'seq) (require 'cl-lib) (require 'subr-x) (require 'prodigy) (require 'compile-multi) (require 'nerd-icons nil t)
135                   ;; ========================================================================================================================================================= ;;
136                   (defun my/compile-multi-local-annotation (original-function task)
137                     (if-let* ((annotation_text (plist-get (cdr task) :annotation)) ((stringp annotation_text)) ((fboundp 'nerd-icons-icon-for-file))
138                               (annotation_words (split-string (string-trim-right annotation_text) "[[:space:]]+" t))
139                               (icon_file_name (alist-get (car annotation_words) '(("cargo" . "Cargo.toml") ("nix" . "flake.nix") ("devenv" . "flake.nix")) nil nil #'string=)))
140                         (let* ((annotation_base (string-join (if (> (length annotation_words) 1) (butlast annotation_words) annotation_words) " "))
141                                (annotation_text_truncated (if (and compile-multi-annotate-limit (> (length annotation_base) compile-multi-annotate-limit))
142                                                               (concat (truncate-string-to-width annotation_base compile-multi-annotate-limit) "…") annotation_base))
143                                (annotation_rendered (concat (propertize annotation_text_truncated 'face 'completions-annotations) " " (nerd-icons-icon-for-file icon_file_name)))
144                                (annotation_width (string-width (substring-no-properties annotation_rendered))))
145                           (concat " " (propertize " " 'display `(space :align-to (- right ,(+ 1 annotation_width)))) annotation_rendered))
146                       (funcall original-function task))) ;; end defun my/compile-multi-local-annotation
147                   ;; ========================================================================================================================================================= ;;
148                   (unless (advice-member-p #'my/compile-multi-local-annotation #'compile-multi--annotation-function)
149                     (advice-add 'compile-multi--annotation-function :around #'my/compile-multi-local-annotation)) ;; end unless
150                   (defun my/compile-multi-running-prodigy-face (original-function tasks)
151                     (mapcar
152                      (lambda (task)
153                        (let* ((title (car task))
154                               (plist (cdr task))
155                               (plain-title (substring-no-properties title))
156                               (service (and (plist-get plist :prodigy) (prodigy-find-service plain-title))))
157                          (if (and service (prodigy-service-started-p service))
158                              (let ((title* (copy-sequence title))) (add-face-text-property 0 (length title*) 'prodigy-green-face t title*) (cons title* plist))
159                            task)))
160                      (funcall original-function tasks)))
161  
162                   (unless (advice-member-p #'my/compile-multi-running-prodigy-face #'compile-multi--add-properties)
163                     (advice-add 'compile-multi--add-properties :around #'my/compile-multi-running-prodigy-face))
164                   ;; ========================================================================================================================================================= ;;
165                   (dolist (task (seq-filter (lambda (task) (plist-get (cdr task) :prodigy)) (thread-first (compile-multi--config-tasks) (compile-multi--fill-tasks) (compile-multi--add-properties))))
166  
167                     (let* ((title        (car task))
168                            (plist        (cdr task))
169                            (port         (plist-get plist :port))
170                            (plain-title  (substring-no-properties title))
171                            (command      (or (get-text-property 0 'compile-multi--task title) (plist-get plist :command)))
172                            (group-label  (or (get-text-property 0 'consult--type title) (if (string-match "\\`\\([^:]+\\):\\(.*\\)\\'" plain-title) (string-trim (match-string 1 plain-title)) plain-title)))
173                            (display-name (if (string-match "\\`\\([^:]+\\):\\(.*\\)\\'" plain-title) (string-trim (match-string 2 plain-title)) plain-title)))
174  
175                       (apply #'prodigy-define-service
176                              (append
177                               (list
178                                :stop-signal                 'kill
179                                :name                        plain-title
180                                :display-name                display-name
181                                :group-label                 (format "%s" group-label)
182                                :kill-process-buffer-on-stop 'unless-visible
183                                :command                     shell-file-name
184                                :cwd                         (projectile-project-root)
185                                :args                        (list shell-command-switch command))
186                               (when port                    (list :port port))))))
187                   ;; ========================================================================================================================================================= ;;
188                   ;; (add-to-list
189                   ;;  'dape-configs
190                   ;;  '(probe-rs
191                   ;;    :chip "esp32s3" :request "launch" :type "probe-rs-debug" :consoleLogLevel "Console" :flashingConfig (:flashingEnabled t)
192  
193                   ;;    port :autoport host "localhost" command "probe-rs"
194                   ;;    modes (rust-mode rustic-mode)
195                   ;;    compile "cargo +esp b -p firmware  --example gpio --target xtensa-esp32s3-none-elf"
196                   ;;    command-args ("dap-server" "--port" ":autoport")
197                   ;;    command-cwd (lambda () (project-root (project-current)))
198                   ;;    :fn (lambda (config) (if (derived-mode-p 'dape-repl-mode) config (plist-put config 'compile nil)))
199                   ;;    :coreConfigs [(
200                   ;;                   :coreIndex 0
201                   ;;                   :rttEnabled t
202                   ;;                   :rttChannelFormats [(:channelNumber 0 :showTimestamps t :dataFormat "String")]
203                   ;;                   :svdFile (lambda () (let ((f (expand-file-name "boards/esp32s3.svd" (project-root (project-current)))))
204                   ;;                                         (unless (file-exists-p f) (error "Missing SVD file: %s" f)) f))
205                   ;;                   :programBinary (lambda () (expand-file-name "target/xtensa-esp32s3-none-elf/debug/examples/gpio" (project-root (project-current))))
206                   ;;                   )]
207                   ;;    ))
208                   ;; ========================================================================================================================================================= ;;
209                   )) ;; end eval
210         )))
211  #+end_src
212  
213  * Files
214  ** Firmware
215  *** [[https://github.com/probe-rs/probe-rs][probe-rs]]
216  
217  #+begin_src toml :tangle .probe-rs.toml
218  [presets.default]
219  speed = 40000
220  chip = "esp32s3"
221  always-print-stacktrace = true
222  # idf-partition-table = "boards/esp32s3.partitions.csv"
223  log-format = "{[{L:bold:green:4}]%bold} {s:bold:white} :: {ff:bold:magenta}:{l:bold:cyan}"
224  
225  [presets.esp32-s3-devkitc-1]
226  chip = "esp32s3"
227  host = "ws://rpi5-16:8443"
228  probe = "303a:1001:1C:DB:D4:40:4E:38"
229  token = "rpi5-16"
230  
231  [presets.seeed_xiao_esp32s3]
232  chip = "esp32s3"
233  probe = "303a:1001:D8:3B:DA:74:82:E8"
234  
235  [presets.stm32h723zg]
236  always-print-stacktrace = true
237  chip = "stm32h723zg"
238  preverify = true
239  
240  [server]
241  address = "rpi5-16"
242  port = 8443
243  
244  [[server.users]]
245  name = "mfarabi"
246  token = "rpi5-16"
247  #+end_src
248  
249  *** [[https://github.com/probe-rs/cargo-embed][cargo-embed]]
250  
251  #+begin_src toml :tangle Embed.toml
252  [default.general]
253  chip        = "esp32s3"
254  
255  [default.probe]
256  protocol    = "Jtag"
257  
258  [default.rtt]
259  enabled     = true
260  timeout     = 3000
261  log_enabled = false
262  up_channels = [
263      { channel = 0, mode = "BlockIfFull", format = "Defmt", show_location = true },
264  ]
265  
266  down_channels = [
267      { channel = 0, mode = "BlockIfFull" },
268  ]
269  
270  [default.flashing]
271  enabled                 = true
272  restore_unwritten_bytes = true
273  
274  [default.reset]
275  enabled                 = true
276  halt_afterwards         = false
277  
278  [default.gdb]
279  enabled                 = false
280  #+end_src
281  
282  *** [[https://github.com/esp-rs/espflash][espflash]]
283  
284  #+begin_src toml :tangle espflash.toml
285  [idf_format_args]
286  target_app_partition = "ota_0"
287  partition_table = "boards/esp32s3.partitions.csv"
288  #+end_src
289  
290  *** [[https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-toolchain-file][rust-toolchain.toml]]
291  #+begin_src toml :tangle firmware/rust-toolchain.toml
292  [toolchain]
293  channel = "esp"
294  profile = "minimal"
295  # channel = "stable"
296  
297  components = [
298      "rustc",
299      "cargo",
300      "clippy",
301      "rustfmt",
302      "rust-src",
303      "rust-analyzer",
304      "rustfmt",
305  ]
306  
307  targets = [
308      "thumbv6m-none-eabi",
309      "thumbv7em-none-eabihf",
310      "thumbv8m.main-none-eabihf",
311      "riscv32imac-unknown-none-elf",
312  ]
313  #+end_src
314  
315  *** [[https://doc.rust-lang.org/clippy/configuration.html][clippy.toml]]
316  #+begin_src toml :tangle firmware/clippy.toml
317  stack-size-threshold = 1024
318  # stack-size-threshold = 8196 # cyd
319  #+end_src
320  
321  *** platformio
322  
323  #+begin_src conf :tangle platformio.ini
324  [platformio]
325  name         = microvisor
326  default_envs = ceratina
327  
328  lib_dir      = libs
329  test_dir     = tests
330  data_dir     = firmware/data
331  
332  [env]
333  framework         = arduino
334  platform          = espressif32
335  
336  # targets           =  upload, monitor
337  lib_ldf_mode      = chain
338  lib_compat_mode   = strict
339  lib_deps          =
340    ewpa/LibSSH-ESP32@5.8.0
341    marcinbor85/MicroShell@0.1.0
342  
343  build_src_filter  = +<*>, -<*.rs>, -<.git/>, -<.svn/>, -<**/*.rs>
344  
345  monitor_speed     = 115200
346  upload_port       = /dev/cu.usbserial-110
347  # monitor_filters   =  raw
348  
349  upload_speed      = 921600
350  
351  test_build_src    = true
352  test_framework    = custom
353  test_port         = ${env.upload_port}
354  test_speed        = ${env.monitor_speed}
355  
356  [env:ceratina]
357  # board_build.flash_mode  = qio
358  board_build.filesystem  = littlefs
359  # board_build.f_flash     = 80000000L
360  board_build.f_cpu       = 240000000L
361  # board_build.arduino.memory_type = qio_opi
362  board                   = esp32-s3-devkitc-1
363  
364  build_flags             =
365    # -DBOARD_HAS_PSRAM
366    # -DARDUINO_USB_MODE=1
367    # -DARDUINO_USB_CDC_ON_BOOT=1
368    # -mfix-esp32-psram-cache-issue
369    # -DCORE_DEBUG_LEVEL=5
370  #+end_src
371  
372  **** Other
373  ESP32-S3 flash is 8MB, divided into a dual-OTA layout for safe over-the-air updates.
374  The bootloader checks =otadata= to decide whether to boot from =ota_0= or =ota_1=.
375  A new firmware image is written to the *inactive* slot, then =otadata= is flipped.
376  If the new image fails to boot, the bootloader rolls back automatically.
377  
378  | Partition | Offset   | Size  | Purpose                                           |
379  |-----------+----------+-------+---------------------------------------------------|
380  | =nvs=       | =0x9000=   | 16 KB | Non-volatile storage (WiFi credentials, settings) |
381  | =otadata=   | =0xD000=   | 8 KB  | Tracks which OTA slot is active                   |
382  | =phy_init=  | =0xF000=   | 4 KB  | RF calibration data for WiFi/BLE                  |
383  | =ota_0=     | =0x10000=  | ~4 MB | Primary firmware slot                             |
384  | =ota_1=     | =0x400000= | 4 MB  | Secondary firmware slot (OTA target)              |
385  
386  #+begin_src csv :tangle boards/esp32s3.partitions.csv
387  # https://docs.espressif.com/projects/esp-idf/en/stable/esp32s3/api-guides/partition-tables.html
388  
389  # Name,   Type, SubType, Offset,   Size,     Flags
390  nvs,      data, nvs,     0x9000,   0x4000,
391  otadata,  data, ota,     0xd000,   0x2000,
392  phy_init, data, phy,     0xf000,   0x1000,
393  ota_0,    app,  ota_0,   0x10000,  0x3F0000,
394  ota_1,    app,  ota_1,   0x400000, 0x400000,
395  #+end_src
396  
397  
398  ** [[https://sourceware.org/binutils/docs/ld/MEMORY.html][memory.stm32.x]]
399  #+begin_src fundamental :tangle firmware/memory.stm32.x
400  MEMORY
401  {
402  FLASH : ORIGIN = 0x08000000, LENGTH = 1024K
403  RAM   : ORIGIN = 0x20000000, LENGTH = 128K
404  }
405  #+end_src
406  #+begin_SRC .gitignore :tangle .gitignore
407  ** [[https://github.com/DioxusLabs/dioxus][Dioxus]]
408  #+begin_src toml :tangle Dioxus.toml
409  [web.app]
410  title = "🕹 Microvisor Systems 🕹"
411  
412  [application]
413  tailwind_input = "tailwind.css"
414  tailwind_output = "assets/tailwind.css"
415  
416  [bundle]
417  category = "Utility"
418  publisher = "Mumtahin Farabi"
419  icon = ["assets/symbolmark.png"]
420  identifier = "com.microvisorsystems"
421  copyright = "2026 Microvisor Systems"
422  short_description = "General web client."
423  #+end_src
424  #====================================================
425  #              🏗 BUILD/TEST OUTPUTS 🏗
426  #====================================================
427  # .dir-locals.el
428  **/.pio/
429  **/debug/
430  **/result
431  **/zig-out
432  **/target/
433  **/dist
434  assets/static/tui.js
435  assets/static/index.html
436  assets/static/tui_bg.wasm
437  .shellspec
438  **/node_modules
439  tests/env_spec.sh
440  learning/assembly/build/
441  config/data.sqld
442  
443  #====================================================
444  #                 CACHES/LOGS
445  #====================================================
446  logs # MSVC Windows builds of rustc generate these, which store debugging information
447  *.pdb
448  .cache
449  .devenv*
450  .direnv
451  *.sqlite
452  *.sqlite-*
453  **/*.qcow2
454  **/.direnv/
455  **/*.rs.bk
456  .open-webui
457  **/.git-hooks
458  **/.zig-cache
459  devenv.local.nix
460  devenv.local.yaml
461  local.properties
462  .webui_secret_key
463  .pre-commit-config.yaml
464  
465  #====================================================
466  #                  MISCELLANEOUS
467  #====================================================
468  .c9
469  *.pem
470  *tmp*
471  .idea/
472  .project
473  *.launch
474  .vscode/*
475  .DS_Store
476  .settings
477  .classpath
478  !.vscode/settings.json
479  !.vscode/extensions.json
480  !.vscode/settings-example.json
481  
482  #====================================================
483  #                  DEPENDENCIES
484  #====================================================
485  /.pnp
486  .pnp.js
487  
488  opencode.json
489  /.codex/config.toml
490  /compile_commands.json
491  #+END_SRC