Coder Social home page Coder Social logo

arm-bmw-sw's Introduction

arm-bmw-sw

A lightweight software library and selftest application for the arm-bmw development board.

Git: git clone https://github.com/vsergeev/arm-bmw-sw.git

Self-test Application

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.

File Structure

  • README.md This README
  • Makefile Makefile
  • LICENSE MIT License
  • lpc1114.dld LPC1114 linker script
  • openocd/ OpenOCD flash and debug scripts
  • src/ Library sources
    • system/ Startup files
      • cmsis/ CMSIS header files
      • lpc11xx/ LPC11xx header files
      • startup.c Interrupt vector table and reset handler
      • tick.c, tick.h SysTick handler and delay_ms() helper
    • io/ peripheral I/O drivers
      • uart.c, uart.h Polling UART driver
      • spi.c, spi.h Polling SPI driver
      • adc.c, adc.h Polling ADC driver
      • i2c.c, i2c.h Interrupt-driven I2C driver
      • queue.c, queue.h Queue data structure for I2C driver
      • i2c_reg.c, i2c_reg.h I2C register read/write wrappers for I2C driver
    • driver/ Chip Drivers
      • mcp23008.c, mcp23008.h I/O Expander driver
      • sf.c, sf.h SPI Flash driver
    • debug.c, debug.h Debug printf function
    • test.h Assertion framework/macros for testing
    • bmw_ui.c, bmw_ui.h Wrapper for BMW's User Interface (LEDs and buttons)
    • ucli.c, ucli.h µCLI Shell
    • urpc.c, urpc.h µRPC Server
  • pybmw/ Python µRPC client
    • urpc.py µRPC client
  • app/ Applications sources
    • selftest Self-test application
    • main.c Self-test main
    • cli_programs.c Self-test CLI handlers
    • rpc_handlers.c Self-test RPC handlers
    • tests/ Self-test tests
      • tests.h Test prototypes
      • test_uart.c UART test
      • test_spi.c SPI test
      • test_spi_flash.c SPI Flash Memory test
      • test_i2c.c I2C test
      • test_mcp23008.c I/O Expander test
      • test_bmw_ui.c BMW User Interface test

Building, Flashing, Debugging

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 all

This 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> all Build the static library, and with it, the application
  • make APP=<app> clean Clean the build products and build directory
  • make APP=<app> stat Dump program symbols and section sizes
  • make APP=<app> flash Flash the program file over JTAG with OpenOCD
  • make APP=<app> flashisp Flash the program file over UART with lpc21isp
  • make APP=<app> debug Flash the program file over JTAG with OpenOCD and halt the target for debugging
  • make APP=<app> gdb Launch gdb and connect to OpenOCD's gdbserver for debugging

Flashing over JTAG with OpenOCD

make APP=selftest flash

Flashing with OpenOCD requires an SWD-capable JTAG dongle, like the ST-LINK/V2.

Flashing over UART with lpc21isp

make APP=selftest flashisp

Flashing 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.

Debugging with GDB

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 debug

While OpenOCD is running from the command above, launch gdb with:

make APP=selftest gdb

GDB will connect to OpenOCD's gdbserver and allow you to interactively debug the target.

Documentation

More comprehensive library documentation is in progress. Please examine the selftest code in apps/selftest and the library header files for now.

License

arm-bmw-sw is MIT licensed. See the included LICENSE file.

arm-bmw-sw's People

Contributors

vsergeev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gavinlwz telantan

arm-bmw-sw's Issues

clion+stm32

I try to press RST,but the result was the same

Info : DEPRECATED target event trace-config; use TPIU events {pre,post}-{enable,
disable}
adapter speed: 8000 kHz

Info : CMSIS-DAP: SWD  supported
Info : CMSIS-DAP: JTAG supported
Info : CMSIS-DAP: FW Version = 1.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 8000 kHz
Info : SWD DPIDR 0x2ba01477
Info : stm32f1x.cpu: Cortex-M3 r2p1 processor detected
Info : stm32f1x.cpu: target has 6 breakpoints, 4 watchpoints
Info : gdb port disabled
Error: timed out while waiting for target halted
embedded:startup.tcl:1029: Error: ** Unable to reset target **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1066
at file "embedded:startup.tcl", line 1029

this is st_nucleo_f103rb.cfg

# choose st-link/j-link/dap-link etc.
adapter driver cmsis-dap
transport select swd

# 0x10000 = 64K Flash Size
set FLASH_SIZE 0x20000

source [find target/stm32f1x.cfg]

# download speed = 10MHz
adapter speed 8000

Plese help me!

Error: timed out while waiting for target halted

I've got an lpc1114fn28 connected to an stlink-v2 from a discovery board.
CN3 pins connected 1->VDD, 2->SWCLK, 3->GND, 4->SWDIO, 5-> reset, 6 -nc .. power to lpc1114 coming from the 3V pin on the discovery.

When I run it fails at the reset init function, if i remove that line and replace it with a halt, I can then connect via arm-none-eabi-gdb and successfully load and debug.

Do I need to do anything special with the reset pin? I have an external pullup connected and pin 5 from the debug connector on the discovery board.

Thanks,
-rick

$ openocd -s openocd -f debug.cfg 
Open On-Chip Debugger 0.8.0-dev-00331-g1137eae (2014-01-25-15:17)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.898221
Info : lpc1114.cpu: hardware has 4 breakpoints, 2 watchpoints
Error: timed out while waiting for target halted
TARGET: lpc1114.cpu - Not halted

Runtime Error: debug.cfg:9: 
in procedure 'script' 
at file "embedded:startup.tcl", line 58
in procedure 'reset' called at file "debug.cfg", line 9
$ 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.