cc3200: Use peripheral driver library functions from ROM

Previously, CC3200 drivers had two options to use the peripheral
driver library APIs:
1) Build driverlib SDK files in Zephyr, in ext/hal/ti/cc3200/*
2) Link directly with the driverlib.a, from an externally installed
   TI CC3200 SDK.

A new option is added to replace option 2), and is now the default:
3) Use the driverlib functions already provided in ROM.

This enables a savings in code size, which will depend on the
types of device drivers configured and the number of SDK
APIs actually used.

A rom_report build of the shell sample application showed
a savings of about 2kb in code space using this new config option.

Change-Id: Ie1ede6f7aacd23db20f5292e776f1dfeab5c7fe0
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Gil Pitney 2016-12-13 19:48:15 -08:00 committed by Kumar Gala
commit 9bc293c827
7 changed files with 49 additions and 38 deletions

View file

@ -20,9 +20,6 @@ config FLASH_SIZE
config CC3200SDK_LIBRARY
def_bool n
config CC3200SDK_INSTALL_PATH
default ""
config NUM_IRQS
int
# must be >= the highest interrupt number used

View file

@ -22,4 +22,4 @@ CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Enable CC3200 SDK driver files
CONFIG_CC3200SDK_BUILTIN=y
CONFIG_CC3200SDK_ROM_DRIVERLIB=y

View file

@ -1,4 +1,4 @@
obj-$(CONFIG_HAS_KSDK) += ksdk/
obj-$(CONFIG_QMSI_BUILTIN) += qmsi/
obj-$(CONFIG_HAS_STM32CUBE) += st/stm32cube/
obj-$(CONFIG_CC3200SDK_BUILTIN) += ti/cc3200sdk/
obj-$(CONFIG_HAS_CC3200SDK) += ti/cc3200sdk/

View file

@ -1,17 +1,18 @@
# CC3200 SDK builds driverlib with level 0 optimization (-O0).
# Zephyr uses -Os optimization level, which causes issues
# with the uart module: characters are garbled on output.
# Until this is resolved with the vendor, we keep -O0 here,
# to ensure correct operation.
# CONFIG_CC3200SDK_BUILTIN can be used for debugging purposes.
# In that case, the CC3200 SDK driverlib must be built with level 0
# optimization (-O0) for the uart module to work properly.
# Note the default build for Zephyr is CONFIG_CC3200SDK_ROM_DRIVERLIB=y
# which uses the ROM versions of the APIs instead.
ccflags-$(CONFIG_CC3200SDK_BUILTIN) += -O0
ccflags-$(CONFIG_CC3200SDK_BUILTIN) += -D$(COMPILER)
ccflags-$(CONFIG_HAS_CC3200SDK) += -D$(COMPILER)
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/gpio.o
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/interrupt.o
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/pin.o
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/prcm.o
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/uart.o
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/utils.o
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/udma.o
# spi.c warns on parens
CFLAGS_spi.o += -Wno-parentheses
obj-$(CONFIG_CC3200SDK_BUILTIN) += driverlib/spi.o
# Need prcm and utils for PRCMCC3200MCUInit which is not in ROM
obj-$(CONFIG_HAS_CC3200SDK) += driverlib/utils.o
obj-$(CONFIG_HAS_CC3200SDK) += driverlib/prcm.o

View file

@ -19,18 +19,11 @@ config CC3200SDK_BUILTIN
help
Link with local CC3200 SDK driverlib sources.
config CC3200SDK_LIBRARY
bool "Link with CC3200 SDK static driver library"
default n
select CC3200SDK
help
The CC3200 SDK provides a static library (libdriver.a)
which implements peripheral APIs for the CC3200.
config CC3200SDK_INSTALL_PATH
depends on CC3200SDK_LIBRARY
string "CC3200 SDK install path"
help
This option holds the path where the CC3200 SDK is installed.
config CC3200SDK_ROM_DRIVERLIB
bool "Use the Peripheral Driver library functions in ROM"
default n
select CC3200SDK
help
Vector to CC3200 SDK driverlib APIs in ROM.
endif

View file

@ -1,11 +1,9 @@
ifdef CONFIG_CC3200SDK_LIBRARY
ZEPHYRINCLUDE += -I$(CONFIG_CC3200SDK_INSTALL_PATH)
LIB_INCLUDE_DIR += -L$(CONFIG_CC3200SDK_INSTALL_PATH:"%"=%)/driverlib/gcc/exe
ALL_LIBS += driver
endif # CONFIG_CC3200SDK_LIBRARY
ifdef CONFIG_CC3200SDK_BUILTIN
ifdef CONFIG_HAS_CC3200SDK
ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/cc3200sdk
ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/cc3200sdk/inc
ZEPHYRINCLUDE +=-I$(srctree)/ext/hal/ti/cc3200sdk/driverlib
endif # CONFIG_CC3200_BUILTIN
endif # CONFIG_HAS_CC3200SDK
ifdef CONFIG_CC3200SDK_ROM_DRIVERLIB
KBUILD_CFLAGS += -DTARGET_IS_CC3200
endif # CONFIG_CC3200SDK_ROM_DRIVERLIB

View file

@ -10,8 +10,30 @@ from:
Files in driverlib/ and inc/ are copied from an SDK installation
(without modification).
Setting CONFIG_CC3200SDK_BUILTIN allows building those files within
the Zephyr ext/hal/ subdirectory.
After setting CONFIG_HAS_CC3200SDK=y in Kconfig, there are two methods
for using the peripheral driver library:
Setting CONFIG_CC3200SDK_INSTALL_PATH and CONFIG_CC3200SDK_LIBRARY enables
linking with the library provided by the CC3200 SDK, installed separately.
1) (Default) Use the driverlib functions in ROM instead of RAM.
TI provides the driver library functions burned into ROM at the factory,
or updated via a service pack patch, thus saving application code space.
For the zephyr shell sample, for example, this resulted in a savings of
about 2Kb in code space.
Setting CONFIG_CC3200SDK_ROM_DRIVERLIB enables all driverlib APIs prefixed by
"MAP_" to vector to those functions already existing in ROM.
See: Section 6.2.2 "Linking User Application with ROM APIs",
CC3200 Programmer's Guide, www.ti.com/lit/pdf/swru369
2) Use the driver library functions built from the CC3200SDK files in Zephyr.
Setting CONFIG_CC3200SDK_BUILTIN allows building those files within
the Zephyr ext/hal/ti/ subdirectory. Though this will take more code space
than using the ROM driverlib functions, this may be useful for debugging
purposes.
Applications can use the two configurations simultaneously: For example, calling
APIs without the "MAP_" prefix would call into Zephyr-built driver lib functions in
RAM, while calling APIs with the "MAP_" prefix would call into the ROM.