跳转至内容
  • 37 主题
    49 帖子
    FrankieF

    用此SKILL, 方便AI操作yct_cli,对工程进行校验,测试,代码生成。

    --- name: yct-cli description: >- Operate yct_cli to check, test, and generate code for YTMicro .yct projects (SDK, MCAL, MCAL_EB / EB Tresos). Use when the user mentions yct_cli, a .yct file, SDK, MCAL, MCAL_EB, EB Tresos, tresos_cmd, TRESOS_BASE, 校验, 测试, or 代码生成. --- # yct_cli 用此SKILL, 方便AI操作yct_cli,对工程进行校验,测试,代码生成。 `yct_cli` reads an existing `.yct` and the installed SDK or MCAL package. It does not create the `.yct`. Prefer `yct_cli` on PATH. From this repo, after `npm run cli:build`, use `node cli/cli.min.js`. ## Pick a command Read `project.type` from the `.yct`, then run that command. | Project type | Command | |---|---| | sdk | `yct_cli sdk` | | mcal | `yct_cli mcal` | | mcal_eb | `yct_cli mcal_eb` (alias of `mcal`) | Check with `-c`. Generate code with `-g`. Write the IDE project with `-P` (needs `-g` for MCAL and MCAL_EB). Compile a CMake project only after generate succeeds. ## Package root Resolution order: 1. `-p` install root 2. YT Config Tool settings file: Windows `%APPDATA%/yt_config_tool/config.json`, macOS `~/Library/Application Support/yt_config_tool/config.json`, Linux `~/.config/yt_config_tool/config.json`. Keys: `sdkPath`, `mcalPath`, `mcalEbPath` 3. `userDataPath` plus the project type directory Family folder under that root: - `sdkVersion` is `dev`, or settings `withoutVer` is true: `root/family` - otherwise: `root/family_sdkVersion` `--sdkVer` or `--mcalVer` overwrites the version in the `.yct` before that lookup. The family folder must contain `sdk.json`, `mcal.json`, or `mcal_eb.json`. CLI copies `env` entries from that config, including `TRESOS_BASE`, into the process environment when the variable is not already set. ## SDK Check: yct_cli sdk -i app.yct -c Generate the IDE project: yct_cli sdk -i app.yct -P --ide CMakeGCC `-c` validates the project. `-P` writes IDE files. `--ide` is one of `EWARM`, `KEIL`, `CMakeGCC`, `CMakeEWARM`, `CMakeKEIL`, `CMakeGHS`. | Flag | Required | Meaning | |---|---|---| | `-i, --input` | yes | `.yct` path | | `--verbose` | no | Verbose log | | `-c, --check` | no | Validate the `.yct` | | `-p, --path` | no | SDK install root | | `--ide` | no | IDE name, list above | | `-O, --optimization` | no | CMake optimization. Must be legal for the toolchain | | `--link` | no | Overwrite link file | | `--sdkVer` | no | Overwrite `sdkVersion`, for example `1_0_3` | | `-o, --output` | no | Output path. Default is the `.yct` directory | | `-n, --name` | no | Overwrite project name | | `-P, --project` | no | Also generate IDE files | ## MCAL Check, including stub modules: yct_cli mcal -i app.yct -c -S Generate code, copy MCAL sources, and write the IDE project: yct_cli mcal -i app.yct -g -P --copyMcal --ide CMakeGCC `-c` validates loaded modules. Stub modules such as `EcuM` and `CanIf` are skipped unless `-S`. `-g` generates config code, including `Mcal.h`. `-gm Mcu Dio` limits generation to those modules. `--copyMcal` copies MCAL sources. `-P` needs `-g`. ## MCAL_EB An MCAL_EB `.yct` has `type` `mcal_eb`. Module configuration lives in the EB Tresos project. `.yct` data is usually only `ytlink`. Tresos project directory: - `project.eb.projectPath` when set (absolute, or relative to the `.yct` directory) - otherwise the `.yct` directory That directory must contain `.prefs/pref_general.xdm`. Enabled modules and `GenerationPath` (often `output`) come from that file. `project.eb.stubModules` lists extra stub modules to pull in. Generate, then the IDE project is ready to compile: yct_cli mcal_eb -i Dio_Demo.yct -g -P --copyMcal --ide CMakeGCC - `-g` writes `board/Mcal.h`, or `project.generate.folder` - `--copyMcal` copies driver sources from `plugin.json` move entries. Required before a link. Without it the build only has Tresos `output` and `Mcal.h` - `-P` writes the IDE project. CMake toolchains also write `cmake/ebGenerate.cmake` - `--ide` uses the same list as SDK. Omit it when the `.yct` toolchain is already correct - `-c` does not run XDM validation on MCAL_EB Compile a CMake project from the `.yct` directory: cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../cmake/gcc.cmake -B build cmake --build build Configure runs Tresos when `TRESOS_BASE` points at an install that contains `bin/tresos_cmd.bat` (Windows) or `bin/tresos_cmd.sh`. The YT Config Tool env value is written into `CMakeLists.txt`. Tresos C and H files stay in `GenerationPath`. CMake globs them together with the copied MCAL sources. `mcal_eb` is an alias of `mcal`. The `.yct` `project.type` selects the flow. Shared flags: | Flag | Required | Meaning | |---|---|---| | `-i, --input` | yes | `.yct` path | | `--verbose` | no | Verbose log | | `-c, --check` | no | Validate. MCAL_EB skips XDM validation | | `-S, --stub` | no | Include stub modules such as `EcuM` and `CanIf` | | `-p, --path` | no | MCAL or MCAL_EB install root | | `-g, --generate` | no | Generate config code, including `Mcal.h` | | `--copyMcal` | no | Copy MCAL sources from plugin move entries | | `--ide` | no | Same IDE list as SDK | | `-O, --optimization` | no | CMake optimization | | `-gm, --generateModule` | no | Only these modules, for example `-gm Mcu Dio` | | `--mcalVer` | no | Overwrite `sdkVersion`, for example `2_0_0` | | `-P, --project` | no | IDE files. Needs `-g` | | `-s, --save` | no | Write the loaded project back to the `.yct`, with a `.yct.bak` backup | CMake optimization values: - `CMakeEWARM`: `-On -Ol -Om -Oh -Ohs -Ohz`. Default `-Ol`. - `CMakeKEIL`: `-O0 -O1 -O2 -O3 -Oz -Omin -Ofast -Omax -Os`. Default `-O1`. - `CMakeGCC`: `-O0 -O1 -O2 -Os -Ofast`. Default `-O1`. - `CMakeGHS`: `-Omaxdebug -Omoredebug -Odebug -Ogeneral -Osize -Ospeed -Onone`. Default `-Ogeneral`.
  • 2k 主题
    9k 帖子
    yangkeY

    1、例程将PFlash0作为A面,PFlash1作为B面,实现A/B Swap功能
    SDK Demo例程:MD2x_Swap.zip

    2、Demo功能介绍
    FLASH_DRV_BootSwap(0):通过内部闪存命令(0x30)执行Swap操作。
    677e37d0-fd03-4438-831a-8adea93e76a0-image.png
    Get_SwapInfo(&swapInfo):读取EFM->STS寄存器,获取BOOT_INFO标志
    e8f845e3-7c13-4b77-8106-b426b3047caf-image.png
    89db2b5f-6f31-4605-83a5-0c151388941a-image.png
    测试主逻辑:上电后读取BOOT_INFO标志,通过BOOT_INFO标志判断当前代码运行在哪个PFflash中,程序运行在PFlash0时点亮LED_A,运行在PFlash1时点亮LED_B。
    9f5f5e3f-c9b8-4d5d-b25e-10531dd5805f-image.png

    3、测试验证
    使用J-Flash擦除芯片。
    1b5d7f68-641e-4877-a9b8-35451b7aad88-image.png
    将工程程序编译的文件加载到J-Flash中。
    dfc46ef6-e9c6-4ef6-8127-eee0beb4d38e-image.png
    对PFlash0进行烧录。
    4cf326b5-5412-4681-8b03-e433d15be88c-image.png
    在Edit->Relocate界面将烧录地址偏移到PFlash1中进行烧录。
    8dc92d23-5327-4cd7-98b9-f5f541d8160f-image.png

    4、重新上电运行程序
    程序会在蓝灯和绿灯之间来回切换,绿灯代表程序在PFlash0中运行,蓝灯代表程序在PFlash1中运行。
    affa5ffe-4192-4249-8473-ddf69c81cfd2-image.png
    fa4e2037-9cbb-4806-bbdd-6d44814b68c7-image.png 、

  • Blog posts from individual members

    58 主题
    200 帖子
    xianghanX

    [SDK] 芯片最低 低功耗测试.pdf
    ELF及工程_按芯片分类_20261021.zip

  • 云途开发生态介绍

    快速上手云途开发生态

  • 云途论坛规则/Yuntu Forum Rules

    发帖前请查看

  • YT CONFIG TOOL调查问卷

    帮助改进和优化YT CONFIG TOOL,有机会抽取YTM32B1ME0 EVB哦...

  • Online Users