Coder Social home page Coder Social logo

py32-template's Introduction

Puya PY32 MCU SDK

This repo contains a GCC/Makefile-based build system for Puya PY32 MCUs, including the PY32F002A, PY32F003, and PY32F030.

Also included are vscode build/launch configs using Cortex-Debug and pyOCD.

pyOCD support

Puya's DFP is not currently indexed anywhere, so pyOCD can't automatically download it with the typical pack update and pack install commands. However, we can manually download and extract this pack, and then install the pack using cmsis-pack-manager (which PyOCD uses under the hood)

First, get a copy of the DFP, which is found in Puya's PY32 SDK download available on their PY32 web page. The download link is listed under the "Datasheet" column in the far right of the device table — you can directly download the file here, though this link may be out of date. If you extract this RAR, you'll end up with documentation, code samples, and the Puya.PY32F0xx_DFP.1.1.0.pack DFP pack.

Next, unzip Puya.PY32F0xx_DFP.1.1.0.pack (it's just a ZIP with a .pack extension). Then, copy the pdesc file to cmsis-pack-manager's repository along with all the other pdsc files (this will be located in your Python distribution). It needs to be renamed to Puya.PY32F0xx_DFP.1.1.0.pdsc (with the version numbers present).

Next, copy the original DFP pack file to Puya\PY32F0xx_DFP\1.1.0.pack creating directories and renaming the pack file accordingly.

Now, add the pack to cmsis-pack-manager:

PS C:\> pack-manager add-packs Puya.PY32F0xx_DFP.1.1.0.pdsc

Now you can install the actual target support in PyOCD:

PS C:\> pyocd pack find PY32
  Part          Vendor   Pack                Version   Installed
------------------------------------------------------------------
  PY32F002Ax5   Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F003x4    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F003x6    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F003x8    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x3    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x4    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x6    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x7    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F030x8    Puya     Puya.PY32F0xx_DFP   1.1.0     True
  PY32F072xB    Puya     Puya.PY32F0xx_DFP   1.1.0     True

PS C:\> pyocd pack install PY32F003x8

J-Link Support

Using the J-Link Device Support Kit Segger Wiki page as a reference, create a JLinkDevices\Puya\PY32 directory structure in your home directory's Segger application data folder (on Windows, it's in C:\Users\<USER>\AppData\Roaming\SEGGER\). Pull in all the FLM files from the aforementioned DFP to this directory, and add a Devices.XML file that points J-Link to these files. Here's an example for the PY32F002Ax5:

<Database>
  <Device>
    <ChipInfo Vendor="Puya" Name="PY32F002Ax5" WorkRAMAddr="0x20000000" WorkRAMSize="3072" Core="JLINK_CORE_CORTEX_M0" />
    <FlashBankInfo Name="Internal code flash" BaseAddr="0x08000000" AlwaysPresent="1" >
      <LoaderInfo Name="Default" MaxSize="0x5000" Loader="PY32F0xx_20.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" />
    </FlashBankInfo>
  </Device>
</Database>

py32-template's People

Contributors

jaydcarlson avatar

Stargazers

Jake V avatar Backwoods Bob avatar  avatar James Larkby-Lahet avatar Bob Jordan avatar  avatar Sparkz avatar Christa avatar Ned Konz avatar  avatar Davids Paskevics avatar  avatar Steve Brett avatar Dimitar Tomov avatar sordfish avatar  avatar Adam Critchley avatar Steve Luzynski avatar Michael Rangen avatar Rae Forbes-Richardson avatar  avatar  avatar  avatar Morten Hattesen avatar Marcin Dąbrowski avatar Wing Tang Wong avatar  avatar GarudaOne avatar decrement avatar  avatar Sabas avatar Nhan TT avatar sprhawk avatar Stefan Wagner avatar Ken Keiter avatar  avatar  avatar  avatar Sylvain LAFRASSE avatar tony eve avatar Flaviu Tamas avatar Sam Perry avatar Alex Kabakaev avatar  avatar Jonathan Redig avatar evan kahn avatar  avatar Noah Pendleton avatar  avatar Lain avatar Ismo Väänänen avatar Tor Krill avatar Octav Iosif avatar  avatar Bogdan-Florin Florea avatar  avatar  avatar A Fox avatar  avatar  avatar  avatar David avatar Matt A avatar  avatar Abe Kipnis avatar Sylwester avatar  avatar  avatar Macleay Stephenson avatar Dhiru Kholia avatar Fahmi Ahmad avatar Mitchell Dokken  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar britovski avatar

py32-template's Issues

pack manager did not works

Hi,

What version of python, pyocd and cmsis-pack-manager are you using? I'm trying to do your steps, but cmd or Power Shell can't find pack-manager.

Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.