Hello Embedded Developers,
In this post, I’ll run through a quick example of using ModusToolbox from the Windows command line. First, let me point you to a couple of reference documents.
One clarification before I get started: I am not going to cover running configurators or the Mbed command line flow in this post. We will do that separately.
OK, first let’s get our Windows environment setup
1. We need GNU make. For Windows, Cypress recommends using a standard make distribution, such as found in Cygwin (uname -r returns “2.11.1(0.329/5/3)” for me). I use Cygwin64 Terminal to do all my Windows command line stuff.
2. ModusToolbox looks for an environment variable called CYSDK that points to the ModusToolbox installation. I have the following two lines in my Cygwin .bash_profile
Now, let’s build an application
I’ll start with the simple Blinky Application found in $INSTALL\libraries\psoc6sw-1.1\examples\Blinky (see screenshot that follows).
Be aware that the first build will take a lot longer than subsequent builds for this same project as the shared library, PSoC6_PDL.a, gets compiled the first time.
Note: Now is a good time to point out one of my favorite ModusToolbox make variables, DEBUG. If I experience weird or unexpected behavior, make DEBUG=true is my best friend (observe that DEBUG in all caps and true is all lowercase).
4. After a successful build, you’ll see a directory named “build” has been created. If you’re curious, take a look at the contents of that directory. For example, an ELF file has been created in build/PSoC6_cm4_dual/Debug/mainapp
The file [project name]_mainapp_final.elf in that directory is what we will use to program our device.
5. Optionally edit main.c in the Source directory. For example, I might want to change the blink rate of the LED. If you edit this file, you obviously need to go up one level in the hierarchy and type make again.
6. As discussed in the Running ModusToolbox from the Command Line document, we have built several handy make targets into ModusToolbox. Let’s use one now!
Successful programming will end with output that look something like the following.
That’s it. You are ready to try some examples on your own.
For reference, here is a portion of my .bash_profile. A few notes about it:
####### excerpt from the .bash_profile file for my Cygwin terminal
# Set up environment variable used by ModusToolbox tools
# I want to run several ModusToolbox tools from the command line
# The following is how I manage that. You don’t have to use this variable
# Add the ModusToolbox Device Configurator
# To Add CapSense Configurator, uncomment the next line
# To Add the Bluetooth Configurator, uncomment the next line
# To Add USB Configurator, uncomment the next line
# You can add similar lines for QSPI, SmartIO, etc.
# Add the FW Loader utility (used for various things such as updating kits to Kitprog3)
####### End excerpt from the .bash_profile
In future posts, we’ll show things like running the configurators from the command line and using the Mbed flow. Let me know in the comments if there is something specific you would like to see.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.