Coder Social home page Coder Social logo

ese519_lab2_setup_windows's Introduction

ESE519_Lab2_Setup_Windows

University of Pennsylvania, ESE 5190: Intro to Embedded Systems, Lab 2A

Sizhe Ma
    [email protected]
Tested on:  Thinkpad X1, Windows 10 Pro, Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz   2.11 GHz

Setting Up for SDK on your Windows Machine for Raspberry Pi Pico.

In this lab, firstly we need to set up laptop/PC for RP2040 development using the official C/C++ SDK to compile and run example code on our board.

If you are using Windows machine, you can follow the following steps to completly set up the environment. the Raspberry Pi Pico “getting started guide” includes the whole process of setups. See Section 9.2. Building on MS Windows or the steps below for the specific instruction.

Even though Chapter2. The SDK also includes the instruction to download SDK and examples, it does not include the instruction for installing extra tools/path to the SDK/cmake setup. See 9.2 for the full instruction.

Install the extra tools

Since we use Windows OS, there are several extra tools/software we need to install first:

  1. Arm GNU Toolchain
  2. CMake
  3. Build Tools for Visual Studio 2022
  4. Python 3.10
  5. Git

Arm GNU Toolchain

In the link above, we need to download the file ended with arm-none-eabi.exe fd07ccb07714f87de3da199ca893d39

After downloading the .exe file, we select English/English language, click "next" to continue, click "I Agree" to agree the license and finally click "install" to install the software.

f2c81c694915c0ca119040e12583b10 ce039d3a561a96bc014d043a681d396 339b2dfbabbaa50e2521b363ca76296

After installing the Toolchain, remember to check "Add path to environment variable" before finishing installing. If not, our Developer Command Prompt will not detect arm none when we setup cmake. (I will mention it later in Command Line setup section)

9f8d1286abf4010098b317939c050a3

Cmake

In the link above, we need to download the file with windows-x86_64.msi

f570647ccc2924d32067e050b9ccb9d

After downloading the .exe file, we click "next" to continue, check "I accept the terems in the Licence Agreement" to agree the license, check "Add CMakee to the system PATH for all users" and "next", then finally install the software.

4f0f2bd01882c7a9d2543f03736a7f4 f420e4bfd1f3e5189b81937bf8afe30

Visual Studio 2022

For the Developer Command Prompt installation, notice that we need to download "Visual Studio 2022" instead of "VS Code"

We need to go down to the bottom and download "Build Tools for Visual Studio 2022" 416c4ee5e636d3c00545193ead8fe14

Make sure you select "Desktop development with C++" and check options on the right in "Optional" list as shown below.

image

Python 3.10

For the Python installing, make sure you download Latest Python 3 Release - Python 3.10.7, then click "Install Now."

bde3a6dbd2f12cd13f8ad3b9f088c48

Git

In the link above, we need to click "64-bit Git for Windows Setup."

be0c4d1aa2229f7394d8a65359ebb76

After downloading Git-2.38.0-64-bit.exe, we follow the instruction and download Git.

When installing Git, make sure we select "Notepad as Git's default editor", "Git from the command line as well as third-party software", "Checkout as is, commit as-is", "Use Windows' default console window" and finally "Enable experimental support for pseudo consoles".

47a822e3b3018882710b02dcd743440 ceb4988d31e885cdc37f0a0b21b0723 56e69c88bdb4ac2b2df14d2eb0b2166 9182c7264331e672c10a191ca84c0fa 206bba905640d706724f1286ff407d1 358b46be31e36657b9089443b94fdd2 add46317c73ae65bead7400302f8779 a7b2cf7d08b383121e3a6b737266ce1 0cbaba707b8806ca179ba9c8159dc34

Congrats! You have installed all extra tools. Then you can install C SDK in Developer Command Prompt

Getting SDK and examples

In this section, we will download SDK and examples through Developer Command Prompt. The Raspberry Pi Pico “getting started guide”, section 9.2.2 includes extremely helpful guide for this part. It is very easy for you to follow each steps and get SDK.

cdcbc1bc7e45ee6efcc15181131135b

If you mistakenly downloaded VS code and followed the instruction in Chapter 2 to download SDK and examples, you can skip this part and jump to the section "Building "Hello World" from the Command Line." But before you follow the next section, I highly recommend you to download and use Visual Studio 2022 instead of VS code terminal. Using developer Command Prompt in Visual Studio 2022 is easier for you to set the path to the SDK and build files for the "hello_usb.c" in next step.

The started guide does not include the guide to create files named pico and Downloads, here is the instruction:

C:\Users> mkdir pico
C:\Users> cd pico
C:\Users\pico> mkdir Downloads
C:\Users\pico> cd Downloads

Then you can follow the guide to get the SDK and examples

Building "Hello World" From the Command Line

Then you can set the path to the SDK as follows in a Developer Command Prompt window:

C:\Users\pico\Downloads> setx PICO_SDK_PATH "..\..\pico-sdk"

After entering this command line, the command window will prompt a hint information which indicating that the setup for the environment variable is completed. Now you need to remember to close your current Command Prompt Window and and open a second Developer Command Prompt window where this environment variable will now be set correctly before proceeding.

Then enter the command lines below: ''' C:\Users\pico\Downloads> cd pico-examples C:\Users\pico\Downloads\pico-examples> mkdir build C:\Users\pico\Downloads\pico-examples> cd build C:\Users\pico\Downloads\pico-examples\build> cmake -G "NMake Makefiles" .. C:\Users\pico\Downloads\pico-examples\build> nmake '''

After entering "cmake -G "NMake Makefiles" ..", if the command window prompt a hint information which indicating that there is an error "cannot find arm none". There are several reasons:

  1. you did not close your current Command Prompt Window and and open a second Developer Command Prompt after setting a path
  2. you did not check "Add path to environment variable" before finishing installing Toolchain. If not, our Developer Command Prompt will not detect arm none when we setup cmake.
  3. I initially used VS code terminal and it did not work. If you also use VS code terminal, try to download and use Developer Command Prompt in Visual Studio 2022.

If you successfully run the last two command lines, just wait until the building process is completed.

image

Then you can find hello_usb.uf2 file in hello_world/usb directories inside your build directory. (pico-examples > build > hello_world > usb)

image

SERIAL CONSOLE – SCREEN, PUTTY, ETC

Since there is no screen on Windows OS, we need to download PuTTY to see the result printed in the serial console. Last version of PuTTY can be downloaded here.

f3c79a61bf873baa450b1e12dc8e63d

Before running PuTTY, we neeed to want to find out which serial port your board is using. When you plug your board in to USB on your computer, it connects to a serial port.

You'll use Windows Device Manager to determine which port the board is using. The easiest way to determine which port the board is using is to first check without the board plugged in. Open Device Manager. Click on Ports (COM & LPT). You should find something already in that list with (COM#) after it where # is a number.

Now plug in your board. The Device Manager list will refresh and a new item will appear under Ports (COM & LPT). You'll find a different (COM#) after this item in the list.

40ef39c9190ea18189e75cdbbe7b61b

Notice the COM number when the list refreshes, sometimes it is not COM3.

Then after you connect your board to the USB port and run PuTTY:

  1. choose the button next to Serial under Connection type.
  2. enter the serial port you found that your board is using in the box under Serial line.
  3. enter 115200 in the box under Speed.

image

After click open, you can see the result printed in the serial console. 4567e857ebecb5f4adc4f8deeb7ada8

ese519_lab2_setup_windows's People

Contributors

maxma6150 avatar

Watchers

 avatar

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.