アプリケーションノート 7222

How to Develop Eclipse Board Files for Custom Low-Power Microcontroller Circuits

筆者: Venkatesh Karra

要約:

Maxim Integrated uses the EclipseTM IDE for programming their low-power micros. This document describes the procedure for adding a customer's design board to the Eclipse environment for programming and debugging.


Introduction

In this document, we demonstrate how to create board support files for the MAX32630FTHR based on the board files provided for the MAX32630 evaluation kit (EV kit).

To add a custom designed board to the Eclipse environment, the user needs to develop their own board support files. This includes source files (.c) and header files (.h) required to prepare the execution environment prior to entering main() function, along with a list of supported adapters, a list of example projects known to work on the new board, and the default makefile. We recommend that customers use existing board files as a reference to develop their own board support package.

Procedure for Adding Files

  1. An ARM® Cortex® tool chain is required and can be installed from the following link: https://www.maximintegrated.com/content/maximintegrated/en/design/software-description.html/swpart=SFW0001500A
  2. Next, go to the following folder in your PC as shown in Figure 1:
    C:\Maxim\Firmware\MAX3263X\Libraries\Boards

    Note the file location might change depending on user installation preferences. Maxim Integrated also supports Mac development and, in those cases, the Maxim Integrated directory is in the root of the home folder.

    Location to create the new folder using the name of the custom boardFigure1. Location to create the new folder using the name of the custom board.

  3. Now create a folder named MAX32630FTHR. Open the folder and create the files as shown in Figure 2.

    Every new custom board should have these files and foldersFigure2. Every new custom board should have these files and folders.

  4. Every time you add a new board to Eclipse, the following files need to be prepared:
    • Include: This folder contains the board.h file. This is the header file for the FTHR board that declares the constants, structures, and functions that pertain to the hardware components of the new board.
    • Source: This folder contains the board.c file. This file contains the function code that configures the execution environment for the new board.
    • adapters.txt: A list of all the adapters supported by this board.
    • example.txt: The example projects supported by MAX32630FTHR.

Include and Source Folders

board.h and board.c files
When an ARM Cortex-M class microcontroller starts up, it typically runs a short program that configures the stack and initializes random access memory (RAM). Before control of execution is passed to main however, the C startup code calls a board initialization function that in turn calls other initialization functions as required for the board. The constants, structures, and functions required to initialize the board are declared in board.h and are instantiated in board.c.

The header file consists of function initializations and the source files contain the function definitions.

This MAX32630FTHR board.h file declares these functions:

  • int Board_Init(void)
    This function initializes the board support package (BSP) and the board interfaces. This includes initialization and configuration of the console, LEDs, pushbutton, and PMIC.
  • int Console_Init(void)
    This function initializes or re-initializes the console UART.
  • int Console_PrepForSleep(void)
    When the MAX32630 enters LP1 low-power mode, all clocks are removed from peripheral components and from the core itself. This means any characters currently in the console UART transmit FIFO are not transmitted. The Console_PrepForSleep function waits for the console UART to become empty before returning, and so allows all characters to be flushed from the UART FIFO before the core enters LP1 sleep mode.

Other declarations in the board.h file include configuration of switches, pushbuttons, the console UART, and the PMIC, as well as definition of the configuration structures to be stored as constant values in flash.

Paste the attached code into the board.h file. Code for all files pertaining to this application note can be found here.

Adapters.txt, Examples.txt, and Board.mk

The adapter.txt file contains a list of all the adapters that are compatible with the MAX32630FTHR. The examples.txt file contains a list of all the examples that are known to run without modification on the MAX32630FTHR. The board.mk file adds the source files needed for the board to operate and defines all the paths for the source and header files. The board.mk file is automatically included in the build operation whenever the make command from Eclipse is invoked.

Implementation Procedure

  • Open Eclipse. You can use an existing MAX3263X workspace or you can create a new one.
  • After importing the projects to the workspace, expand "Hello_World" and open the makefile.
  • Next, modify the following lines by changing BOARD = EVKIT to BOARD = MAX32630FTHR.

# Specify the board used

    ifeq "$(BOARD)" ""
    BOARD=MAX32630FTHR
    endif

Conclusion

This application note describes a brief procedure on how to develop custom board files. The recommendation is to use the existing board files as a reference to develop the custom files. For further questions on this contact:
https://maximsupport.microsoftcrmportals.com/en-US/support/create-case/