A lightweight software library and selftest application for the arm-bmw development board.
Git: git clone https://github.com/vsergeev/arm-bmw-sw.git
The self-test application provides a basic CLI over the UART with hardware unit tests and utility programs. The UART is configured for 115200 8N1, and the CLI may be accessed with your favorite serial port program.
The hardware unit tests include UART, SPI, I2C, SPI Flash, I/O Expander, and UI tests. These tests combine loopbacks and interactive verification to verify the correct operation of the hardware. See the tests in the apps/selftest/tests folder for more information.
A passing test log can be found in arm-bmw-selftest.log.
README.mdThis READMEMakefileMakefileLICENSEMIT Licenselpc1114.dldLPC1114 linker scriptopenocd/OpenOCD flash and debug scriptssrc/Library sourcessystem/Startup filescmsis/CMSIS header fileslpc11xx/LPC11xx header filesstartup.cInterrupt vector table and reset handlertick.c,tick.hSysTick handler anddelay_ms()helper
io/peripheral I/O driversuart.c,uart.hPolling UART driverspi.c,spi.hPolling SPI driveradc.c,adc.hPolling ADC driveri2c.c,i2c.hInterrupt-driven I2C driverqueue.c,queue.hQueue data structure for I2C driveri2c_reg.c,i2c_reg.hI2C register read/write wrappers for I2C driver
driver/Chip Driversmcp23008.c,mcp23008.hI/O Expander driversf.c,sf.hSPI Flash driver
debug.c,debug.hDebug printf functiontest.hAssertion framework/macros for testingbmw_ui.c,bmw_ui.hWrapper for BMW's User Interface (LEDs and buttons)ucli.c,ucli.hµCLI Shellurpc.c,urpc.hµRPC Server
pybmw/Python µRPC clienturpc.pyµRPC client
app/Applications sourcesselftestSelf-test applicationmain.cSelf-test maincli_programs.cSelf-test CLI handlersrpc_handlers.cSelf-test RPC handlerstests/Self-test teststests.hTest prototypestest_uart.cUART testtest_spi.cSPI testtest_spi_flash.cSPI Flash Memory testtest_i2c.cI2C testtest_mcp23008.cI/O Expander testtest_bmw_ui.cBMW User Interface test
The Makefile builds the sources in src/ into a static library, and with it, an application in app/ into a program file. The application to build from app/ is specified with the APP environment variable. If APP is not specified, the application defaults to selftest.
The GNU arm-none-eabi cross-compiler prefix is specified with the CROSS environment variable. If CROSS is not defined, the compiler prefix defaults to arm-none-eabi-.
For example, to build the selftest application, run:
make APP=selftest allThis will produce the program files arm-bmw-selftest.elf,hex,bin and the memory map obj/arm-bmw-selftest.map, among other build products.
The available Makefile targets are:
make APP=<app> allBuild the static library, and with it, the applicationmake APP=<app> cleanClean the build products and build directorymake APP=<app> statDump program symbols and section sizesmake APP=<app> flashFlash the program file over JTAG with OpenOCDmake APP=<app> flashispFlash the program file over UART with lpc21ispmake APP=<app> debugFlash the program file over JTAG with OpenOCD and halt the target for debuggingmake APP=<app> gdbLaunch gdb and connect to OpenOCD's gdbserver for debugging
make APP=selftest flashFlashing with OpenOCD requires an SWD-capable JTAG dongle, like the ST-LINK/V2.
make APP=selftest flashispFlashing with lpc21isp requires a serial port cable connected to the arm-bmw UART header. Be sure to reset the arm-bmw board with the bootloader header jumpered before flashing, to start the microcontroller into its on-chip ROM bootloader.
Note: the LPC21ISP_SERIAL_PATH variable may need to be updated with the correct serial port device path in the Makefile.
The debug target uses OpenOCD to flash the program, halt the target, and launch OpenOCD's gdbserver. Debugging the arm-bmw with OpenOCD requires an SWD-capable JTAG dongle, like the ST-LINK/V2.
make APP=selftest debugWhile OpenOCD is running from the command above, launch gdb with:
make APP=selftest gdbGDB will connect to OpenOCD's gdbserver and allow you to interactively debug the target.
More comprehensive library documentation is in progress. Please examine the selftest code in apps/selftest and the library header files for now.
arm-bmw-sw is MIT licensed. See the included LICENSE file.