Keil Logo

ARM: using Board Support drivers with other peripheral ports


Information in this knowledgebase article applies to:

  • MDK-ARM V5 and higher

SYMPTOM

I am user of MDK-ARM and I have installed an example project for a specific board with the Pack Installer. That project includes Board Support drivers, like for the serial EEPROM device connected via I2C.

I now want to use such drivers on my own hardware, where this EEPROM is connected to another I2C port. So I change the selected I2C port in RTE_Device.h to what I use on my board. However, building this project then fails with a linker error like this:

Demo.axf: Error: L6218E: Undefined symbol Driver_I2C0 (referred from eeprom.o).

CAUSE

The board support files are specifically designed for the board they are made for and so may not have the usual configuration options to customize them e. g. with the Configuration Wizard for different environments. However, some can be configured to use different peripheral ports, which is then done just like this:

#ifndef EEPROM_I2C_PORT
#define EEPROM_I2C_PORT       0         /* I2C Port number                    */
#endif

Just changing the driver instance in RTE_Device.h does not affect the Board Support driver, which will still refer to the original port instance. Changes in RTE_Device.h just affect the CMSIS driver files, which then includes the other instance.

SOLUTION

As seen in the Board Support driver, one can use a define to overwrite the default peripheral instance/port number. But it is not recommended to edit files from the Software Pack folder, which also indicates the enabled write protection of that files. So, the required configuration needs to be done somewhere else, like defining the port number via the related preprocessor definition in Options for Target ... - C/C++ - Preprocessor Symbols - Define dialog, e. g.:

EEPROM_I2C_PORT=1

MORE INFORMATION

Last Reviewed: Tuesday, May 12, 2015


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.