tan-cli 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. tan/__init__.py +0 -0
  2. tan/__main__.py +120 -0
  3. tan/cli.py +939 -0
  4. tan/command_table.py +265 -0
  5. tan/commands/__init__.py +8 -0
  6. tan/commands/bootstrap_cmd.py +4856 -0
  7. tan/commands/bootstrap_patches.py +164 -0
  8. tan/commands/bootstrap_toolchain_fetch.py +155 -0
  9. tan/commands/bootstrap_toolchain_pin.py +36 -0
  10. tan/commands/build/__init__.py +1 -0
  11. tan/commands/build/configure_inputs.py +277 -0
  12. tan/commands/build/execute.py +1852 -0
  13. tan/commands/build/host_python.py +59 -0
  14. tan/commands/build/link_stale.py +78 -0
  15. tan/commands/build/manifest.py +428 -0
  16. tan/commands/build/materialise.py +81 -0
  17. tan/commands/build/token_substitution.py +381 -0
  18. tan/commands/build/toolchain.py +482 -0
  19. tan/commands/build/user_defines_wipe.py +115 -0
  20. tan/commands/build/workspace_patches.py +65 -0
  21. tan/commands/build_cmd.py +2236 -0
  22. tan/commands/build_output.py +331 -0
  23. tan/commands/clean_cmd.py +1183 -0
  24. tan/commands/completion_cmd.py +786 -0
  25. tan/commands/debug_config_cmd.py +2425 -0
  26. tan/commands/diff_cmd.py +940 -0
  27. tan/commands/doctor_cmd.py +4767 -0
  28. tan/commands/examples_cmd.py +644 -0
  29. tan/commands/explain_cmd.py +1319 -0
  30. tan/commands/faultdecode_cmd.py +931 -0
  31. tan/commands/flash_atoc_guard.py +240 -0
  32. tan/commands/flash_cmd.py +5731 -0
  33. tan/commands/flash_mram_guard.py +150 -0
  34. tan/commands/flash_ram.py +578 -0
  35. tan/commands/flash_raw.py +583 -0
  36. tan/commands/generate_cmd.py +1456 -0
  37. tan/commands/image_cmd.py +753 -0
  38. tan/commands/init_cmd.py +1740 -0
  39. tan/commands/inspect_cmd.py +377 -0
  40. tan/commands/kconfig_cmd.py +734 -0
  41. tan/commands/model_cmd.py +1514 -0
  42. tan/commands/model_device_cmd.py +351 -0
  43. tan/commands/model_device_live.py +234 -0
  44. tan/commands/model_host_cmd.py +430 -0
  45. tan/commands/model_zoo_cmd.py +363 -0
  46. tan/commands/monitor_actions.py +125 -0
  47. tan/commands/monitor_cmd.py +626 -0
  48. tan/commands/monitor_session.py +505 -0
  49. tan/commands/new_som_cmd.py +1522 -0
  50. tan/commands/pinmux_cmd.py +568 -0
  51. tan/commands/presets_cmd.py +1123 -0
  52. tan/commands/probe_cmd.py +421 -0
  53. tan/commands/reset_cmd.py +354 -0
  54. tan/commands/reset_confirm.py +168 -0
  55. tan/commands/run_cmd.py +637 -0
  56. tan/commands/scaffold_cmd.py +490 -0
  57. tan/commands/sdk_cmd.py +1723 -0
  58. tan/commands/size_cmd.py +1020 -0
  59. tan/commands/support_bundle_cmd.py +1073 -0
  60. tan/commands/trace_cmd.py +341 -0
  61. tan/commands/validate_cmd.py +2009 -0
  62. tan/commands/west_forward_cmd.py +736 -0
  63. tan/commands/workspace_patch_check.py +296 -0
  64. tan/core/__init__.py +1 -0
  65. tan/core/alp_conf_pregen.py +100 -0
  66. tan/core/artifact_provenance.py +240 -0
  67. tan/core/atoc_guard.py +276 -0
  68. tan/core/atoc_guard_messages.py +232 -0
  69. tan/core/atoc_replacement.py +118 -0
  70. tan/core/atomic_write.py +178 -0
  71. tan/core/board_context.py +351 -0
  72. tan/core/board_diagnostic.py +111 -0
  73. tan/core/board_files.py +221 -0
  74. tan/core/board_validator.py +542 -0
  75. tan/core/board_validator_compat.py +196 -0
  76. tan/core/board_validator_run.py +129 -0
  77. tan/core/board_validator_schema.py +186 -0
  78. tan/core/board_validator_skew.py +46 -0
  79. tan/core/board_yaml_edit.py +295 -0
  80. tan/core/board_yaml_pos.py +118 -0
  81. tan/core/bootstrap.py +2572 -0
  82. tan/core/build_plan.py +625 -0
  83. tan/core/consent.py +104 -0
  84. tan/core/console_filter.py +245 -0
  85. tan/core/debug_launch.py +1803 -0
  86. tan/core/devicetree_lint.py +168 -0
  87. tan/core/dir_removal.py +229 -0
  88. tan/core/doctor_git.py +172 -0
  89. tan/core/doctor_libraries.py +253 -0
  90. tan/core/doctor_render.py +185 -0
  91. tan/core/doctor_scope.py +66 -0
  92. tan/core/doctor_setools.py +237 -0
  93. tan/core/doctor_stale.py +180 -0
  94. tan/core/document_guards.py +723 -0
  95. tan/core/dp_id.py +97 -0
  96. tan/core/elf_load.py +63 -0
  97. tan/core/error_catalog.py +171 -0
  98. tan/core/example_catalog.py +499 -0
  99. tan/core/example_facets.py +151 -0
  100. tan/core/faultdecode.py +521 -0
  101. tan/core/flash_plan.py +2501 -0
  102. tan/core/flow_d_report.py +381 -0
  103. tan/core/flow_d_uptime.py +164 -0
  104. tan/core/fs_confine.py +130 -0
  105. tan/core/global_flags.py +230 -0
  106. tan/core/host_python.py +210 -0
  107. tan/core/image_bundle.py +247 -0
  108. tan/core/inert.py +147 -0
  109. tan/core/jlink_binary.py +128 -0
  110. tan/core/jlink_probe.py +481 -0
  111. tan/core/jsonc_splice.py +404 -0
  112. tan/core/launch_provenance.py +257 -0
  113. tan/core/link_refusal.py +76 -0
  114. tan/core/metadata_schema.py +376 -0
  115. tan/core/model_check.py +227 -0
  116. tan/core/model_device.py +449 -0
  117. tan/core/model_doctor.py +198 -0
  118. tan/core/model_host.py +48 -0
  119. tan/core/model_list.py +112 -0
  120. tan/core/model_zoo.py +353 -0
  121. tan/core/module_template.py +340 -0
  122. tan/core/mram_link.py +87 -0
  123. tan/core/new_som_ospi.py +94 -0
  124. tan/core/os_class.py +159 -0
  125. tan/core/patch_paths.py +87 -0
  126. tan/core/pending.py +40 -0
  127. tan/core/plain_zephyr_plan.py +138 -0
  128. tan/core/plan_exec.py +373 -0
  129. tan/core/plan_tokens.py +600 -0
  130. tan/core/probe.py +155 -0
  131. tan/core/probe_plan.py +237 -0
  132. tan/core/proxy.py +168 -0
  133. tan/core/publish.py +31 -0
  134. tan/core/python_floor.py +178 -0
  135. tan/core/ram_run.py +694 -0
  136. tan/core/ram_watch.py +231 -0
  137. tan/core/raw_write.py +160 -0
  138. tan/core/reset_plan.py +56 -0
  139. tan/core/run.py +161 -0
  140. tan/core/scaffold.py +2203 -0
  141. tan/core/scaffold_selftest_identity.py +225 -0
  142. tan/core/sdk_default_registry.py +565 -0
  143. tan/core/sdk_discovery.py +996 -0
  144. tan/core/sdk_removal.py +465 -0
  145. tan/core/serial_actions.py +175 -0
  146. tan/core/serial_capture.py +185 -0
  147. tan/core/serial_url.py +45 -0
  148. tan/core/setools.py +608 -0
  149. tan/core/setools_scratch.py +243 -0
  150. tan/core/shapes.py +194 -0
  151. tan/core/size.py +610 -0
  152. tan/core/som_buildability.py +204 -0
  153. tan/core/som_schema_version.py +62 -0
  154. tan/core/subprocess_env.py +201 -0
  155. tan/core/sysbuild_image.py +94 -0
  156. tan/core/system_manifest.py +827 -0
  157. tan/core/text_layout.py +73 -0
  158. tan/core/timestamp.py +182 -0
  159. tan/core/tool_lookup.py +383 -0
  160. tan/core/toolchain_pin.py +117 -0
  161. tan/core/toolchain_provision.py +1224 -0
  162. tan/core/trusted_path.py +134 -0
  163. tan/core/uboot_breakin.py +154 -0
  164. tan/core/uri_reference.py +415 -0
  165. tan/core/user_defines.py +152 -0
  166. tan/core/venv.py +332 -0
  167. tan/core/west_patches.py +143 -0
  168. tan/core/west_workspace_refusal.py +159 -0
  169. tan/core/zephyr_env.py +124 -0
  170. tan/env.py +185 -0
  171. tan/envelope.py +647 -0
  172. tan/exit_codes.py +12 -0
  173. tan/lazy_typer.py +185 -0
  174. tan/model/__init__.py +2 -0
  175. tan/model/_gen_fixture.py +132 -0
  176. tan/model/adapters/__init__.py +116 -0
  177. tan/model/adapters/cpu.py +26 -0
  178. tan/model/adapters/deepx.py +94 -0
  179. tan/model/adapters/drpai.py +242 -0
  180. tan/model/adapters/ethos_u.py +951 -0
  181. tan/model/adapters/executorch.py +55 -0
  182. tan/model/analyze.py +694 -0
  183. tan/model/build.py +304 -0
  184. tan/model/check.py +682 -0
  185. tan/model/manifest.py +625 -0
  186. tan/model/measure.py +216 -0
  187. tan/model/npu_ops_validate.py +130 -0
  188. tan/model/package.py +125 -0
  189. tan/model/perf.py +635 -0
  190. tan/model/perf_apply.py +721 -0
  191. tan/model/prep.py +193 -0
  192. tan/model/sram_fit.py +502 -0
  193. tan/model/targets.py +374 -0
  194. tan/model/tensorio.py +287 -0
  195. tan/net.py +73 -0
  196. tan/output_format.py +213 -0
  197. tan/planner/__init__.py +219 -0
  198. tan/planner/aperture.py +202 -0
  199. tan/planner/buildplan.py +1092 -0
  200. tan/planner/camera_owner.py +192 -0
  201. tan/planner/cameras.py +132 -0
  202. tan/planner/carveout.py +755 -0
  203. tan/planner/cli.py +274 -0
  204. tan/planner/headers.py +315 -0
  205. tan/planner/kconfig.py +2435 -0
  206. tan/planner/kconfig_symbols.py +473 -0
  207. tan/planner/libraries.py +677 -0
  208. tan/planner/link_target.py +237 -0
  209. tan/planner/linux_ownership.py +216 -0
  210. tan/planner/loader.py +1525 -0
  211. tan/planner/manifest.py +116 -0
  212. tan/planner/memory.py +161 -0
  213. tan/planner/memregion.py +56 -0
  214. tan/planner/models.py +533 -0
  215. tan/planner/orchestrator.py +874 -0
  216. tan/planner/ownership.py +203 -0
  217. tan/planner/partition.py +1160 -0
  218. tan/planner/paths.py +32 -0
  219. tan/planner/plain_slice.py +139 -0
  220. tan/planner/project_emit/__init__.py +60 -0
  221. tan/planner/project_emit/bom_netlist.py +375 -0
  222. tan/planner/project_emit/dts.py +580 -0
  223. tan/planner/project_emit/hw_info.py +221 -0
  224. tan/planner/project_emit/native_sim.py +136 -0
  225. tan/planner/project_emit/west_libs.py +213 -0
  226. tan/planner/project_loader.py +264 -0
  227. tan/planner/sdk_capability.py +203 -0
  228. tan/planner/sdk_compat.py +395 -0
  229. tan/planner/secure.py +350 -0
  230. tan/planner/slugs.py +394 -0
  231. tan/planner/som_metadata.py +325 -0
  232. tan/planner/strict_loaders.py +131 -0
  233. tan/planner/template.py +1037 -0
  234. tan/planner/template_pins.py +535 -0
  235. tan/planner/template_rewrite.py +714 -0
  236. tan/planner/topology.py +208 -0
  237. tan/planner/validate.py +365 -0
  238. tan/planner/whole_device_alias.py +67 -0
  239. tan/planner/zephyr_board.py +3510 -0
  240. tan/planner_cli.py +97 -0
  241. tan/planner_emit.py +617 -0
  242. tan/planner_root.py +119 -0
  243. tan/soc_ref.py +58 -0
  244. tan/templates/__init__.py +34 -0
  245. tan/templates/vendored/MANIFEST.md +1862 -0
  246. tan/templates/vendored/diagnostics/E1M-AEN801/CMakeLists.txt +8 -0
  247. tan/templates/vendored/diagnostics/E1M-AEN801/README.md +112 -0
  248. tan/templates/vendored/diagnostics/E1M-AEN801/board.yaml +38 -0
  249. tan/templates/vendored/diagnostics/E1M-AEN801/boards/native_sim_native_64.conf +11 -0
  250. tan/templates/vendored/diagnostics/E1M-AEN801/boards/native_sim_native_64.overlay +29 -0
  251. tan/templates/vendored/diagnostics/E1M-AEN801/prj.conf +5 -0
  252. tan/templates/vendored/diagnostics/E1M-AEN801/src/main.c +266 -0
  253. tan/templates/vendored/diagnostics/E1M-AEN801/testcase.yaml +53 -0
  254. tan/templates/vendored/diagnostics/E1M-V2N101/CMakeLists.txt +8 -0
  255. tan/templates/vendored/diagnostics/E1M-V2N101/README.md +112 -0
  256. tan/templates/vendored/diagnostics/E1M-V2N101/board.yaml +38 -0
  257. tan/templates/vendored/diagnostics/E1M-V2N101/boards/native_sim_native_64.conf +11 -0
  258. tan/templates/vendored/diagnostics/E1M-V2N101/boards/native_sim_native_64.overlay +29 -0
  259. tan/templates/vendored/diagnostics/E1M-V2N101/prj.conf +5 -0
  260. tan/templates/vendored/diagnostics/E1M-V2N101/src/main.c +266 -0
  261. tan/templates/vendored/diagnostics/E1M-V2N101/testcase.yaml +53 -0
  262. tan/templates/vendored/edge-ai/E1M-AEN801/CMakeLists.txt +10 -0
  263. tan/templates/vendored/edge-ai/E1M-AEN801/README.md +75 -0
  264. tan/templates/vendored/edge-ai/E1M-AEN801/board.yaml +38 -0
  265. tan/templates/vendored/edge-ai/E1M-AEN801/prj.conf +8 -0
  266. tan/templates/vendored/edge-ai/E1M-AEN801/src/cold_chain.c +371 -0
  267. tan/templates/vendored/edge-ai/E1M-AEN801/src/cold_chain.h +178 -0
  268. tan/templates/vendored/edge-ai/E1M-AEN801/src/main.c +373 -0
  269. tan/templates/vendored/edge-ai/E1M-AEN801/testcase.yaml +62 -0
  270. tan/templates/vendored/edge-ai/E1M-V2N101/CMakeLists.txt +10 -0
  271. tan/templates/vendored/edge-ai/E1M-V2N101/README.md +75 -0
  272. tan/templates/vendored/edge-ai/E1M-V2N101/board.yaml +37 -0
  273. tan/templates/vendored/edge-ai/E1M-V2N101/prj.conf +8 -0
  274. tan/templates/vendored/edge-ai/E1M-V2N101/src/cold_chain.c +371 -0
  275. tan/templates/vendored/edge-ai/E1M-V2N101/src/cold_chain.h +178 -0
  276. tan/templates/vendored/edge-ai/E1M-V2N101/src/main.c +373 -0
  277. tan/templates/vendored/edge-ai/E1M-V2N101/testcase.yaml +62 -0
  278. tan/templates/vendored/iot/E1M-AEN801/CMakeLists.txt +14 -0
  279. tan/templates/vendored/iot/E1M-AEN801/README.md +103 -0
  280. tan/templates/vendored/iot/E1M-AEN801/board.yaml +69 -0
  281. tan/templates/vendored/iot/E1M-AEN801/prj.conf +15 -0
  282. tan/templates/vendored/iot/E1M-AEN801/src/cc3501e_bridge.c +196 -0
  283. tan/templates/vendored/iot/E1M-AEN801/src/cc3501e_bridge.h +173 -0
  284. tan/templates/vendored/iot/E1M-AEN801/src/main.c +262 -0
  285. tan/templates/vendored/iot/E1M-AEN801/testcase.yaml +68 -0
  286. tan/templates/vendored/minimal/E1M-AEN801/CMakeLists.txt +8 -0
  287. tan/templates/vendored/minimal/E1M-AEN801/README.md +108 -0
  288. tan/templates/vendored/minimal/E1M-AEN801/board.yaml +32 -0
  289. tan/templates/vendored/minimal/E1M-AEN801/prj.conf +8 -0
  290. tan/templates/vendored/minimal/E1M-AEN801/src/main.c +111 -0
  291. tan/templates/vendored/minimal/E1M-AEN801/testcase.yaml +49 -0
  292. tan/templates/vendored/minimal/E1M-V2N101/CMakeLists.txt +8 -0
  293. tan/templates/vendored/minimal/E1M-V2N101/README.md +108 -0
  294. tan/templates/vendored/minimal/E1M-V2N101/board.yaml +32 -0
  295. tan/templates/vendored/minimal/E1M-V2N101/prj.conf +8 -0
  296. tan/templates/vendored/minimal/E1M-V2N101/src/main.c +111 -0
  297. tan/templates/vendored/minimal/E1M-V2N101/testcase.yaml +49 -0
  298. tan/templates/vendored/multicore-mailbox/E1M-AEN801/CMakeLists.txt +8 -0
  299. tan/templates/vendored/multicore-mailbox/E1M-AEN801/README.md +120 -0
  300. tan/templates/vendored/multicore-mailbox/E1M-AEN801/board.yaml +57 -0
  301. tan/templates/vendored/multicore-mailbox/E1M-AEN801/boards/native_sim_native_64.overlay +40 -0
  302. tan/templates/vendored/multicore-mailbox/E1M-AEN801/peer/CMakeLists.txt +13 -0
  303. tan/templates/vendored/multicore-mailbox/E1M-AEN801/peer/main.c +171 -0
  304. tan/templates/vendored/multicore-mailbox/E1M-AEN801/peer/prj.conf +17 -0
  305. tan/templates/vendored/multicore-mailbox/E1M-AEN801/peer/testcase.yaml +23 -0
  306. tan/templates/vendored/multicore-mailbox/E1M-AEN801/prj.conf +22 -0
  307. tan/templates/vendored/multicore-mailbox/E1M-AEN801/src/main.c +185 -0
  308. tan/templates/vendored/multicore-mailbox/E1M-AEN801/testcase.yaml +26 -0
  309. tan/templates/vendored/sensor/E1M-AEN801/CMakeLists.txt +8 -0
  310. tan/templates/vendored/sensor/E1M-AEN801/README.md +112 -0
  311. tan/templates/vendored/sensor/E1M-AEN801/board.yaml +57 -0
  312. tan/templates/vendored/sensor/E1M-AEN801/boards/native_sim_native_64.conf +10 -0
  313. tan/templates/vendored/sensor/E1M-AEN801/boards/native_sim_native_64.overlay +28 -0
  314. tan/templates/vendored/sensor/E1M-AEN801/prj.conf +5 -0
  315. tan/templates/vendored/sensor/E1M-AEN801/src/main.c +186 -0
  316. tan/templates/vendored/sensor/E1M-AEN801/testcase.yaml +52 -0
  317. tan/templates/vendored/sensor/E1M-V2N101/CMakeLists.txt +8 -0
  318. tan/templates/vendored/sensor/E1M-V2N101/README.md +112 -0
  319. tan/templates/vendored/sensor/E1M-V2N101/board.yaml +57 -0
  320. tan/templates/vendored/sensor/E1M-V2N101/boards/native_sim_native_64.conf +10 -0
  321. tan/templates/vendored/sensor/E1M-V2N101/boards/native_sim_native_64.overlay +28 -0
  322. tan/templates/vendored/sensor/E1M-V2N101/prj.conf +5 -0
  323. tan/templates/vendored/sensor/E1M-V2N101/src/main.c +186 -0
  324. tan/templates/vendored/sensor/E1M-V2N101/testcase.yaml +52 -0
  325. tan/version.py +102 -0
  326. tan_cli-0.7.0.dist-info/METADATA +125 -0
  327. tan_cli-0.7.0.dist-info/RECORD +330 -0
  328. tan_cli-0.7.0.dist-info/WHEEL +5 -0
  329. tan_cli-0.7.0.dist-info/entry_points.txt +2 -0
  330. tan_cli-0.7.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,68 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ sample:
