LM3S系列的芯片对于芯片有固化驱动库和没有固化驱动库的区别
LM3S系列的芯片对于芯片有固化驱动库和没有固化驱动库的区别今天在选型的时候发现,有一个区别,对于有Stellarisware in rom 和没有Stellarisware in rom的LM3S型号的芯片在使用驱动库函数的时候有什么区别吗,固化和没固化有什么优势吗?
1,TI Stellaris系列MCU有一个非常有优势的特点,就是免费提供称为StellarisWare的固件开发包,如果没有安装,请到TI网站搜索下载并安装。2, TI Stellaris系列MCU的ROM根据型号的不同,可能会包含ROM Software Libraries, ROM Bootloader,ROM AES/CRC Tables。一般ROM Software Libraries与ROM Bootloader同时存在,而ROM AES/CRC Tables则不一定。
3,在 StellarisWare安装目录下的docs文件夹下,有《SW-DRL-UG-xxxx》(xxxx代表StellarisWare的发布版本号),它是Stellaris® Peripheral Driver Library USER’S GUIDE。第26章“Using the ROM”会对于ROM的使用有详细的讲解。
为了大家的方便,简单摘录几段如下:
“26.1 Introduction
By utilizing the code in the on-chip ROM, more flash is available for use by the application.
The boot loader is also contained within the ROM, which can be called by an application in order to
start a firmware update.”
“26.2 Direct ROM Calls
In order to call the ROM, the following steps must be performed:
1,The device on which the application will be run must be defined. This is done by defining a
preprocessor symbol, which can be done either within the source code or in the project that
builds the application. The later is more flexible if code is shared between projects.
2, driverlib/rom.h is included by the source code desiring to call the ROM.
3, The ROM version of a peripheral driver library function is called. For example, if GPIODirMod-
eSet() is to be called in the ROM, ROM_GPIODirModeSet() is used instead.
A define is used to to select the device being used since the set of functions available in the ROM
must be a compile-time decision; checking at run-time does not provide any flash savings since
both the ROM call and the flash version of the API would be in the application flash image.
The following defines are recognized by driverlib/rom.h:
TARGET_IS_DUSTDEVIL_RA0 The application is being built to run on a DustDevil-class de-
vice, silicon revision A0.
TARGET_IS_TEMPEST_RB1 The application is being built to run on a Tempest-class device,
silicon revision B1.
By using ROM_Function(), the ROM will be explicitly called. If the function in question is not avail-
able in the ROM, a compiler error will be produced.
See the Stellaris ROM User’s Guide for details of the APIs available in the ROM.”
“26.3 Mapped ROM Calls
When code is intended to be shared between projects, and some of the projects run on devices with
a ROM and some run on devices without a ROM, it is convenient to have the code automatically
call the ROM or the flash version of the API without having #ifdef-s in the code. rom_map.h
provides an automatic mapping feature for accessing the ROM. Similar to the ROM_Function()
APIs provided by rom.h, a set of MAP_Function() APIs are provided. If the function is available in
ROM, MAP_Function() will simply call ROM_Function(); otherwise it will call Function().
In order to use the mapped ROM calls, the following steps must be performed:
1, Follow the above steps for including and using driverlib/rom.h.
2, Include driverlib/rom_map.h.
3, Continuing the above example, call MAP_GPIODirModeSet() in the source code.
As in the direct ROM call method, the choice of calling ROM versus the flash version is made at
compile-time. The only APIs that are provided via the ROM mapping feature are ones that are
available in the ROM, which is not every API available in the peripheral driver library.
The following is an example of calling a function in shared code, where the device in question is
defined in the project file:
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/systick.h"
void
SetupSysTick(void)
{
MAP_SysTickPeriodSet(0x1000);
Map_SysTickEnable();
Luminary Micro先后推出3代Stellaris(群星)系列ARM,都采用性能先进的Cortex-M3处理器内核:
第一代:Sandstorm(沙暴)
第二代:Fury(狂暴)
第三代:DustDevil(尘魔)
近期,有多个客户在咨询Luminary第三代产品DustDevil家族内部集成的ROM库函数如何使用的问题,现总结如下,供大家参考交流:
驱动库函数固化在ROM当中,好处有:
1. 不会占用用户的任何Flash资源
2. 最大限度提高代码密度
3. 加快程序执行速度
4. 这是Luminary免费提供的,不存在版权问题(royalty-free)
5. 固化的驱动库同时也是bootloader(即ISP下载),提供UART、I2C、SSI等多种接口
【ROM库函数用法1】
● 首先保证你使用的芯片属于Luminary Micro第三代产品DustDevil家族,如LM3S5749
● 在程序的开头做如下定义:
#define TARGET_IS_DUSTDEVIL_RA0
#include <rom.h>
● 然后在每个调用的库函数名前面加上ROM_前缀就可以了
【ROM库函数用法2】
● 首先保证你使用的芯片属于Luminary Micro第三代产品DustDevil家族,如LM3S5749
● 在程序的开头做如下定义:
#define TARGET_IS_DUSTDEVIL_RA0
#include <rom_map.h>
#include <rom.h>
● 然后在每个调用的库函数名前面加上MAP_前缀就可以了
前缀MAP_要比前缀ROM_可移植性好
【注意事项】
驱动库版本不能太旧,否则不会支持ROM库特性
ROM库不支持某些库函数,如SysCtlDelay()
第一代:Sandstorm(沙暴)
第二代:Fury(狂暴)
第三代:DustDevil(尘魔)
近期,有多个客户在咨询Luminary第三代产品DustDevil家族内部集成的ROM库函数如何使用的问题,现总结如下,供大家参考交流:
驱动库函数固化在ROM当中,好处有:
1. 不会占用用户的任何Flash资源
2. 最大限度提高代码密度
3. 加快程序执行速度
4. 这是Luminary免费提供的,不存在版权问题(royalty-free)
5. 固化的驱动库同时也是bootloader(即ISP下载),提供UART、I2C、SSI等多种接口
【ROM库函数用法1】
● 首先保证你使用的芯片属于Luminary Micro第三代产品DustDevil家族,如LM3S5749
● 在程序的开头做如下定义:
#define TARGET_IS_DUSTDEVIL_RA0
#include <rom.h>
● 然后在每个调用的库函数名前面加上ROM_前缀就可以了
【ROM库函数用法2】
● 首先保证你使用的芯片属于Luminary Micro第三代产品DustDevil家族,如LM3S5749
● 在程序的开头做如下定义:
#define TARGET_IS_DUSTDEVIL_RA0
#include <rom_map.h>
#include <rom.h>
● 然后在每个调用的库函数名前面加上MAP_前缀就可以了
前缀MAP_要比前缀ROM_可移植性好
【注意事项】
驱动库版本不能太旧,否则不会支持ROM库特性
ROM库不支持某些库函数,如SysCtlDelay()