《ZDS 2023 - Tooling for VSCode.pdf》由會員分享,可在線閱讀,更多相關《ZDS 2023 - Tooling for VSCode.pdf(45頁珍藏版)》請在三個皮匠報告上搜索。
1、ZDS 2023TOOLS FOR VSCODENRF9160 FEATHERI TOOK THE RED PILL ZEPHYR LIVE SESSIONSYOUTUBE.COM/C/CIRCUITDOJOTHE PROBLEM-Getting started with Zephyr can be painful-Zephyr is the new hotness-Multiple targets,same codebase-Learning curve due to new tools-mcumgr,west,ninja,cmakeTHE PROBLEM#ZDS2023THE SOLUTI
2、ON-So why not lessen the hurdle!-Focus on a coding environment that*many*people use:VSCode-Make it easier to go from 0 to compiling code with least amount of headache-Make it cross platform x 3.5*THE SOLUTION#ZDS2023-Building an open source VSCode extension was the result-Located on Github-https:/ i
3、n typescriptTHE SOLUTION#ZDS2023THE SOLUTION#ZDS2023INITIALIZINGINITIALIZING#ZDS2023-Setup downloads and installs:-Sets up Python3 environment-Zephyr toolchain(ARM)-CMake,Ninja,Newtmgr,and Zephyr Tools CLI(for monitoring serial devices)-Only need Git and Python3 installed beforehandINITIALIZING#ZDS2
4、023 version:12,win32:arch:x64,downloads:#ZDS2023INITIALIZINGmanifest.json-Every supported platform gets a manifest.json entry which provides links to downloads-Allows fine grained control over binaries for different architectures-Both x86_64 and Aarch64 for MacINITIALIZING#ZDS2023/Define what manife
5、st to uselet platformManifest:ManifestEntry|undefined;switch(platform)case darwin:platformManifest=manifest.darwin;break;case linux:platformManifest=manifest.linux;break;case win32:platformManifest=manifest.win32;break;#ZDS2023INITIALIZINGextension.ts-As you can imagine there are lots of possibiliti
6、es for this:-Different toolchains for different SDKs(qemu x86,etc)-Other utilities/dependencies needed Zephyr project wideINITIALIZING#ZDS2023STARTING FROM EXAMPLESTARTING FROM EXAMPLE#ZDS2023STARTING FROM EXAMPLE#ZDS2023-Init Repo command will:-Take a Git url and download into a location you specif
7、y.You can even set the branch.-Download and update all dependencies-Install all Python requirements(if not already installed)STARTING FROM EXAMPLE#ZDS2023-The nice parts:-Your code and SDK code are in one location.-Changing dependencies will not affect anything else-Downside:-Takes up more space STA
8、RTING FROM EXAMPLE#ZDS2023STARTING FROM SCRATCHSTARTING FROM SCRATCH#ZDS2023-You dont necessarily*have*to clone a repo.-You can use the Create Project command to-Provide some starter code(Blinky sample)-Initialize your variant of Zephyr(Vanilla or NCS)-And initialize just like the Init Repo does.STA
9、RTING FROM SCRATCH#ZDS2023STARTING FROM SCRATCH#ZDS2023STARTING FROM SCRATCH#ZDS2023starter filesDEFINING DEPENDENCIESDEFINING DEPENDENCIES#ZDS2023-Need to pull something else into your project?-Add it as dependency in your newly created west.yml-Then update dependencies using Zephyr Tools:Update De
10、pendencies DEFINING DEPENDENCIES#ZDS2023Import GoliothDEFINING DEPENDENCIES#ZDS2023Update dependenciesBUILD,FLASH,DEBUGBUILD,FLASH,DEBUG#ZDS2023BUILD,FLASH,DEBUG#ZDS2023-Building is as simple as running a Zephyr Tools:Build command-Want a clean build?-Run a Pristine build-Or delete the build folder
11、with the Clean commandBUILD,FLASH,DEBUG#ZDS2023-The extension will ask which board and app youd like to buildBUILD,FLASH,DEBUG#ZDS2023-The extension will ask which board and app youd like to buildBUILD,FLASH,DEBUG#ZDS2023-Board and project targets are retained even if you close VSCode -If you ever n
12、eed to change them you can use these commands:-Zephyr Tools:Change Board-Zephyr Tools:Change ProjectBUILD,FLASH,DEBUG#ZDS2023BUILD,FLASH,DEBUG#ZDS2023BUILD,FLASH,DEBUG#ZDS2023-Console access is handled by zephyr-tools CLI under the hood-Able to connect to and monitor any serial port connected-Also saves output to log files for use later onBUILD,FLASH,DEBUG#ZDS2023BUILD,FLASH,DEBUG#ZDS2023Log fileDEMO-Cross platform-Easy to set up-Applies an opinionated way to program with Zephyr-Open source and happily entertaining PRs!-Huge thanks/credit to Zephyr communitySUMMARY#ZDS2023Subscribe at !