element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Path to Programmable
  • Challenges & Projects
  • Design Challenges
  • Path to Programmable
  • More
  • Cancel
Path to Programmable
Blog Path to Programmable - SW Labs 5 and 6
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: aspork42
  • Date Created: 2 Jan 2019 6:15 AM Date Created
  • Views 638 views
  • Likes 4 likes
  • Comments 2 comments
  • debug
  • avnet
  • path to programmable
  • fpga
  • vivado
  • sdk
Related
Recommended

Path to Programmable - SW Labs 5 and 6

aspork42
aspork42
2 Jan 2019

Hello again,

In lab 5 we finally connect the MiniZed and flash it with a program! Closely followed by lab 6 in which we set up the first stage bootloader - FSBL. This will allow the MiniZed to run "untethered" and not plugged in with the JTAG connector to the computer run our program.

 

About:

Through Avnet, Xilinx and Element14, a training program to learn about the Zynq 7000 platform which is System On Chip combining an FPGA with an ARM processor. This comes to the students as complete development board packed with goodies like a wireless chip from MuRata (BT/BTLE/WIFI), 8GB Flash memory, onboard RAM, USB to JTAG (JTAG programmable over USB), Arduino-style headers (3.3V compatible only), Microphone, Bi-Color LED, and two additional expansion ports.

 

See all blog posts for this training here.

 

Lab 5- Connecting!

In this section, we connect and download our application over JTAG; then run it. We will also learn the debug utilities of the SDK - setting breakpoints and stepping through code; viewing the call stack, and other useful features. Being that our FPGA uses volatile memory, we would normally be storing the program into flash memory or on an SD card. For initial test and debug, we will be using the SDK to function like that via the JTAG interface and we can run initial code without having to program it into flash. In the following lab, we'll download to flash to run 'untethered'.

Therefore; one of our initial steps is setting the DIP switch on the board to "J"; telling it to boot from JTAG instead of from Flash. I noticed that even at this stage in the training, my MiniZed still has its 'Hello World' programmed into the flash. This is a simple program that reads the on-board microphone and changes an LED brightness based on the sound level.

 

We open the SDK after having our board plugged in and press "Program FPGA" (the button highlighted below).

image

This sends the current loaded application in the SDK down to the board. Again - this is just held in volatile memory and NOT saved to the board itself. The bitstream is written when the "Program" button is pressed.

 

The Hello Zynq program is run (right click on top level folder in Project Explorer --> Run As --> Run Configuration --> New --> Run) and we get our output shown in the serial console. (I'm running PuTTY as my console application).

image

 

I also then ran the quick memory tester application which tests the first 4K in BRAM, DDR, and regular RAM. The Test_Memory_FullDDR also also run and it validates a full 1mb of DDR memory.

 

The last portion of this is running the debugger. Using similar methods to the "run as", we right click our program in the explorer and hit "Debug as" and then "New"; "Debug". The difference here is that the SDK "perspective" changes to the "debug" perspective. This feels a lot like Visual Studio when you "F5" to debug a program. The bitstream is written to the MiniZed and we have a new view of the SDK. We can set breakpoints, step through code, pause execution, check variable status/values, and manually check all sorts of other things if we chose. Another difference is that I am able to close PuTTY and use a terminal directly within the SDK's Debug perspective as a tab. This felt much more useful and more complete for this type of debugging.

 

We are also presented with our source code, the C file, and I was able to edit directly in the debug window then "relaunch" the debugger and try out the changes. This was very powerful as it would allow a fast way to work through code changes and test things.

 

image

 

 

That was it for Lab 5 - On to the next one!

 

Lab 6 - First Stage Bootloader (FSBL)

 

This lab focuses on loading our application to the Flash (non-volatile) memory so that we can unplug from our computer and run the board by itself. One thing I learned in this lesson was that the Zynq7000 series; although it is both an ARM processor AND an FPGA; it is a "processor first" chip. This means that the CPU must boot in order for the PFGA to read in its program. As opposed to traditional FPGAs which had an ability to 'on their own' connect to external flash to download the program without the need for a traditional microprocessor. So even a most basic program must be on the CPU for the FPGA to run. A fully stand-alone FPGA is not supported.

 

The FSBL first can initialize the PLL, External memory, and MIO. It also can configure the PL with our bitstream; then finally runs our application. So this file is really just a very basic set of instructions used to get things ready for the actual code to be able to run.

The SDK can generate the FSBL automatically based on our hardware package and our program.

After the FSBL runs, a Second Stage Boot Loader runs; which can launch the OS such as PetaLinux on the Zynq. It is important to note also that the options for the SSBL include USB, GigE which aren't options for the FSBL (and even more limited options on the MiniZed. So we can almost "PXE Boot" the device - FSBL could provide some basic computer networking information, then we could launch a program which was based on a network server (if I'm understanding this correctly). Very cool!

The FSBL can be created by the SDK, and/or manually; however it is effectively limited to 192k in size for basic implementations. There are some ways around it (running directly from memory) but embedded programmers should pay attention to this.

 

So in summary, the FSBL needs to be created then loaded into QSPI Flash memory; which will allow the chip to boot properly and run our program.

 

Creating the FSBL from template

This is pretty straight-forward. From within SDK, we click "File--> New Application Project --> then chose FSBL from the list of available templates. One change is that we tell SDK to create a new BSP (Board Support Package) instead of using the existing one. This is because the requirements of the FSBL are different from the regular BSP as it includes a file system library (xilffs).

image

 

These libraries weren't present in the regular BSP:

image

 

 

My FSBL came out at 164,480 bytes (~160k). That is within the limit of 192k of the FSBL memory.

 

We then check the Properties for the build. There are numerous options for compressing down the build size and for setting the debug level. The default is No Optimization, and Debug level to Maximum. For a final deliverable, then these should certainly change to be more... embedded image

 

image

 

My release file came out at 157,500 bytes (153k); so about 5% smaller.

 

That was about it for this lesson. We examined some of the generated files, but won't be uploading to the board until the next lab - Lab 7.

 

We did find the location where the FSBL hands off to the SSBL in a file called main.c:

/*
* FSBL handoff to valid handoff address or
* exit in JTAG
*/
FsblHandoff(HandoffAddress);

 

Until next time!

 

- James

  • Sign in to reply

Top Comments

  • aspork42
    aspork42 over 6 years ago in reply to genebren +2
    I originally wanted to do a re-vamp of a line follower I made in like 2011 but the timeline won't allow it. I think I'm going to isolate one system on the line follower and implement that. In the future…
  • genebren
    genebren over 6 years ago +1
    Nice update on you journey down the path to programming. Are you getting an idea as to what your finally project will be? Maybe you could come up with an extension to your vent hood project, Good luck…
  • aspork42
    aspork42 over 6 years ago in reply to genebren

    I originally wanted to do a re-vamp of a line follower I made in like 2011 but the timeline won't allow it. I think I'm going to isolate one system on the line follower and implement that. In the future, I think I will follow through and finish out a brand new line follower based on the MiniZed - It will be much more feature-full than the original I created.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 6 years ago

    Nice update on you journey down the path to programming.  Are you getting an idea as to what your finally project will be?  Maybe you could come up with an extension to your vent hood project,

     

    Good luck in your journey!

     

    Gene

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube