Skip to content

lf-lang/lf-aducm355-uc-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reactor-uc ADuCM355 template


This is a project template for developing LF applications targeting the Analog Devices ADuCM355 Precision Analog Microcontroller. It shows how to integrate the LF toolchain into the Keil uVision IDE. Keil is used to first run the Lingua Franca Compiler, before compiling the generated sources and downloading the binary onto the microcontroller.

Prerequisites

  • Windows host system, e.g Windows 11
  • EVAL-ADuCM355 evaluation board with Segger mIDAS-Link debug probe
  • Putty (or other serial terminal)

Getting Started

Clone this repository:

git clone --recursive https://github.com/lf-lang/lf-aducm355-uc-template/

Keil uVision

This template is based on integrating the LF toolchain into Keil uVision. Please download and install Keil uVision 5. At the time of writing, the ADuCM355 libraries from Analog Devices depends on ARM CMSIS Packs v5.9.0 and Arm C Compiler v5.06. These dependencies are not available in Keil uVision 5. You must manually downgrade ARM CMSIS Packs via the CMSIS Pack Manager found in Keil uVision 5. To install Arm Compiler v5.06 with Keil uVision 5, please follow the documentation here: https://developer.arm.com/documentation/ka005073/latest

For more information on this issue, see: analogdevicesinc/aducm355-examples#11

To verify that you have correctly installed Keil uVision, open the example Keil uVision project found in M355_GPIO.uvprojx, Rebuild and Download the program onto a connected ADuCM355 eval board using the provided JLink. See README for more info

Open Putty to read the printf's coming from the board. The baud rate is 115200 8N1.

Lingua Franca

The Lingua Franca Compiler requires Java 17. Install a JDK of choice, e.g. OpenJDK from here.

Make sure that the JAVA_HOME environment variable is pointing to the installation and that the bin directory of the installation is on the system PATH. Verify with java --version.

The fetch reactor-uc the Lingua Franca runtime for embedded systems.

git clone --recursive https://github.com/lf-lang/reactor-uc/

Define a system environmental variable REACTOR_UC_PATH that points to the location of reactor-uc.

Verify that the Lingua Franca toolchain and its dependencies are correctly installed with:

reactor-uc/lfc/bin/lfc-dev.ps1 --version

This will (re)build the Lingua Franca compiler and execute it.

Blinky

Now that we have correctly installed an IDE, Compiler, and the Lingua Franca toolchain, we are ready to compile and flash our first LF application.

Open the Blinky project in Keil uVision. Inspect Blinky.lf to see what the program does. Press the Rebuild button in Keil, this will take a little longer than usual because it first invokes the build script in build.ps1

This will generate source files for Blinky.lf into a a folder called src-gen, the generated sources are already added to the Keil project. After running the build script, Keil will build all the sources and produce an binary. Download it onto a connected board and watch LED DS2 blink.

Further topics

Adding more LF sources or reactors

Currently, we must add the generated sources to the Keil project manually. This means that if you add more reactors to your program, you must manually configure the Keil project to include the generated sources in the build. Each reactor declaration which is used, will result in a source file generated to src-gen/$PROGRAM_NAME/$LF_FILE_NAME/ReactorName. If you add more LF sources you have to also add the generated sources accordingly.

Logging

To change the log level, change the compile definition LF_LOG_LEVEL_ALL which is defined by selection Options for target->C/C++.

Low-power deep sleep

A special compile definition LF_BUSY_WAIT is provided to make the runtime do busy-waiting, instead of low-power hibernation between events. For deploying a system, the default low-power hibernation should be used and the LF_BUSY_WAIT compile definition should be removed from the Keil project setting.

Creating a new project

Create a new project by copying the Blinky project.

Decouple Keil uVision and LFC

Another alternative is to decouple the Keil uVision IDE and the Lingua Franca Compiler. Go to Options for target->User and remove the invokation of the build.ps1 script. Now you must manually call lfc either from the terminal, or through build.ps1 every time you modify the LF sources and then press Build or Rebuild in Keil to compile the project.

Troubleshooting

JLink - Cortex-M error: No Cortex-M SW Device Found

This happens when the MCU is in deep-sleep when we try to Download a new binary to it. For the ADuCM355, put it into BOOT mode by holding down Button S3 while pressing Button S1.

About

Project template for the Analog Devices ADuCM355 using Keil uVision

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published