4
+ name: mqtt-telemetry
5
+ description: |
6
+ Publish a sensor reading over MQTT/TLS via the portable
7
+ <alp/iot.h> Wi-Fi + MQTT surface. AEN-only: the transport is
8
+ the CC3501E Wi-Fi6+BLE bridge on the E1M-AEN801. On native_sim
9
+ there is no radio, so alp_wifi_open()/alp_mqtt_open() return
10
+ NULL (NOT_READY) and the app prints the telemetry framing it
11
+ would publish, then exits on the done marker.
12
+
13
+ tests:
14
+ alp_sdk.example.mqtt_telemetry.native_sim:
15
+ extra_args: EXTRA_CONF_FILE=generated/alp.conf
16
+ platform_allow:
17
+ - native_sim
18
+ - native_sim/native/64
19
+ integration_platforms:
20
+ - native_sim/native/64
21
+ tags:
22
+ - alp-sdk
23
+ - example
24
+ - iot
25
+ - mqtt
26
+ - aen
27
+ harness: console
28
+ harness_config:
29
+ type: one_line
30
+ regex:
31
+ - "\\[mqtt\\] done"
32
+ # No native_sim.conf any more: it existed only to turn mbedtls off
33
+ # around the ssl_misc.h break, which is fixed at its root (#2173), so
34
+ # this scenario now builds the same TLS-enabled config the SoM does.
35
+ # native_sim's only entropy driver is FAKE_ENTROPY_NATIVE_SIM, whose own
36
+ # Kconfig help says it "does not generate real entropy", so the weak-RNG
37
+ # refusal in zephyr/CMakeLists.txt applies here too (#2192). A simulator
38
+ # run is exactly what the opt-in exists for. It lives on the SCENARIO,
39
+ # not in the app's prj.conf, so a copy scaffolded by `tan init
40
+ # --from-example` and built for real hardware still refuses.
41
+ extra_configs:
42
+ - CONFIG_ALP_SDK_ALLOW_TEST_ENTROPY=y
43
+
44
+ # Issue #2173: the AEN build had no scenario at all, so the one target
45
+ # this app is actually written for -- the CC3501E bridge on an
46
+ # E1M-AEN801 -- was never compiled in CI, and it had stopped compiling
47
+ # (the mbedtls PSA floor, fixed in zephyr/Kconfig.alp-libraries).
48
+ # build_only: there is no radio on a CI runner, so this asserts the
49
+ # image links for the SoM its board.yaml names, nothing more.
50
+ alp_sdk.example.mqtt_telemetry.aen:
51
+ extra_args: EXTRA_CONF_FILE=generated/alp.conf
52
+ platform_allow:
53
+ - alp_e1m_aen801_m55_hp/ae822fa0e5597ls0/rtss_hp
54
+ - alp_e1m_aen803_m55_hp/ae822fa0e5597ls0/rtss_hp
55
+ tags:
56
+ - alp-sdk
57
+ - example
58
+ - iot
59
+ - mqtt
60
+ - aen
61
+ build_only: true
62
+ # No weak-RNG opt-in: every AEN board seeds its CSPRNG from the Secure
63
+ # Enclave TRNG by default (#2192), so this configures on real entropy.
64
+ harness: console
65
+ harness_config:
66
+ type: one_line
67
+ regex:
68
+ - "\\[mqtt\\] done"
@@ -0,0 +1,8 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ cmake_minimum_required(VERSION 3.20)
4
+
5
+ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6
+ project(hello_world LANGUAGES C)
7
+
8
+ target_sources(app PRIVATE src/main.c)
@@ -0,0 +1,108 @@
1
+ # hello-world
2
+
3
+ The canonical "first program" for the Alp SDK. No peripherals,
4
+ no chips, no board-specific wiring -- just a periodic `printf`
5
+ loop so you can confirm the toolchain, flash flow, and log
6
+ console are wired correctly before chasing harder bugs.
7
+
8
+ If `[hello] tick 0` doesn't appear, the suspect list is short:
9
+
10
+ 1. **Toolchain** -- the build output completes cleanly but the
11
+ image you flashed doesn't match the SoM (cross-compiled for
12
+ the wrong core; mismatched Zephyr board target).
13
+ 2. **Flash flow** -- the image flashed but boot vector / SAU /
14
+ secure-state config doesn't allow it to start.
15
+ 3. **Console wiring** -- the app is running but your terminal is
16
+ on the wrong UART, wrong baud rate, or wrong USB enumeration.
17
+
18
+ Pin down which one BEFORE moving on to alp-sdk's
19
+ [`examples/peripheral-io/gpio-button-led`](https://github.com/alplabai/alp-sdk/tree/v0.17.0/examples/peripheral-io/gpio-button-led)
20
+ or
21
+ [`examples/peripheral-io/i2c-scanner`](https://github.com/alplabai/alp-sdk/tree/v0.17.0/examples/peripheral-io/i2c-scanner)
22
+ -- neither is part of this scaffolded project.
23
+
24
+ ## What this shows
25
+
26
+ * The minimal `board.yaml` v2 shape: `schema_version`, `som.sku`,
27
+ `board.name`, one `cores.<id>` with an empty `peripherals: []`.
28
+ * That `prj.conf` stays empty -- all CONFIG_* selection comes from
29
+ the loader-generated `alp.conf`.
30
+ * The Zephyr boot -> `main()` -> printf path with no peripheral
31
+ initialisation in between.
32
+
33
+ ## Build
34
+
35
+ ```bash
36
+ # Standalone, native_sim (host binary; no hardware needed):
37
+ # writes ./generated/alp.conf, which west reads below (#866)
38
+ tan generate --target zephyr-conf --core m55_hp --sdk-root "$ALP_SDK_ROOT" --output generated/alp.conf
39
+ west build -b native_sim/native/64 . \
40
+ -- -DEXTRA_CONF_FILE=generated/alp.conf -DEXTRA_ZEPHYR_MODULES=$ALP_SDK_ROOT
41
+ west build -t run
42
+
43
+ # On real silicon, point -b at the SoM's Zephyr board target.
44
+ # Example for E1M-AEN801:
45
+ west build -b alp_e1m_aen801_m55_hp/ae822fa0e5597ls0/rtss_hp . -- -DEXTRA_CONF_FILE=generated/alp.conf
46
+ west flash
47
+ ```
48
+
49
+ ## Where the output lands
50
+
51
+ | SoM family | Console route |
52
+ |--------------|----------------------------------------------------------|
53
+ | E1M-AEN | Alif first USART -> FTDI USB-UART on E1M-EVK (115200 8N1) |
54
+ | E1M-V2N | Renesas SCIF -> FTDI USB-UART on E1M-X-EVK (115200 8N1) |
55
+ | E1M-V2N-M1 | Same as V2N |
56
+ | native_sim | Host binary stdout |
57
+
58
+ Open the serial port in your terminal of choice (115200 8N1).
59
+ The recommended cross-platform tool is `tio` -- one binary, one
60
+ syntax on Linux, macOS, and Windows:
61
+
62
+ ```
63
+ tio -b 115200 <your-serial-device>
64
+ ```
65
+
66
+ Per-OS device naming (and the alternative terminals each OS
67
+ prefers) is documented in
68
+ [`docs/cross-platform-setup.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/cross-platform-setup.md)
69
+ section 7.7.
70
+
71
+ <!-- cross-platform-lint:ignore -->
72
+ Quick reference: Linux uses `/dev/ttyUSB*` or `/dev/ttyACM*`;
73
+ macOS uses `/dev/cu.usbserial-*` or `/dev/cu.usbmodem*`; Windows
74
+ uses `COM<N>` (visible in Device Manager under "Ports (COM &
75
+ LPT)").
76
+ <!-- cross-platform-lint:resume -->
77
+
78
+ ## Expected output
79
+
80
+ ```
81
+ [hello] Alp SDK hello-world starting
82
+ [hello] tick 0
83
+ [hello] tick 1
84
+ [hello] tick 2
85
+ [hello] tick 3
86
+ [hello] tick 4
87
+ [hello] done
88
+ ```
89
+
90
+ ## Customising
91
+
92
+ * **Loop forever.** Swap the bounded `for` loop in `src/main.c`
93
+ for the commented-out `TICKS_ON_REAL_SILICON` block.
94
+ * **Faster heartbeat.** Drop `HELLO_TICK_PERIOD_MS` from `1000`
95
+ to `100` (10 Hz) or `10` (100 Hz). At <= 1 ms you'll start to
96
+ see scheduler overhead.
97
+ * **Different log macro.** Swap `printf` for `printk` (always
98
+ ISR-safe) or Zephyr's `LOG_INF` (compile-time-filtered,
99
+ requires `CONFIG_LOG=y` in `prj.conf`).
100
+
101
+ ## Reference
102
+
103
+ - [`docs/firmware-quickstart.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/firmware-quickstart.md)
104
+ -- single-OS bring-up walk-through.
105
+ - [`docs/cross-platform-setup.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/cross-platform-setup.md)
106
+ -- Windows/macOS/Linux toolchain + serial-port notes.
107
+ - [`docs/troubleshooting.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/troubleshooting.md)
108
+ -- common boot/flash/console failures + fixes.
@@ -0,0 +1,32 @@
1
+ # board.yaml -- per-app project configuration for the
2
+ # hello-world example.
3
+ #
4
+ # The simplest possible Alp SDK app: no peripherals, no chips, no
5
+ # board-specific wiring. Just the boot path + a periodic printf
6
+ # loop so customers can confirm their toolchain + flash flow + log
7
+ # console are wired correctly before chasing harder bugs.
8
+ #
9
+ # Customer workflow: `tan init --from-example peripheral-io/hello-world`, change `som.sku` to
10
+ # your MPN, edit the `preset:` (or use an inline board) if you're on a non-EVK board,
11
+ # and `tan build`, which plans alp.conf from this file; twister and a bare
12
+ # west build read the pre-generated generated/alp.conf instead
13
+ # (`tan generate --target zephyr-conf`, see README.md).
14
+ som:
15
+ sku: E1M-AEN801
16
+
17
+ preset: e1m-evk
18
+ supported_boards:
19
+ - e1m-evk
20
+ - e1m-x-evk
21
+ cores:
22
+ m55_hp:
23
+ app: ./src
24
+ # No peripherals -- this example exercises only the boot path
25
+ # and printf, both of which are part of the Zephyr baseline and
26
+ # need no explicit Kconfig. When the loader sees an empty
27
+ # peripherals: list it still emits the SoC + board configs
28
+ # the SoM topology requires, so the app boots normally.
29
+ peripherals: []
30
+
31
+ diagnostics:
32
+ log_level: info
@@ -0,0 +1,8 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # Intentionally empty. Every CONFIG_* this app needs is derived
4
+ # from board.yaml by `tan build` and layered in via
5
+ # EXTRA_CONF_FILE (see README.md: `tan generate --target zephyr-conf`). Add app-specific tuning
6
+ # knobs (e.g. CONFIG_HEAP_MEM_POOL_SIZE=N) here only when they
7
+ # are NOT feature-selection -- everything declarative belongs in
8
+ # board.yaml.
@@ -0,0 +1,111 @@
1
+ /*
2
+ * Copyright 2026 Alp Lab AB
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ *
5
+ * hello-world -- the canonical "first program" for the Alp SDK.
6
+ *
7
+ * No peripherals, no chips, no board-specific wiring. Just the
8
+ * boot path + a periodic printf loop so customers can confirm
9
+ * their toolchain + flash flow + log console are wired correctly
10
+ * before chasing harder bugs.
11
+ *
12
+ * What success looks like:
13
+ *
14
+ * [hello] Alp SDK hello-world starting
15
+ * [hello] tick 0
16
+ * [hello] tick 1
17
+ * ...
18
+ * [hello] tick 4
19
+ * [hello] done
20
+ *
21
+ * Where the output lands depends on the SoM:
22
+ *
23
+ * * E1M-AEN (Alif Ensemble) -- the SoC's first USART, surfaced
24
+ * on the EVK board as the FTDI USB-UART (open at 115200 8N1).
25
+ * * E1M-V2N / V2N-M1 -- the Renesas SCIF console; same FTDI
26
+ * bridge on the E1M-X-EVK at 115200 8N1.
27
+ * * native_sim host build -- stdout of the host binary.
28
+ *
29
+ * The SDK doesn't ship its own alp_log API yet (planned post-1.0);
30
+ * use printf or Zephyr's LOG_* macros directly. This example uses
31
+ * printf for clarity -- it lands on whatever Zephyr has picked as
32
+ * its console (CONFIG_LOG_BACKEND_UART under the hood).
33
+ */
34
+
35
+ #include <stdio.h>
36
+
37
+ #include <alp/cap.h>
38
+ #include <alp/peripheral.h>
39
+ #include <alp/soc_caps.h>
40
+
41
+ /* Capped tick count keeps the native_sim run inside twister's
42
+ * timeout. Real on-silicon firmware would loop forever instead --
43
+ * see TICKS_ON_REAL_SILICON below. We expose the cap as a macro
44
+ * so customers see exactly what to change. */
45
+ #define HELLO_TICKS 5u
46
+
47
+ /* The wait between ticks. alp_delay_ms yields the CPU to other
48
+ * threads + the power-management subsystem during the wait on
49
+ * scheduler-backed targets; on baremetal it falls through to a
50
+ * calibrated busy-loop (there's no scheduler to yield to). */
51
+ #define HELLO_TICK_PERIOD_MS 1000u
52
+
53
+ int main(void)
54
+ {
55
+ /* Bring up the SDK runtime before anything else -- thin today,
56
+ * but future backends rely on it (see <alp/peripheral.h>). */
57
+ (void)alp_init();
58
+
59
+ /* The first line a bring-up engineer wants to see -- it
60
+ * confirms the boot path made it to main() AND the printf
61
+ * console is decoded correctly. If THIS line is missing,
62
+ * the toolchain / flash flow / console-cable is the suspect,
63
+ * not the SDK. */
64
+ printf("[hello] Alp SDK hello-world starting\n");
65
+
66
+ /* Periodic loop -- prints a monotonically-increasing tick every
67
+ * HELLO_TICK_PERIOD_MS so the customer can see the app is alive
68
+ * (not just printed once + crashed). Capped at HELLO_TICKS so
69
+ * twister's console-harness one_line regex can latch the `done`
70
+ * marker; real firmware would loop forever. */
71
+ for (uint32_t tick = 0; tick < HELLO_TICKS; tick++) {
72
+ printf("[hello] tick %u\n", tick);
73
+ alp_delay_ms(HELLO_TICK_PERIOD_MS);
74
+ }
75
+
76
+ /* TICKS_ON_REAL_SILICON: in production firmware you'd swap the
77
+ * bounded for-loop above for:
78
+ *
79
+ * for (uint32_t tick = 0; ; tick++) {
80
+ * printf("[hello] tick %u\n", tick);
81
+ * alp_delay_ms(HELLO_TICK_PERIOD_MS);
82
+ * }
83
+ *
84
+ * Returning from main() on Zephyr is technically legal but the
85
+ * kernel idles afterwards -- nothing keeps the heartbeat going. */
86
+
87
+ /* Capability-API teaching block.
88
+ *
89
+ * `ALP_HAS()` is a compile-time constant expression. Use it for
90
+ * #if / static_assert -- the unused branch disappears entirely
91
+ * from the binary, so this is zero-cost on parts that lack the
92
+ * feature. */
93
+ #if ALP_HAS(HELIUM_MVE)
94
+ printf("[hello] this build targets a Helium-capable SoC\n");
95
+ #else
96
+ printf("[hello] no Helium MVE on this SoC -- scalar path\n");
97
+ #endif
98
+
99
+ /* `alp_has()` is the runtime equivalent. Useful when the same
100
+ * binary may run on different SoCs (rare on Zephyr, common in
101
+ * board-bringup tooling) or when the branch only matters for
102
+ * logging rather than codegen. */
103
+ if (alp_has(ALP_CAP_ID_HW_I2C)) {
104
+ printf("[hello] HW I2C available (could probe sensors here)\n");
105
+ } else {
106
+ printf("[hello] no HW I2C on this SoC\n");
107
+ }
108
+
109
+ printf("[hello] done\n");
110
+ return 0;
111
+ }
@@ -0,0 +1,49 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ sample:
4
+ name: hello-world
5
+ description: |
6
+ Minimal "first program" example. Prints a periodic heartbeat
7
+ so customers can verify their toolchain + flash flow + log
8
+ console before tackling peripheral wiring. Builds on both
9
+ EVKs: no board-specific macros required.
10
+
11
+ tests:
12
+ alp_sdk.example.hello_world.e1m_x_evk:
13
+ extra_args: EXTRA_CONF_FILE=generated/alp.conf
14
+ platform_allow:
15
+ - native_sim
16
+ - native_sim/native/64
17
+ integration_platforms:
18
+ - native_sim/native/64
19
+ extra_configs:
20
+ - 'CONFIG_COMPILER_OPT="-DALP_BOARD_E1M_X_EVK"'
21
+ tags:
22
+ - alp-sdk
23
+ - example
24
+ - hello-world
25
+ - v2n
26
+ harness: console
27
+ harness_config:
28
+ type: one_line
29
+ regex:
30
+ - "\\[hello\\] done"
31
+ alp_sdk.example.hello_world.e1m_evk:
32
+ extra_args: EXTRA_CONF_FILE=generated/alp.conf
33
+ platform_allow:
34
+ - native_sim
35
+ - native_sim/native/64
36
+ integration_platforms:
37
+ - native_sim/native/64
38
+ extra_configs:
39
+ - 'CONFIG_COMPILER_OPT="-DALP_BOARD_E1M_EVK"'
40
+ tags:
41
+ - alp-sdk
42
+ - example
43
+ - hello-world
44
+ - aen
45
+ harness: console
46
+ harness_config:
47
+ type: one_line
48
+ regex:
49
+ - "\\[hello\\] done"
@@ -0,0 +1,8 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+
3
+ cmake_minimum_required(VERSION 3.20)
4
+
5
+ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6
+ project(hello_world LANGUAGES C)
7
+
8
+ target_sources(app PRIVATE src/main.c)
@@ -0,0 +1,108 @@
1
+ # hello-world
2
+
3
+ The canonical "first program" for the Alp SDK. No peripherals,
4
+ no chips, no board-specific wiring -- just a periodic `printf`
5
+ loop so you can confirm the toolchain, flash flow, and log
6
+ console are wired correctly before chasing harder bugs.
7
+
8
+ If `[hello] tick 0` doesn't appear, the suspect list is short:
9
+
10
+ 1. **Toolchain** -- the build output completes cleanly but the
11
+ image you flashed doesn't match the SoM (cross-compiled for
12
+ the wrong core; mismatched Zephyr board target).
13
+ 2. **Flash flow** -- the image flashed but boot vector / SAU /
14
+ secure-state config doesn't allow it to start.
15
+ 3. **Console wiring** -- the app is running but your terminal is
16
+ on the wrong UART, wrong baud rate, or wrong USB enumeration.
17
+
18
+ Pin down which one BEFORE moving on to alp-sdk's
19
+ [`examples/peripheral-io/gpio-button-led`](https://github.com/alplabai/alp-sdk/tree/v0.17.0/examples/peripheral-io/gpio-button-led)
20
+ or
21
+ [`examples/peripheral-io/i2c-scanner`](https://github.com/alplabai/alp-sdk/tree/v0.17.0/examples/peripheral-io/i2c-scanner)
22
+ -- neither is part of this scaffolded project.
23
+
24
+ ## What this shows
25
+
26
+ * The minimal `board.yaml` v2 shape: `schema_version`, `som.sku`,
27
+ `board.name`, one `cores.<id>` with an empty `peripherals: []`.
28
+ * That `prj.conf` stays empty -- all CONFIG_* selection comes from
29
+ the loader-generated `alp.conf`.
30
+ * The Zephyr boot -> `main()` -> printf path with no peripheral
31
+ initialisation in between.
32
+
33
+ ## Build
34
+
35
+ ```bash
36
+ # Standalone, native_sim (host binary; no hardware needed):
37
+ # writes ./generated/alp.conf, which west reads below (#866)
38
+ tan generate --target zephyr-conf --core m33_sm --sdk-root "$ALP_SDK_ROOT" --output generated/alp.conf
39
+ west build -b native_sim/native/64 . \
40
+ -- -DEXTRA_CONF_FILE=generated/alp.conf -DEXTRA_ZEPHYR_MODULES=$ALP_SDK_ROOT
41
+ west build -t run
42
+
43
+ # On real silicon, point -b at the SoM's Zephyr board target.
44
+ # Example for E1M-V2N101:
45
+ west build -b alp_e1m_v2n101_m33_sm/r9a09g056n48gbg/cm33 . -- -DEXTRA_CONF_FILE=generated/alp.conf
46
+ west flash --host <board-ip>
47
+ ```
48
+
49
+ ## Where the output lands
50
+
51
+ | SoM family | Console route |
52
+ |--------------|----------------------------------------------------------|
53
+ | E1M-AEN | Alif first USART -> FTDI USB-UART on E1M-EVK (115200 8N1) |
54
+ | E1M-V2N | Renesas SCIF -> FTDI USB-UART on E1M-X-EVK (115200 8N1) |
55
+ | E1M-V2N-M1 | Same as V2N |
56
+ | native_sim | Host binary stdout |
57
+
58
+ Open the serial port in your terminal of choice (115200 8N1).
59
+ The recommended cross-platform tool is `tio` -- one binary, one
60
+ syntax on Linux, macOS, and Windows:
61
+
62
+ ```
63
+ tio -b 115200 <your-serial-device>
64
+ ```
65
+
66
+ Per-OS device naming (and the alternative terminals each OS
67
+ prefers) is documented in
68
+ [`docs/cross-platform-setup.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/cross-platform-setup.md)
69
+ section 7.7.
70
+
71
+ <!-- cross-platform-lint:ignore -->
72
+ Quick reference: Linux uses `/dev/ttyUSB*` or `/dev/ttyACM*`;
73
+ macOS uses `/dev/cu.usbserial-*` or `/dev/cu.usbmodem*`; Windows
74
+ uses `COM<N>` (visible in Device Manager under "Ports (COM &
75
+ LPT)").
76
+ <!-- cross-platform-lint:resume -->
77
+
78
+ ## Expected output
79
+
80
+ ```
81
+ [hello] Alp SDK hello-world starting
82
+ [hello] tick 0
83
+ [hello] tick 1
84
+ [hello] tick 2
85
+ [hello] tick 3
86
+ [hello] tick 4
87
+ [hello] done
88
+ ```
89
+
90
+ ## Customising
91
+
92
+ * **Loop forever.** Swap the bounded `for` loop in `src/main.c`
93
+ for the commented-out `TICKS_ON_REAL_SILICON` block.
94
+ * **Faster heartbeat.** Drop `HELLO_TICK_PERIOD_MS` from `1000`
95
+ to `100` (10 Hz) or `10` (100 Hz). At <= 1 ms you'll start to
96
+ see scheduler overhead.
97
+ * **Different log macro.** Swap `printf` for `printk` (always
98
+ ISR-safe) or Zephyr's `LOG_INF` (compile-time-filtered,
99
+ requires `CONFIG_LOG=y` in `prj.conf`).
100
+
101
+ ## Reference
102
+
103
+ - [`docs/firmware-quickstart.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/firmware-quickstart.md)
104
+ -- single-OS bring-up walk-through.
105
+ - [`docs/cross-platform-setup.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/cross-platform-setup.md)
106
+ -- Windows/macOS/Linux toolchain + serial-port notes.
107
+ - [`docs/troubleshooting.md`](https://github.com/alplabai/alp-sdk/blob/v0.17.0/docs/troubleshooting.md)
108
+ -- common boot/flash/console failures + fixes.
@@ -0,0 +1,32 @@
1
+ # board.yaml -- per-app project configuration for the
2
+ # hello-world example.
3
+ #
4
+ # The simplest possible Alp SDK app: no peripherals, no chips, no
5
+ # board-specific wiring. Just the boot path + a periodic printf
6
+ # loop so customers can confirm their toolchain + flash flow + log
7
+ # console are wired correctly before chasing harder bugs.
8
+ #
9
+ # Customer workflow: `tan init --from-example peripheral-io/hello-world`, change `som.sku` to
10
+ # your MPN, edit the `preset:` (or use an inline board) if you're on a non-EVK board,
11
+ # and `tan build`, which plans alp.conf from this file; twister and a bare
12
+ # west build read the pre-generated generated/alp.conf instead
13
+ # (`tan generate --target zephyr-conf`, see README.md).
14
+ som:
15
+ sku: E1M-V2N101
16
+
17
+ preset: e1m-x-evk
18
+ supported_boards:
19
+ - e1m-evk
20
+ - e1m-x-evk
21
+ cores:
22
+ m33_sm:
23
+ app: ./src
24
+ # No peripherals -- this example exercises only the boot path
25
+ # and printf, both of which are part of the Zephyr baseline and
26
+ # need no explicit Kconfig. When the loader sees an empty
27
+ # peripherals: list it still emits the SoC + board configs
28
+ # the SoM topology requires, so the app boots normally.
29
+ peripherals: []
30
+
31
+ diagnostics:
32
+ log_level: info
@@ -0,0 +1,8 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # Intentionally empty. Every CONFIG_* this app needs is derived
4
+ # from board.yaml by `tan build` and layered in via
5
+ # EXTRA_CONF_FILE (see README.md: `tan generate --target zephyr-conf`). Add app-specific tuning
6
+ # knobs (e.g. CONFIG_HEAP_MEM_POOL_SIZE=N) here only when they
7
+ # are NOT feature-selection -- everything declarative belongs in
8
+ # board.yaml.
@@ -0,0 +1,111 @@
1
+ /*
2
+ * Copyright 2026 Alp Lab AB
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ *
5
+ * hello-world -- the canonical "first program" for the Alp SDK.
6
+ *
7
+ * No peripherals, no chips, no board-specific wiring. Just the
8
+ * boot path + a periodic printf loop so customers can confirm
9
+ * their toolchain + flash flow + log console are wired correctly
10
+ * before chasing harder bugs.
11
+ *
12
+ * What success looks like:
13
+ *
14
+ * [hello] Alp SDK hello-world starting
15
+ * [hello] tick 0
16
+ * [hello] tick 1
17
+ * ...
18
+ * [hello] tick 4
19
+ * [hello] done
20
+ *
21
+ * Where the output lands depends on the SoM:
22
+ *
23
+ * * E1M-AEN (Alif Ensemble) -- the SoC's first USART, surfaced
24
+ * on the EVK board as the FTDI USB-UART (open at 115200 8N1).
25
+ * * E1M-V2N / V2N-M1 -- the Renesas SCIF console; same FTDI
26
+ * bridge on the E1M-X-EVK at 115200 8N1.
27
+ * * native_sim host build -- stdout of the host binary.
28
+ *
29
+ * The SDK doesn't ship its own alp_log API yet (planned post-1.0);
30
+ * use printf or Zephyr's LOG_* macros directly. This example uses
31
+ * printf for clarity -- it lands on whatever Zephyr has picked as
32
+ * its console (CONFIG_LOG_BACKEND_UART under the hood).
33
+ */
34
+
35
+ #include <stdio.h>
36
+
37
+ #include <alp/cap.h>
38
+ #include <alp/peripheral.h>
39
+ #include <alp/soc_caps.h>
40
+
41
+ /* Capped tick count keeps the native_sim run inside twister's
42
+ * timeout. Real on-silicon firmware would loop forever instead --
43
+ * see TICKS_ON_REAL_SILICON below. We expose the cap as a macro
44
+ * so customers see exactly what to change. */
45
+ #define HELLO_TICKS 5u
46
+
47
+ /* The wait between ticks. alp_delay_ms yields the CPU to other
48
+ * threads + the power-management subsystem during the wait on
49
+ * scheduler-backed targets; on baremetal it falls through to a
50
+ * calibrated busy-loop (there's no scheduler to yield to). */
51
+ #define HELLO_TICK_PERIOD_MS 1000u
52
+
53
+ int main(void)
54
+ {
55
+ /* Bring up the SDK runtime before anything else -- thin today,
56
+ * but future backends rely on it (see <alp/peripheral.h>). */
57
+ (void)alp_init();
58
+
59
+ /* The first line a bring-up engineer wants to see -- it
60
+ * confirms the boot path made it to main() AND the printf
61
+ * console is decoded correctly. If THIS line is missing,
62
+ * the toolchain / flash flow / console-cable is the suspect,
63
+ * not the SDK. */
64
+ printf("[hello] Alp SDK hello-world starting\n");
65
+
66
+ /* Periodic loop -- prints a monotonically-increasing tick every
67
+ * HELLO_TICK_PERIOD_MS so the customer can see the app is alive
68
+ * (not just printed once + crashed). Capped at HELLO_TICKS so
69
+ * twister's console-harness one_line regex can latch the `done`
70
+ * marker; real firmware would loop forever. */
71
+ for (uint32_t tick = 0; tick < HELLO_TICKS; tick++) {
72
+ printf("[hello] tick %u\n", tick);
73
+ alp_delay_ms(HELLO_TICK_PERIOD_MS);
74
+ }
75
+
76
+ /* TICKS_ON_REAL_SILICON: in production firmware you'd swap the
77
+ * bounded for-loop above for:
78
+ *
79
+ * for (uint32_t tick = 0; ; tick++) {
80
+ * printf("[hello] tick %u\n", tick);
81
+ * alp_delay_ms(HELLO_TICK_PERIOD_MS);
82
+ * }
83
+ *
84
+ * Returning from main() on Zephyr is technically legal but the
85
+ * kernel idles afterwards -- nothing keeps the heartbeat going. */
86
+
87
+ /* Capability-API teaching block.
88
+ *
89
+ * `ALP_HAS()` is a compile-time constant expression. Use it for
90
+ * #if / static_assert -- the unused branch disappears entirely
91
+ * from the binary, so this is zero-cost on parts that lack the
92
+ * feature. */
93
+ #if ALP_HAS(HELIUM_MVE)
94
+ printf("[hello] this build targets a Helium-capable SoC\n");
95
+ #else
96
+ printf("[hello] no Helium MVE on this SoC -- scalar path\n");
97
+ #endif
98
+
99
+ /* `alp_has()` is the runtime equivalent. Useful when the same
100
+ * binary may run on different SoCs (rare on Zephyr, common in
101
+ * board-bringup tooling) or when the branch only matters for
102
+ * logging rather than codegen. */
103
+ if (alp_has(ALP_CAP_ID_HW_I2C)) {
104
+ printf("[hello] HW I2C available (could probe sensors here)\n");
105
+ } else {
106
+ printf("[hello] no HW I2C on this SoC\n");
107
+ }
108
+
109
+ printf("[hello] done\n");
110
+ return 0;
111
+ }