From c3e4c9a25c2910d2d66d52215b3406b13d5b23d5 Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Sun, 29 Jun 2014 12:34:32 +0300 Subject: Add more board models --- boards/ek-lm4f232/Makefile | 74 + boards/ek-lm4f232/bitband/Makefile | 87 + boards/ek-lm4f232/bitband/bitband.c | 292 +++ boards/ek-lm4f232/bitband/bitband.ewd | 614 ++++++ boards/ek-lm4f232/bitband/bitband.ewp | 792 ++++++++ boards/ek-lm4f232/bitband/bitband.icf | 78 + boards/ek-lm4f232/bitband/bitband.ld | 57 + boards/ek-lm4f232/bitband/bitband.sct | 47 + boards/ek-lm4f232/bitband/bitband.uvopt | 317 ++++ boards/ek-lm4f232/bitband/bitband.uvproj | 434 +++++ boards/ek-lm4f232/bitband/bitband_ccs.cmd | 70 + boards/ek-lm4f232/bitband/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/bitband/ccs/.ccsproject | 10 + boards/ek-lm4f232/bitband/ccs/.cproject | 191 ++ boards/ek-lm4f232/bitband/ccs/.project | 55 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + boards/ek-lm4f232/bitband/ccs/Debug/bitband.bin | Bin 0 -> 5880 bytes boards/ek-lm4f232/bitband/ccs/Debug/bitband.out | Bin 0 -> 122215 bytes boards/ek-lm4f232/bitband/ccs/macros.ini_initial | 1 + boards/ek-lm4f232/bitband/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/bitband/ewarm/Exe/bitband.bin | Bin 0 -> 5208 bytes boards/ek-lm4f232/bitband/ewarm/Exe/bitband.out | Bin 0 -> 89728 bytes boards/ek-lm4f232/bitband/gcc/bitband.axf | Bin 0 -> 68740 bytes boards/ek-lm4f232/bitband/gcc/bitband.bin | Bin 0 -> 5323 bytes boards/ek-lm4f232/bitband/readme.txt | 29 + boards/ek-lm4f232/bitband/rvmdk/bitband.axf | Bin 0 -> 115384 bytes boards/ek-lm4f232/bitband/rvmdk/bitband.bin | Bin 0 -> 5432 bytes boards/ek-lm4f232/bitband/startup_ccs.c | 295 +++ boards/ek-lm4f232/bitband/startup_ewarm.c | 326 ++++ boards/ek-lm4f232/bitband/startup_gcc.c | 342 ++++ boards/ek-lm4f232/bitband/startup_rvmdk.S | 351 ++++ boards/ek-lm4f232/blinky/Makefile | 77 + boards/ek-lm4f232/blinky/blinky.c | 93 + boards/ek-lm4f232/blinky/blinky.ewd | 614 ++++++ boards/ek-lm4f232/blinky/blinky.ewp | 777 ++++++++ boards/ek-lm4f232/blinky/blinky.icf | 78 + boards/ek-lm4f232/blinky/blinky.ld | 57 + boards/ek-lm4f232/blinky/blinky.sct | 47 + boards/ek-lm4f232/blinky/blinky.uvopt | 268 +++ boards/ek-lm4f232/blinky/blinky.uvproj | 414 ++++ boards/ek-lm4f232/blinky/blinky_ccs.cmd | 70 + boards/ek-lm4f232/blinky/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/blinky/ccs/.ccsproject | 10 + boards/ek-lm4f232/blinky/ccs/.cproject | 183 ++ boards/ek-lm4f232/blinky/ccs/.project | 50 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + boards/ek-lm4f232/blinky/ccs/Debug/blinky.bin | Bin 0 -> 1424 bytes boards/ek-lm4f232/blinky/ccs/Debug/blinky.out | Bin 0 -> 32074 bytes boards/ek-lm4f232/blinky/ccs/macros.ini_initial | 1 + boards/ek-lm4f232/blinky/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/blinky/ewarm/Exe/blinky.bin | Bin 0 -> 848 bytes boards/ek-lm4f232/blinky/ewarm/Exe/blinky.out | Bin 0 -> 13384 bytes boards/ek-lm4f232/blinky/gcc/blinky.axf | Bin 0 -> 34684 bytes boards/ek-lm4f232/blinky/gcc/blinky.bin | Bin 0 -> 804 bytes boards/ek-lm4f232/blinky/readme.txt | 23 + boards/ek-lm4f232/blinky/rvmdk/blinky.axf | Bin 0 -> 10328 bytes boards/ek-lm4f232/blinky/rvmdk/blinky.bin | Bin 0 -> 852 bytes boards/ek-lm4f232/blinky/startup_ccs.c | 295 +++ boards/ek-lm4f232/blinky/startup_ewarm.c | 326 ++++ boards/ek-lm4f232/blinky/startup_gcc.c | 342 ++++ boards/ek-lm4f232/blinky/startup_rvmdk.S | 351 ++++ boards/ek-lm4f232/boot_demo1/Makefile | 92 + boards/ek-lm4f232/boot_demo1/boot_demo1.c | 267 +++ boards/ek-lm4f232/boot_demo1/boot_demo1.ewd | 614 ++++++ boards/ek-lm4f232/boot_demo1/boot_demo1.ewp | 801 ++++++++ boards/ek-lm4f232/boot_demo1/boot_demo1.icf | 78 + boards/ek-lm4f232/boot_demo1/boot_demo1.ld | 57 + boards/ek-lm4f232/boot_demo1/boot_demo1.sct | 47 + boards/ek-lm4f232/boot_demo1/boot_demo1.uvopt | 331 ++++ boards/ek-lm4f232/boot_demo1/boot_demo1.uvproj | 439 +++++ boards/ek-lm4f232/boot_demo1/boot_demo1_ccs.cmd | 70 + boards/ek-lm4f232/boot_demo1/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/boot_demo1/ccs/.ccsproject | 10 + boards/ek-lm4f232/boot_demo1/ccs/.cproject | 197 ++ boards/ek-lm4f232/boot_demo1/ccs/.project | 60 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.bin | Bin 0 -> 6456 bytes .../ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.out | Bin 0 -> 127325 bytes .../ek-lm4f232/boot_demo1/ccs/macros.ini_initial | 1 + .../ek-lm4f232/boot_demo1/ccs/target_config.ccxml | 13 + .../ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.bin | Bin 0 -> 5716 bytes .../ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.out | Bin 0 -> 100288 bytes boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.axf | Bin 0 -> 36034 bytes boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.bin | Bin 0 -> 5915 bytes boards/ek-lm4f232/boot_demo1/readme.txt | 48 + boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.axf | Bin 0 -> 120940 bytes boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.bin | Bin 0 -> 6148 bytes boards/ek-lm4f232/boot_demo1/startup_ccs.c | 364 ++++ boards/ek-lm4f232/boot_demo1/startup_ewarm.c | 395 ++++ boards/ek-lm4f232/boot_demo1/startup_gcc.c | 411 ++++ boards/ek-lm4f232/boot_demo1/startup_rvmdk.S | 359 ++++ boards/ek-lm4f232/boot_demo2/Makefile | 93 + boards/ek-lm4f232/boot_demo2/boot_demo2.c | 311 +++ boards/ek-lm4f232/boot_demo2/boot_demo2.ewd | 614 ++++++ boards/ek-lm4f232/boot_demo2/boot_demo2.ewp | 804 ++++++++ boards/ek-lm4f232/boot_demo2/boot_demo2.icf | 78 + boards/ek-lm4f232/boot_demo2/boot_demo2.ld | 57 + boards/ek-lm4f232/boot_demo2/boot_demo2.sct | 47 + boards/ek-lm4f232/boot_demo2/boot_demo2.uvopt | 345 ++++ boards/ek-lm4f232/boot_demo2/boot_demo2.uvproj | 444 +++++ boards/ek-lm4f232/boot_demo2/boot_demo2_ccs.cmd | 70 + boards/ek-lm4f232/boot_demo2/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/boot_demo2/ccs/.ccsproject | 10 + boards/ek-lm4f232/boot_demo2/ccs/.cproject | 197 ++ boards/ek-lm4f232/boot_demo2/ccs/.project | 65 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.bin | Bin 0 -> 7240 bytes .../ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.out | Bin 0 -> 138835 bytes .../ek-lm4f232/boot_demo2/ccs/macros.ini_initial | 1 + .../ek-lm4f232/boot_demo2/ccs/target_config.ccxml | 13 + .../ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.bin | Bin 0 -> 6436 bytes .../ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.out | Bin 0 -> 116708 bytes boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.axf | Bin 0 -> 36570 bytes boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.bin | Bin 0 -> 6704 bytes boards/ek-lm4f232/boot_demo2/readme.txt | 49 + boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.axf | Bin 0 -> 126852 bytes boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.bin | Bin 0 -> 6884 bytes boards/ek-lm4f232/boot_demo2/startup_ccs.c | 364 ++++ boards/ek-lm4f232/boot_demo2/startup_ewarm.c | 395 ++++ boards/ek-lm4f232/boot_demo2/startup_gcc.c | 411 ++++ boards/ek-lm4f232/boot_demo2/startup_rvmdk.S | 359 ++++ boards/ek-lm4f232/boot_serial/Makefile | 98 + boards/ek-lm4f232/boot_serial/bl_config.h | 1137 +++++++++++ boards/ek-lm4f232/boot_serial/boot_serial.ewd | 614 ++++++ boards/ek-lm4f232/boot_serial/boot_serial.ewp | 821 ++++++++ boards/ek-lm4f232/boot_serial/boot_serial.uvopt | 450 +++++ boards/ek-lm4f232/boot_serial/boot_serial.uvproj | 479 +++++ boards/ek-lm4f232/boot_serial/ccs/.ccsimportspec | 6 + boards/ek-lm4f232/boot_serial/ccs/.ccsproject | 10 + boards/ek-lm4f232/boot_serial/ccs/.cproject | 191 ++ boards/ek-lm4f232/boot_serial/ccs/.project | 115 ++ .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../boot_serial/ccs/Debug/boot_serial.bin | Bin 0 -> 1284 bytes .../boot_serial/ccs/Debug/boot_serial.out | Bin 0 -> 36737 bytes .../ek-lm4f232/boot_serial/ccs/macros.ini_initial | 1 + .../ek-lm4f232/boot_serial/ccs/target_config.ccxml | 13 + .../boot_serial/ewarm/Exe/boot_serial.bin | Bin 0 -> 1260 bytes .../boot_serial/ewarm/Exe/boot_serial.out | Bin 0 -> 40216 bytes boards/ek-lm4f232/boot_serial/gcc/boot_serial.axf | Bin 0 -> 36412 bytes boards/ek-lm4f232/boot_serial/gcc/boot_serial.bin | Bin 0 -> 1280 bytes .../ek-lm4f232/boot_serial/rvmdk/boot_serial.axf | Bin 0 -> 25444 bytes .../ek-lm4f232/boot_serial/rvmdk/boot_serial.bin | Bin 0 -> 1192 bytes boards/ek-lm4f232/boot_usb/Makefile | 98 + boards/ek-lm4f232/boot_usb/bl_config.h | 1137 +++++++++++ boards/ek-lm4f232/boot_usb/boot_usb.ewd | 614 ++++++ boards/ek-lm4f232/boot_usb/boot_usb.ewp | 821 ++++++++ boards/ek-lm4f232/boot_usb/boot_usb.uvopt | 450 +++++ boards/ek-lm4f232/boot_usb/boot_usb.uvproj | 479 +++++ boards/ek-lm4f232/boot_usb/ccs/.ccsimportspec | 6 + boards/ek-lm4f232/boot_usb/ccs/.ccsproject | 10 + boards/ek-lm4f232/boot_usb/ccs/.cproject | 191 ++ boards/ek-lm4f232/boot_usb/ccs/.project | 115 ++ .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.bin | Bin 0 -> 4009 bytes boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.out | Bin 0 -> 95838 bytes boards/ek-lm4f232/boot_usb/ccs/macros.ini_initial | 1 + boards/ek-lm4f232/boot_usb/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.bin | Bin 0 -> 3812 bytes boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.out | Bin 0 -> 90744 bytes boards/ek-lm4f232/boot_usb/gcc/boot_usb.axf | Bin 0 -> 43052 bytes boards/ek-lm4f232/boot_usb/gcc/boot_usb.bin | Bin 0 -> 4162 bytes boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.axf | Bin 0 -> 60640 bytes boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.bin | Bin 0 -> 3920 bytes boards/ek-lm4f232/drivers/buttons.c | 186 ++ boards/ek-lm4f232/drivers/buttons.h | 103 + boards/ek-lm4f232/drivers/cfal96x64x16.c | 816 ++++++++ boards/ek-lm4f232/drivers/cfal96x64x16.h | 37 + boards/ek-lm4f232/drivers/slidemenuwidget.c | 1424 ++++++++++++++ boards/ek-lm4f232/drivers/slidemenuwidget.h | 457 +++++ boards/ek-lm4f232/drivers/stripchartwidget.c | 672 +++++++ boards/ek-lm4f232/drivers/stripchartwidget.h | 392 ++++ boards/ek-lm4f232/drivers/usb_sound.c | 804 ++++++++ boards/ek-lm4f232/drivers/usb_sound.h | 81 + boards/ek-lm4f232/ek-lm4f232.eww | 226 +++ boards/ek-lm4f232/ek-lm4f232.uvmpw | 165 ++ boards/ek-lm4f232/hello/Makefile | 89 + boards/ek-lm4f232/hello/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/hello/ccs/.ccsproject | 10 + boards/ek-lm4f232/hello/ccs/.cproject | 191 ++ boards/ek-lm4f232/hello/ccs/.project | 60 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + boards/ek-lm4f232/hello/ccs/Debug/hello.bin | Bin 0 -> 7424 bytes boards/ek-lm4f232/hello/ccs/Debug/hello.out | Bin 0 -> 147844 bytes boards/ek-lm4f232/hello/ccs/macros.ini_initial | 1 + boards/ek-lm4f232/hello/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/hello/ewarm/Exe/hello.bin | Bin 0 -> 6528 bytes boards/ek-lm4f232/hello/ewarm/Exe/hello.out | Bin 0 -> 108896 bytes boards/ek-lm4f232/hello/gcc/hello.axf | Bin 0 -> 69220 bytes boards/ek-lm4f232/hello/gcc/hello.bin | Bin 0 -> 6530 bytes boards/ek-lm4f232/hello/hello.c | 183 ++ boards/ek-lm4f232/hello/hello.ewd | 614 ++++++ boards/ek-lm4f232/hello/hello.ewp | 795 ++++++++ boards/ek-lm4f232/hello/hello.icf | 78 + boards/ek-lm4f232/hello/hello.ld | 57 + boards/ek-lm4f232/hello/hello.sct | 47 + boards/ek-lm4f232/hello/hello.uvopt | 331 ++++ boards/ek-lm4f232/hello/hello.uvproj | 439 +++++ boards/ek-lm4f232/hello/hello_ccs.cmd | 70 + boards/ek-lm4f232/hello/readme.txt | 27 + boards/ek-lm4f232/hello/rvmdk/hello.axf | Bin 0 -> 125048 bytes boards/ek-lm4f232/hello/rvmdk/hello.bin | Bin 0 -> 6688 bytes boards/ek-lm4f232/hello/startup_ccs.c | 295 +++ boards/ek-lm4f232/hello/startup_ewarm.c | 326 ++++ boards/ek-lm4f232/hello/startup_gcc.c | 342 ++++ boards/ek-lm4f232/hello/startup_rvmdk.S | 351 ++++ boards/ek-lm4f232/hibernate/Makefile | 91 + boards/ek-lm4f232/hibernate/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/hibernate/ccs/.ccsproject | 10 + boards/ek-lm4f232/hibernate/ccs/.cproject | 191 ++ boards/ek-lm4f232/hibernate/ccs/.project | 70 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/hibernate/ccs/Debug/hibernate.bin | Bin 0 -> 9240 bytes .../ek-lm4f232/hibernate/ccs/Debug/hibernate.out | Bin 0 -> 186275 bytes boards/ek-lm4f232/hibernate/ccs/macros.ini_initial | 1 + .../ek-lm4f232/hibernate/ccs/target_config.ccxml | 13 + .../ek-lm4f232/hibernate/ewarm/Exe/hibernate.bin | Bin 0 -> 7856 bytes .../ek-lm4f232/hibernate/ewarm/Exe/hibernate.out | Bin 0 -> 175304 bytes boards/ek-lm4f232/hibernate/gcc/hibernate.axf | Bin 0 -> 70911 bytes boards/ek-lm4f232/hibernate/gcc/hibernate.bin | Bin 0 -> 8448 bytes boards/ek-lm4f232/hibernate/hibernate.c | 545 ++++++ boards/ek-lm4f232/hibernate/hibernate.ewd | 614 ++++++ boards/ek-lm4f232/hibernate/hibernate.ewp | 801 ++++++++ boards/ek-lm4f232/hibernate/hibernate.icf | 78 + boards/ek-lm4f232/hibernate/hibernate.ld | 57 + boards/ek-lm4f232/hibernate/hibernate.sct | 47 + boards/ek-lm4f232/hibernate/hibernate.uvopt | 359 ++++ boards/ek-lm4f232/hibernate/hibernate.uvproj | 449 +++++ boards/ek-lm4f232/hibernate/hibernate_ccs.cmd | 70 + boards/ek-lm4f232/hibernate/readme.txt | 30 + boards/ek-lm4f232/hibernate/rvmdk/hibernate.axf | Bin 0 -> 142640 bytes boards/ek-lm4f232/hibernate/rvmdk/hibernate.bin | Bin 0 -> 8556 bytes boards/ek-lm4f232/hibernate/startup_ccs.c | 302 +++ boards/ek-lm4f232/hibernate/startup_ewarm.c | 333 ++++ boards/ek-lm4f232/hibernate/startup_gcc.c | 349 ++++ boards/ek-lm4f232/hibernate/startup_rvmdk.S | 358 ++++ boards/ek-lm4f232/interrupts/Makefile | 87 + boards/ek-lm4f232/interrupts/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/interrupts/ccs/.ccsproject | 10 + boards/ek-lm4f232/interrupts/ccs/.cproject | 191 ++ boards/ek-lm4f232/interrupts/ccs/.project | 55 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/interrupts/ccs/Debug/interrupts.bin | Bin 0 -> 6904 bytes .../ek-lm4f232/interrupts/ccs/Debug/interrupts.out | Bin 0 -> 127672 bytes .../ek-lm4f232/interrupts/ccs/macros.ini_initial | 1 + .../ek-lm4f232/interrupts/ccs/target_config.ccxml | 13 + .../ek-lm4f232/interrupts/ewarm/Exe/interrupts.bin | Bin 0 -> 6020 bytes .../ek-lm4f232/interrupts/ewarm/Exe/interrupts.out | Bin 0 -> 106732 bytes boards/ek-lm4f232/interrupts/gcc/interrupts.axf | Bin 0 -> 69084 bytes boards/ek-lm4f232/interrupts/gcc/interrupts.bin | Bin 0 -> 6327 bytes boards/ek-lm4f232/interrupts/interrupts.c | 592 ++++++ boards/ek-lm4f232/interrupts/interrupts.ewd | 614 ++++++ boards/ek-lm4f232/interrupts/interrupts.ewp | 792 ++++++++ boards/ek-lm4f232/interrupts/interrupts.icf | 78 + boards/ek-lm4f232/interrupts/interrupts.ld | 57 + boards/ek-lm4f232/interrupts/interrupts.sct | 47 + boards/ek-lm4f232/interrupts/interrupts.uvopt | 317 ++++ boards/ek-lm4f232/interrupts/interrupts.uvproj | 434 +++++ boards/ek-lm4f232/interrupts/interrupts_ccs.cmd | 70 + boards/ek-lm4f232/interrupts/readme.txt | 33 + boards/ek-lm4f232/interrupts/rvmdk/interrupts.axf | Bin 0 -> 118404 bytes boards/ek-lm4f232/interrupts/rvmdk/interrupts.bin | Bin 0 -> 6336 bytes boards/ek-lm4f232/interrupts/startup_ccs.c | 304 +++ boards/ek-lm4f232/interrupts/startup_ewarm.c | 335 ++++ boards/ek-lm4f232/interrupts/startup_gcc.c | 351 ++++ boards/ek-lm4f232/interrupts/startup_rvmdk.S | 360 ++++ boards/ek-lm4f232/mpu_fault/Makefile | 87 + boards/ek-lm4f232/mpu_fault/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/mpu_fault/ccs/.ccsproject | 10 + boards/ek-lm4f232/mpu_fault/ccs/.cproject | 191 ++ boards/ek-lm4f232/mpu_fault/ccs/.project | 55 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.bin | Bin 0 -> 6184 bytes .../ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.out | Bin 0 -> 121928 bytes boards/ek-lm4f232/mpu_fault/ccs/macros.ini_initial | 1 + .../ek-lm4f232/mpu_fault/ccs/target_config.ccxml | 13 + .../ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.bin | Bin 0 -> 5488 bytes .../ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.out | Bin 0 -> 95544 bytes boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.axf | Bin 0 -> 68870 bytes boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.bin | Bin 0 -> 5683 bytes boards/ek-lm4f232/mpu_fault/mpu_fault.c | 413 ++++ boards/ek-lm4f232/mpu_fault/mpu_fault.ewd | 614 ++++++ boards/ek-lm4f232/mpu_fault/mpu_fault.ewp | 792 ++++++++ boards/ek-lm4f232/mpu_fault/mpu_fault.icf | 78 + boards/ek-lm4f232/mpu_fault/mpu_fault.ld | 57 + boards/ek-lm4f232/mpu_fault/mpu_fault.sct | 47 + boards/ek-lm4f232/mpu_fault/mpu_fault.uvopt | 317 ++++ boards/ek-lm4f232/mpu_fault/mpu_fault.uvproj | 434 +++++ boards/ek-lm4f232/mpu_fault/mpu_fault_ccs.cmd | 70 + boards/ek-lm4f232/mpu_fault/readme.txt | 25 + boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.axf | Bin 0 -> 115316 bytes boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.bin | Bin 0 -> 5624 bytes boards/ek-lm4f232/mpu_fault/startup_ccs.c | 302 +++ boards/ek-lm4f232/mpu_fault/startup_ewarm.c | 333 ++++ boards/ek-lm4f232/mpu_fault/startup_gcc.c | 349 ++++ boards/ek-lm4f232/mpu_fault/startup_rvmdk.S | 358 ++++ boards/ek-lm4f232/qs-logger/Makefile | 108 ++ boards/ek-lm4f232/qs-logger/acquire.c | 965 ++++++++++ boards/ek-lm4f232/qs-logger/acquire.h | 57 + boards/ek-lm4f232/qs-logger/ccs/.ccsimportspec | 27 + boards/ek-lm4f232/qs-logger/ccs/.ccsproject | 10 + boards/ek-lm4f232/qs-logger/ccs/.cproject | 195 ++ boards/ek-lm4f232/qs-logger/ccs/.project | 135 ++ .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/qs-logger/ccs/Debug/qs-logger.bin | Bin 0 -> 59472 bytes .../ek-lm4f232/qs-logger/ccs/Debug/qs-logger.out | Bin 0 -> 1147339 bytes boards/ek-lm4f232/qs-logger/ccs/macros.ini_initial | 1 + .../ek-lm4f232/qs-logger/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/qs-logger/clocksetwidget.c | 1031 ++++++++++ boards/ek-lm4f232/qs-logger/clocksetwidget.h | 273 +++ .../ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.bin | Bin 0 -> 55076 bytes .../ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.out | Bin 0 -> 955736 bytes boards/ek-lm4f232/qs-logger/flashstore.c | 625 ++++++ boards/ek-lm4f232/qs-logger/flashstore.h | 60 + boards/ek-lm4f232/qs-logger/gcc/qs-logger.axf | Bin 0 -> 139804 bytes boards/ek-lm4f232/qs-logger/gcc/qs-logger.bin | Bin 0 -> 61648 bytes boards/ek-lm4f232/qs-logger/images.c | 865 +++++++++ boards/ek-lm4f232/qs-logger/images.h | 37 + boards/ek-lm4f232/qs-logger/menus.c | 704 +++++++ boards/ek-lm4f232/qs-logger/menus.h | 83 + boards/ek-lm4f232/qs-logger/qs-logger.c | 1260 +++++++++++++ boards/ek-lm4f232/qs-logger/qs-logger.ewd | 614 ++++++ boards/ek-lm4f232/qs-logger/qs-logger.ewp | 845 +++++++++ boards/ek-lm4f232/qs-logger/qs-logger.h | 180 ++ boards/ek-lm4f232/qs-logger/qs-logger.icf | 78 + boards/ek-lm4f232/qs-logger/qs-logger.ld | 57 + boards/ek-lm4f232/qs-logger/qs-logger.sct | 47 + boards/ek-lm4f232/qs-logger/qs-logger.uvopt | 555 ++++++ boards/ek-lm4f232/qs-logger/qs-logger.uvproj | 519 +++++ boards/ek-lm4f232/qs-logger/qs-logger_ccs.cmd | 70 + boards/ek-lm4f232/qs-logger/readme.txt | 93 + boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.axf | Bin 0 -> 677900 bytes boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.bin | Bin 0 -> 60312 bytes boards/ek-lm4f232/qs-logger/startup_ccs.c | 305 +++ boards/ek-lm4f232/qs-logger/startup_ewarm.c | 336 ++++ boards/ek-lm4f232/qs-logger/startup_gcc.c | 352 ++++ boards/ek-lm4f232/qs-logger/startup_rvmdk.S | 361 ++++ boards/ek-lm4f232/qs-logger/stripchartmanager.c | 445 +++++ boards/ek-lm4f232/qs-logger/stripchartmanager.h | 63 + boards/ek-lm4f232/qs-logger/usb_serial_structs.c | 217 +++ boards/ek-lm4f232/qs-logger/usb_serial_structs.h | 49 + boards/ek-lm4f232/qs-logger/usbserial.c | 459 +++++ boards/ek-lm4f232/qs-logger/usbserial.h | 56 + boards/ek-lm4f232/qs-logger/usbstick.c | 814 ++++++++ boards/ek-lm4f232/qs-logger/usbstick.h | 58 + boards/ek-lm4f232/sd_card/Makefile | 97 + boards/ek-lm4f232/sd_card/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/sd_card/ccs/.ccsproject | 10 + boards/ek-lm4f232/sd_card/ccs/.cproject | 195 ++ boards/ek-lm4f232/sd_card/ccs/.project | 80 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.bin | Bin 0 -> 46768 bytes boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.out | Bin 0 -> 332773 bytes boards/ek-lm4f232/sd_card/ccs/macros.ini_initial | 1 + boards/ek-lm4f232/sd_card/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.bin | Bin 0 -> 45880 bytes boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.out | Bin 0 -> 274756 bytes boards/ek-lm4f232/sd_card/gcc/sd_card.axf | Bin 0 -> 107081 bytes boards/ek-lm4f232/sd_card/gcc/sd_card.bin | Bin 0 -> 47092 bytes boards/ek-lm4f232/sd_card/readme.txt | 34 + boards/ek-lm4f232/sd_card/rvmdk/sd_card.axf | Bin 0 -> 219408 bytes boards/ek-lm4f232/sd_card/rvmdk/sd_card.bin | Bin 0 -> 45360 bytes boards/ek-lm4f232/sd_card/sd_card.c | 915 +++++++++ boards/ek-lm4f232/sd_card/sd_card.ewd | 614 ++++++ boards/ek-lm4f232/sd_card/sd_card.ewp | 810 ++++++++ boards/ek-lm4f232/sd_card/sd_card.icf | 78 + boards/ek-lm4f232/sd_card/sd_card.ld | 57 + boards/ek-lm4f232/sd_card/sd_card.sct | 47 + boards/ek-lm4f232/sd_card/sd_card.uvopt | 387 ++++ boards/ek-lm4f232/sd_card/sd_card.uvproj | 459 +++++ boards/ek-lm4f232/sd_card/sd_card_ccs.cmd | 70 + boards/ek-lm4f232/sd_card/startup_ccs.c | 302 +++ boards/ek-lm4f232/sd_card/startup_ewarm.c | 333 ++++ boards/ek-lm4f232/sd_card/startup_gcc.c | 349 ++++ boards/ek-lm4f232/sd_card/startup_rvmdk.S | 358 ++++ boards/ek-lm4f232/sine_demo/Makefile | 88 + boards/ek-lm4f232/sine_demo/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/sine_demo/ccs/.ccsproject | 10 + boards/ek-lm4f232/sine_demo/ccs/.cproject | 191 ++ boards/ek-lm4f232/sine_demo/ccs/.project | 60 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/sine_demo/ccs/Debug/sine_demo.bin | Bin 0 -> 12872 bytes .../ek-lm4f232/sine_demo/ccs/Debug/sine_demo.out | Bin 0 -> 235469 bytes boards/ek-lm4f232/sine_demo/ccs/macros.ini_initial | 1 + .../ek-lm4f232/sine_demo/ccs/target_config.ccxml | 13 + .../ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.bin | Bin 0 -> 11456 bytes .../ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.out | Bin 0 -> 175656 bytes boards/ek-lm4f232/sine_demo/gcc/sine_demo.axf | Bin 0 -> 79857 bytes boards/ek-lm4f232/sine_demo/gcc/sine_demo.bin | Bin 0 -> 17944 bytes boards/ek-lm4f232/sine_demo/readme.txt | 24 + boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.axf | Bin 0 -> 183384 bytes boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.bin | Bin 0 -> 12096 bytes boards/ek-lm4f232/sine_demo/sine_demo.c | 332 ++++ boards/ek-lm4f232/sine_demo/sine_demo.ewd | 614 ++++++ boards/ek-lm4f232/sine_demo/sine_demo.ewp | 795 ++++++++ boards/ek-lm4f232/sine_demo/sine_demo.icf | 78 + boards/ek-lm4f232/sine_demo/sine_demo.ld | 57 + boards/ek-lm4f232/sine_demo/sine_demo.sct | 47 + boards/ek-lm4f232/sine_demo/sine_demo.uvopt | 331 ++++ boards/ek-lm4f232/sine_demo/sine_demo.uvproj | 439 +++++ boards/ek-lm4f232/sine_demo/sine_demo_ccs.cmd | 70 + boards/ek-lm4f232/sine_demo/startup_ccs.c | 302 +++ boards/ek-lm4f232/sine_demo/startup_ewarm.c | 333 ++++ boards/ek-lm4f232/sine_demo/startup_gcc.c | 349 ++++ boards/ek-lm4f232/sine_demo/startup_rvmdk.S | 358 ++++ boards/ek-lm4f232/softuart_echo/Makefile | 89 + boards/ek-lm4f232/softuart_echo/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/softuart_echo/ccs/.ccsproject | 10 + boards/ek-lm4f232/softuart_echo/ccs/.cproject | 191 ++ boards/ek-lm4f232/softuart_echo/ccs/.project | 60 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../softuart_echo/ccs/Debug/softuart_echo.bin | Bin 0 -> 8152 bytes .../softuart_echo/ccs/Debug/softuart_echo.out | Bin 0 -> 166975 bytes .../softuart_echo/ccs/macros.ini_initial | 1 + .../softuart_echo/ccs/target_config.ccxml | 13 + .../softuart_echo/ewarm/Exe/softuart_echo.bin | Bin 0 -> 7228 bytes .../softuart_echo/ewarm/Exe/softuart_echo.out | Bin 0 -> 136204 bytes .../ek-lm4f232/softuart_echo/gcc/softuart_echo.axf | Bin 0 -> 70670 bytes .../ek-lm4f232/softuart_echo/gcc/softuart_echo.bin | Bin 0 -> 7815 bytes boards/ek-lm4f232/softuart_echo/readme.txt | 27 + .../softuart_echo/rvmdk/softuart_echo.axf | Bin 0 -> 141052 bytes .../softuart_echo/rvmdk/softuart_echo.bin | Bin 0 -> 7524 bytes boards/ek-lm4f232/softuart_echo/softuart_echo.c | 368 ++++ boards/ek-lm4f232/softuart_echo/softuart_echo.ewd | 614 ++++++ boards/ek-lm4f232/softuart_echo/softuart_echo.ewp | 795 ++++++++ boards/ek-lm4f232/softuart_echo/softuart_echo.icf | 78 + boards/ek-lm4f232/softuart_echo/softuart_echo.ld | 57 + boards/ek-lm4f232/softuart_echo/softuart_echo.sct | 47 + .../ek-lm4f232/softuart_echo/softuart_echo.uvopt | 331 ++++ .../ek-lm4f232/softuart_echo/softuart_echo.uvproj | 439 +++++ .../ek-lm4f232/softuart_echo/softuart_echo_ccs.cmd | 70 + boards/ek-lm4f232/softuart_echo/startup_ccs.c | 304 +++ boards/ek-lm4f232/softuart_echo/startup_ewarm.c | 335 ++++ boards/ek-lm4f232/softuart_echo/startup_gcc.c | 351 ++++ boards/ek-lm4f232/softuart_echo/startup_rvmdk.S | 360 ++++ boards/ek-lm4f232/timers/Makefile | 87 + boards/ek-lm4f232/timers/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/timers/ccs/.ccsproject | 10 + boards/ek-lm4f232/timers/ccs/.cproject | 191 ++ boards/ek-lm4f232/timers/ccs/.project | 55 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + boards/ek-lm4f232/timers/ccs/Debug/timers.bin | Bin 0 -> 5840 bytes boards/ek-lm4f232/timers/ccs/Debug/timers.out | Bin 0 -> 121243 bytes boards/ek-lm4f232/timers/ccs/macros.ini_initial | 1 + boards/ek-lm4f232/timers/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/timers/ewarm/Exe/timers.bin | Bin 0 -> 5160 bytes boards/ek-lm4f232/timers/ewarm/Exe/timers.out | Bin 0 -> 90240 bytes boards/ek-lm4f232/timers/gcc/timers.axf | Bin 0 -> 68756 bytes boards/ek-lm4f232/timers/gcc/timers.bin | Bin 0 -> 5259 bytes boards/ek-lm4f232/timers/readme.txt | 26 + boards/ek-lm4f232/timers/rvmdk/timers.axf | Bin 0 -> 115056 bytes boards/ek-lm4f232/timers/rvmdk/timers.bin | Bin 0 -> 5376 bytes boards/ek-lm4f232/timers/startup_ccs.c | 303 +++ boards/ek-lm4f232/timers/startup_ewarm.c | 334 ++++ boards/ek-lm4f232/timers/startup_gcc.c | 350 ++++ boards/ek-lm4f232/timers/startup_rvmdk.S | 359 ++++ boards/ek-lm4f232/timers/timers.c | 234 +++ boards/ek-lm4f232/timers/timers.ewd | 614 ++++++ boards/ek-lm4f232/timers/timers.ewp | 792 ++++++++ boards/ek-lm4f232/timers/timers.icf | 78 + boards/ek-lm4f232/timers/timers.ld | 57 + boards/ek-lm4f232/timers/timers.sct | 47 + boards/ek-lm4f232/timers/timers.uvopt | 317 ++++ boards/ek-lm4f232/timers/timers.uvproj | 434 +++++ boards/ek-lm4f232/timers/timers_ccs.cmd | 70 + boards/ek-lm4f232/uart_echo/Makefile | 87 + boards/ek-lm4f232/uart_echo/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/uart_echo/ccs/.ccsproject | 10 + boards/ek-lm4f232/uart_echo/ccs/.cproject | 191 ++ boards/ek-lm4f232/uart_echo/ccs/.project | 55 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/uart_echo/ccs/Debug/uart_echo.bin | Bin 0 -> 5888 bytes .../ek-lm4f232/uart_echo/ccs/Debug/uart_echo.out | Bin 0 -> 121186 bytes boards/ek-lm4f232/uart_echo/ccs/macros.ini_initial | 1 + .../ek-lm4f232/uart_echo/ccs/target_config.ccxml | 13 + .../ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.bin | Bin 0 -> 5084 bytes .../ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.out | Bin 0 -> 92212 bytes boards/ek-lm4f232/uart_echo/gcc/uart_echo.axf | Bin 0 -> 68662 bytes boards/ek-lm4f232/uart_echo/gcc/uart_echo.bin | Bin 0 -> 5279 bytes boards/ek-lm4f232/uart_echo/readme.txt | 26 + boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.axf | Bin 0 -> 114952 bytes boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.bin | Bin 0 -> 5400 bytes boards/ek-lm4f232/uart_echo/startup_ccs.c | 302 +++ boards/ek-lm4f232/uart_echo/startup_ewarm.c | 333 ++++ boards/ek-lm4f232/uart_echo/startup_gcc.c | 349 ++++ boards/ek-lm4f232/uart_echo/startup_rvmdk.S | 358 ++++ boards/ek-lm4f232/uart_echo/uart_echo.c | 226 +++ boards/ek-lm4f232/uart_echo/uart_echo.ewd | 614 ++++++ boards/ek-lm4f232/uart_echo/uart_echo.ewp | 792 ++++++++ boards/ek-lm4f232/uart_echo/uart_echo.icf | 78 + boards/ek-lm4f232/uart_echo/uart_echo.ld | 57 + boards/ek-lm4f232/uart_echo/uart_echo.sct | 47 + boards/ek-lm4f232/uart_echo/uart_echo.uvopt | 317 ++++ boards/ek-lm4f232/uart_echo/uart_echo.uvproj | 434 +++++ boards/ek-lm4f232/uart_echo/uart_echo_ccs.cmd | 70 + boards/ek-lm4f232/udma_demo/Makefile | 90 + boards/ek-lm4f232/udma_demo/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/udma_demo/ccs/.ccsproject | 10 + boards/ek-lm4f232/udma_demo/ccs/.cproject | 191 ++ boards/ek-lm4f232/udma_demo/ccs/.project | 65 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ek-lm4f232/udma_demo/ccs/Debug/udma_demo.bin | Bin 0 -> 7824 bytes .../ek-lm4f232/udma_demo/ccs/Debug/udma_demo.out | Bin 0 -> 154518 bytes boards/ek-lm4f232/udma_demo/ccs/macros.ini_initial | 1 + .../ek-lm4f232/udma_demo/ccs/target_config.ccxml | 13 + .../ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.bin | Bin 0 -> 6808 bytes .../ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.out | Bin 0 -> 121016 bytes boards/ek-lm4f232/udma_demo/gcc/udma_demo.axf | Bin 0 -> 70476 bytes boards/ek-lm4f232/udma_demo/gcc/udma_demo.bin | Bin 0 -> 7199 bytes boards/ek-lm4f232/udma_demo/readme.txt | 25 + boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.axf | Bin 0 -> 128824 bytes boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.bin | Bin 0 -> 7252 bytes boards/ek-lm4f232/udma_demo/startup_ccs.c | 305 +++ boards/ek-lm4f232/udma_demo/startup_ewarm.c | 336 ++++ boards/ek-lm4f232/udma_demo/startup_gcc.c | 352 ++++ boards/ek-lm4f232/udma_demo/startup_rvmdk.S | 361 ++++ boards/ek-lm4f232/udma_demo/udma_demo.c | 916 +++++++++ boards/ek-lm4f232/udma_demo/udma_demo.ewd | 614 ++++++ boards/ek-lm4f232/udma_demo/udma_demo.ewp | 798 ++++++++ boards/ek-lm4f232/udma_demo/udma_demo.icf | 78 + boards/ek-lm4f232/udma_demo/udma_demo.ld | 57 + boards/ek-lm4f232/udma_demo/udma_demo.sct | 47 + boards/ek-lm4f232/udma_demo/udma_demo.uvopt | 345 ++++ boards/ek-lm4f232/udma_demo/udma_demo.uvproj | 444 +++++ boards/ek-lm4f232/udma_demo/udma_demo_ccs.cmd | 70 + boards/ek-lm4f232/usb_dev_bulk/Makefile | 92 + boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsimportspec | 10 + boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_dev_bulk/ccs/.cproject | 195 ++ boards/ek-lm4f232/usb_dev_bulk/ccs/.project | 70 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_dev_bulk/ccs/Debug/usb_dev_bulk.bin | Bin 0 -> 18392 bytes .../usb_dev_bulk/ccs/Debug/usb_dev_bulk.out | Bin 0 -> 518500 bytes .../ek-lm4f232/usb_dev_bulk/ccs/macros.ini_initial | 1 + .../usb_dev_bulk/ccs/target_config.ccxml | 13 + .../usb_dev_bulk/ewarm/Exe/usb_dev_bulk.bin | Bin 0 -> 16960 bytes .../usb_dev_bulk/ewarm/Exe/usb_dev_bulk.out | Bin 0 -> 379132 bytes .../ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.axf | Bin 0 -> 81939 bytes .../ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.bin | Bin 0 -> 17781 bytes boards/ek-lm4f232/usb_dev_bulk/readme.txt | 43 + .../ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.axf | Bin 0 -> 332804 bytes .../ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.bin | Bin 0 -> 18832 bytes boards/ek-lm4f232/usb_dev_bulk/startup_ccs.c | 304 +++ boards/ek-lm4f232/usb_dev_bulk/startup_ewarm.c | 335 ++++ boards/ek-lm4f232/usb_dev_bulk/startup_gcc.c | 351 ++++ boards/ek-lm4f232/usb_dev_bulk/startup_rvmdk.S | 360 ++++ boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.c | 200 ++ boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.h | 48 + boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.c | 709 +++++++ boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewd | 614 ++++++ boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewp | 805 ++++++++ boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.icf | 78 + boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ld | 57 + boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.sct | 47 + boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvopt | 373 ++++ boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvproj | 454 +++++ .../ek-lm4f232/usb_dev_bulk/usb_dev_bulk_ccs.cmd | 70 + boards/ek-lm4f232/usb_dev_keyboard/Makefile | 92 + .../ek-lm4f232/usb_dev_keyboard/ccs/.ccsimportspec | 10 + boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_dev_keyboard/ccs/.cproject | 195 ++ boards/ek-lm4f232/usb_dev_keyboard/ccs/.project | 70 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ccs/Debug/usb_dev_keyboard.bin | Bin 0 -> 19448 bytes .../ccs/Debug/usb_dev_keyboard.out | Bin 0 -> 523487 bytes .../usb_dev_keyboard/ccs/macros.ini_initial | 1 + .../usb_dev_keyboard/ccs/target_config.ccxml | 13 + .../ewarm/Exe/usb_dev_keyboard.bin | Bin 0 -> 17868 bytes .../ewarm/Exe/usb_dev_keyboard.out | Bin 0 -> 389760 bytes .../usb_dev_keyboard/gcc/usb_dev_keyboard.axf | Bin 0 -> 82263 bytes .../usb_dev_keyboard/gcc/usb_dev_keyboard.bin | Bin 0 -> 18994 bytes boards/ek-lm4f232/usb_dev_keyboard/readme.txt | 37 + .../usb_dev_keyboard/rvmdk/usb_dev_keyboard.axf | Bin 0 -> 346412 bytes .../usb_dev_keyboard/rvmdk/usb_dev_keyboard.bin | Bin 0 -> 19880 bytes boards/ek-lm4f232/usb_dev_keyboard/startup_ccs.c | 304 +++ boards/ek-lm4f232/usb_dev_keyboard/startup_ewarm.c | 335 ++++ boards/ek-lm4f232/usb_dev_keyboard/startup_gcc.c | 351 ++++ boards/ek-lm4f232/usb_dev_keyboard/startup_rvmdk.S | 360 ++++ .../ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.c | 731 +++++++ .../usb_dev_keyboard/usb_dev_keyboard.ewd | 614 ++++++ .../usb_dev_keyboard/usb_dev_keyboard.ewp | 805 ++++++++ .../usb_dev_keyboard/usb_dev_keyboard.icf | 78 + .../usb_dev_keyboard/usb_dev_keyboard.ld | 57 + .../usb_dev_keyboard/usb_dev_keyboard.sct | 47 + .../usb_dev_keyboard/usb_dev_keyboard.uvopt | 373 ++++ .../usb_dev_keyboard/usb_dev_keyboard.uvproj | 454 +++++ .../usb_dev_keyboard/usb_dev_keyboard_ccs.cmd | 70 + .../ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.c | 149 ++ .../ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.h | 35 + boards/ek-lm4f232/usb_dev_msc/Makefile | 96 + boards/ek-lm4f232/usb_dev_msc/ccs/.ccsimportspec | 12 + boards/ek-lm4f232/usb_dev_msc/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_dev_msc/ccs/.cproject | 195 ++ boards/ek-lm4f232/usb_dev_msc/ccs/.project | 75 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_dev_msc/ccs/Debug/usb_dev_msc.bin | Bin 0 -> 20424 bytes .../usb_dev_msc/ccs/Debug/usb_dev_msc.out | Bin 0 -> 502557 bytes .../ek-lm4f232/usb_dev_msc/ccs/macros.ini_initial | 1 + .../ek-lm4f232/usb_dev_msc/ccs/target_config.ccxml | 13 + .../usb_dev_msc/ewarm/Exe/usb_dev_msc.bin | Bin 0 -> 18840 bytes .../usb_dev_msc/ewarm/Exe/usb_dev_msc.out | Bin 0 -> 387896 bytes boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.axf | Bin 0 -> 85209 bytes boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.bin | Bin 0 -> 23816 bytes boards/ek-lm4f232/usb_dev_msc/readme.txt | 27 + .../ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.axf | Bin 0 -> 335020 bytes .../ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.bin | Bin 0 -> 20484 bytes boards/ek-lm4f232/usb_dev_msc/startup_ccs.c | 303 +++ boards/ek-lm4f232/usb_dev_msc/startup_ewarm.c | 334 ++++ boards/ek-lm4f232/usb_dev_msc/startup_gcc.c | 350 ++++ boards/ek-lm4f232/usb_dev_msc/startup_rvmdk.S | 359 ++++ boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.c | 617 ++++++ boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewd | 614 ++++++ boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewp | 809 ++++++++ boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.icf | 78 + boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ld | 57 + boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.sct | 47 + boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvopt | 387 ++++ boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvproj | 459 +++++ boards/ek-lm4f232/usb_dev_msc/usb_dev_msc_ccs.cmd | 70 + boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.c | 191 ++ boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.h | 43 + boards/ek-lm4f232/usb_dev_msc/usbdsdcard.c | 257 +++ boards/ek-lm4f232/usb_dev_msc/usbdsdcard.h | 43 + boards/ek-lm4f232/usb_dev_serial/Makefile | 92 + .../ek-lm4f232/usb_dev_serial/ccs/.ccsimportspec | 10 + boards/ek-lm4f232/usb_dev_serial/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_dev_serial/ccs/.cproject | 195 ++ boards/ek-lm4f232/usb_dev_serial/ccs/.project | 70 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_dev_serial/ccs/Debug/usb_dev_serial.bin | Bin 0 -> 20520 bytes .../usb_dev_serial/ccs/Debug/usb_dev_serial.out | Bin 0 -> 549916 bytes .../usb_dev_serial/ccs/macros.ini_initial | 1 + .../usb_dev_serial/ccs/target_config.ccxml | 13 + .../usb_dev_serial/ewarm/Exe/usb_dev_serial.bin | Bin 0 -> 19052 bytes .../usb_dev_serial/ewarm/Exe/usb_dev_serial.out | Bin 0 -> 411448 bytes .../usb_dev_serial/gcc/usb_dev_serial.axf | Bin 0 -> 83087 bytes .../usb_dev_serial/gcc/usb_dev_serial.bin | Bin 0 -> 19993 bytes boards/ek-lm4f232/usb_dev_serial/readme.txt | 32 + .../usb_dev_serial/rvmdk/usb_dev_serial.axf | Bin 0 -> 382612 bytes .../usb_dev_serial/rvmdk/usb_dev_serial.bin | Bin 0 -> 21328 bytes boards/ek-lm4f232/usb_dev_serial/startup_ccs.c | 304 +++ boards/ek-lm4f232/usb_dev_serial/startup_ewarm.c | 335 ++++ boards/ek-lm4f232/usb_dev_serial/startup_gcc.c | 351 ++++ boards/ek-lm4f232/usb_dev_serial/startup_rvmdk.S | 360 ++++ boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.c | 1441 ++++++++++++++ .../ek-lm4f232/usb_dev_serial/usb_dev_serial.ewd | 614 ++++++ .../ek-lm4f232/usb_dev_serial/usb_dev_serial.ewp | 805 ++++++++ .../ek-lm4f232/usb_dev_serial/usb_dev_serial.icf | 78 + boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ld | 57 + .../ek-lm4f232/usb_dev_serial/usb_dev_serial.sct | 47 + .../ek-lm4f232/usb_dev_serial/usb_dev_serial.uvopt | 373 ++++ .../usb_dev_serial/usb_dev_serial.uvproj | 454 +++++ .../usb_dev_serial/usb_dev_serial_ccs.cmd | 70 + .../ek-lm4f232/usb_dev_serial/usb_serial_structs.c | 215 +++ .../ek-lm4f232/usb_dev_serial/usb_serial_structs.h | 49 + boards/ek-lm4f232/usb_host_audio/Makefile | 100 + .../ek-lm4f232/usb_host_audio/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/usb_host_audio/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_host_audio/ccs/.cproject | 197 ++ boards/ek-lm4f232/usb_host_audio/ccs/.project | 90 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_host_audio/ccs/Debug/usb_host_audio.bin | Bin 0 -> 41096 bytes .../usb_host_audio/ccs/Debug/usb_host_audio.out | Bin 0 -> 893628 bytes .../usb_host_audio/ccs/macros.ini_initial | 1 + .../usb_host_audio/ccs/target_config.ccxml | 13 + .../usb_host_audio/ewarm/Exe/usb_host_audio.bin | Bin 0 -> 38324 bytes .../usb_host_audio/ewarm/Exe/usb_host_audio.out | Bin 0 -> 728840 bytes .../usb_host_audio/gcc/usb_host_audio.axf | Bin 0 -> 126762 bytes .../usb_host_audio/gcc/usb_host_audio.bin | Bin 0 -> 41968 bytes boards/ek-lm4f232/usb_host_audio/readme.txt | 32 + .../usb_host_audio/rvmdk/usb_host_audio.axf | Bin 0 -> 542484 bytes .../usb_host_audio/rvmdk/usb_host_audio.bin | Bin 0 -> 42196 bytes boards/ek-lm4f232/usb_host_audio/startup_ccs.c | 303 +++ boards/ek-lm4f232/usb_host_audio/startup_ewarm.c | 334 ++++ boards/ek-lm4f232/usb_host_audio/startup_gcc.c | 350 ++++ boards/ek-lm4f232/usb_host_audio/startup_rvmdk.S | 359 ++++ boards/ek-lm4f232/usb_host_audio/usb_host_audio.c | 1987 ++++++++++++++++++++ .../ek-lm4f232/usb_host_audio/usb_host_audio.ewd | 614 ++++++ .../ek-lm4f232/usb_host_audio/usb_host_audio.ewp | 820 ++++++++ .../ek-lm4f232/usb_host_audio/usb_host_audio.icf | 78 + boards/ek-lm4f232/usb_host_audio/usb_host_audio.ld | 57 + .../ek-lm4f232/usb_host_audio/usb_host_audio.sct | 47 + .../ek-lm4f232/usb_host_audio/usb_host_audio.uvopt | 429 +++++ .../usb_host_audio/usb_host_audio.uvproj | 474 +++++ .../usb_host_audio/usb_host_audio_ccs.cmd | 70 + boards/ek-lm4f232/usb_host_keyboard/Makefile | 90 + .../usb_host_keyboard/ccs/.ccsimportspec | 8 + .../ek-lm4f232/usb_host_keyboard/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_host_keyboard/ccs/.cproject | 193 ++ boards/ek-lm4f232/usb_host_keyboard/ccs/.project | 60 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ccs/Debug/usb_host_keyboard.bin | Bin 0 -> 26048 bytes .../ccs/Debug/usb_host_keyboard.out | Bin 0 -> 625082 bytes .../usb_host_keyboard/ccs/macros.ini_initial | 1 + .../usb_host_keyboard/ccs/target_config.ccxml | 13 + .../ewarm/Exe/usb_host_keyboard.bin | Bin 0 -> 23932 bytes .../ewarm/Exe/usb_host_keyboard.out | Bin 0 -> 478228 bytes .../usb_host_keyboard/gcc/usb_host_keyboard.axf | Bin 0 -> 84749 bytes .../usb_host_keyboard/gcc/usb_host_keyboard.bin | Bin 0 -> 25598 bytes boards/ek-lm4f232/usb_host_keyboard/readme.txt | 30 + .../usb_host_keyboard/rvmdk/usb_host_keyboard.axf | Bin 0 -> 386088 bytes .../usb_host_keyboard/rvmdk/usb_host_keyboard.bin | Bin 0 -> 27236 bytes boards/ek-lm4f232/usb_host_keyboard/startup_ccs.c | 303 +++ .../ek-lm4f232/usb_host_keyboard/startup_ewarm.c | 334 ++++ boards/ek-lm4f232/usb_host_keyboard/startup_gcc.c | 350 ++++ .../ek-lm4f232/usb_host_keyboard/startup_rvmdk.S | 359 ++++ .../usb_host_keyboard/usb_host_keyboard.c | 1143 +++++++++++ .../usb_host_keyboard/usb_host_keyboard.ewd | 614 ++++++ .../usb_host_keyboard/usb_host_keyboard.ewp | 798 ++++++++ .../usb_host_keyboard/usb_host_keyboard.icf | 78 + .../usb_host_keyboard/usb_host_keyboard.ld | 57 + .../usb_host_keyboard/usb_host_keyboard.sct | 47 + .../usb_host_keyboard/usb_host_keyboard.uvopt | 345 ++++ .../usb_host_keyboard/usb_host_keyboard.uvproj | 444 +++++ .../usb_host_keyboard/usb_host_keyboard_ccs.cmd | 70 + boards/ek-lm4f232/usb_host_mouse/Makefile | 91 + .../ek-lm4f232/usb_host_mouse/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/usb_host_mouse/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_host_mouse/ccs/.cproject | 193 ++ boards/ek-lm4f232/usb_host_mouse/ccs/.project | 65 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_host_mouse/ccs/Debug/usb_host_mouse.bin | Bin 0 -> 24864 bytes .../usb_host_mouse/ccs/Debug/usb_host_mouse.out | Bin 0 -> 598089 bytes .../usb_host_mouse/ccs/macros.ini_initial | 1 + .../usb_host_mouse/ccs/target_config.ccxml | 13 + .../usb_host_mouse/ewarm/Exe/usb_host_mouse.bin | Bin 0 -> 22624 bytes .../usb_host_mouse/ewarm/Exe/usb_host_mouse.out | Bin 0 -> 484016 bytes .../usb_host_mouse/gcc/usb_host_mouse.axf | Bin 0 -> 83804 bytes .../usb_host_mouse/gcc/usb_host_mouse.bin | Bin 0 -> 24578 bytes boards/ek-lm4f232/usb_host_mouse/readme.txt | 25 + .../usb_host_mouse/rvmdk/usb_host_mouse.axf | Bin 0 -> 359508 bytes .../usb_host_mouse/rvmdk/usb_host_mouse.bin | Bin 0 -> 26392 bytes boards/ek-lm4f232/usb_host_mouse/startup_ccs.c | 303 +++ boards/ek-lm4f232/usb_host_mouse/startup_ewarm.c | 334 ++++ boards/ek-lm4f232/usb_host_mouse/startup_gcc.c | 350 ++++ boards/ek-lm4f232/usb_host_mouse/startup_rvmdk.S | 359 ++++ boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.c | 803 ++++++++ .../ek-lm4f232/usb_host_mouse/usb_host_mouse.ewd | 614 ++++++ .../ek-lm4f232/usb_host_mouse/usb_host_mouse.ewp | 801 ++++++++ .../ek-lm4f232/usb_host_mouse/usb_host_mouse.icf | 78 + boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ld | 57 + .../ek-lm4f232/usb_host_mouse/usb_host_mouse.sct | 47 + .../ek-lm4f232/usb_host_mouse/usb_host_mouse.uvopt | 359 ++++ .../usb_host_mouse/usb_host_mouse.uvproj | 449 +++++ .../usb_host_mouse/usb_host_mouse_ccs.cmd | 70 + boards/ek-lm4f232/usb_host_msc/Makefile | 98 + boards/ek-lm4f232/usb_host_msc/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/usb_host_msc/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_host_msc/ccs/.cproject | 195 ++ boards/ek-lm4f232/usb_host_msc/ccs/.project | 85 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_host_msc/ccs/Debug/usb_host_msc.bin | Bin 0 -> 34616 bytes .../usb_host_msc/ccs/Debug/usb_host_msc.out | Bin 0 -> 786715 bytes .../ek-lm4f232/usb_host_msc/ccs/macros.ini_initial | 1 + .../usb_host_msc/ccs/target_config.ccxml | 13 + .../usb_host_msc/ewarm/Exe/usb_host_msc.bin | Bin 0 -> 32272 bytes .../usb_host_msc/ewarm/Exe/usb_host_msc.out | Bin 0 -> 625004 bytes .../ek-lm4f232/usb_host_msc/gcc/usb_host_msc.axf | Bin 0 -> 122016 bytes .../ek-lm4f232/usb_host_msc/gcc/usb_host_msc.bin | Bin 0 -> 35356 bytes boards/ek-lm4f232/usb_host_msc/readme.txt | 29 + .../ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.axf | Bin 0 -> 482912 bytes .../ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.bin | Bin 0 -> 36048 bytes boards/ek-lm4f232/usb_host_msc/startup_ccs.c | 303 +++ boards/ek-lm4f232/usb_host_msc/startup_ewarm.c | 334 ++++ boards/ek-lm4f232/usb_host_msc/startup_gcc.c | 350 ++++ boards/ek-lm4f232/usb_host_msc/startup_rvmdk.S | 359 ++++ boards/ek-lm4f232/usb_host_msc/usb_host_msc.c | 1549 +++++++++++++++ boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewd | 614 ++++++ boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewp | 815 ++++++++ boards/ek-lm4f232/usb_host_msc/usb_host_msc.icf | 78 + boards/ek-lm4f232/usb_host_msc/usb_host_msc.ld | 57 + boards/ek-lm4f232/usb_host_msc/usb_host_msc.sct | 47 + boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvopt | 415 ++++ boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvproj | 469 +++++ .../ek-lm4f232/usb_host_msc/usb_host_msc_ccs.cmd | 70 + boards/ek-lm4f232/usb_stick_demo/Makefile | 87 + .../ek-lm4f232/usb_stick_demo/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/usb_stick_demo/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_stick_demo/ccs/.cproject | 191 ++ boards/ek-lm4f232/usb_stick_demo/ccs/.project | 55 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../usb_stick_demo/ccs/Debug/usb_stick_demo.bin | Bin 0 -> 6416 bytes .../usb_stick_demo/ccs/Debug/usb_stick_demo.out | Bin 0 -> 125517 bytes .../usb_stick_demo/ccs/macros.ini_initial | 1 + .../usb_stick_demo/ccs/target_config.ccxml | 13 + .../usb_stick_demo/ewarm/Exe/usb_stick_demo.bin | Bin 0 -> 5512 bytes .../usb_stick_demo/ewarm/Exe/usb_stick_demo.out | Bin 0 -> 105600 bytes .../usb_stick_demo/gcc/usb_stick_demo.axf | Bin 0 -> 36034 bytes .../usb_stick_demo/gcc/usb_stick_demo.bin | Bin 0 -> 5763 bytes boards/ek-lm4f232/usb_stick_demo/readme.txt | 39 + .../usb_stick_demo/rvmdk/usb_stick_demo.axf | Bin 0 -> 119224 bytes .../usb_stick_demo/rvmdk/usb_stick_demo.bin | Bin 0 -> 5888 bytes boards/ek-lm4f232/usb_stick_demo/startup_ccs.c | 295 +++ boards/ek-lm4f232/usb_stick_demo/startup_ewarm.c | 326 ++++ boards/ek-lm4f232/usb_stick_demo/startup_gcc.c | 342 ++++ boards/ek-lm4f232/usb_stick_demo/startup_rvmdk.S | 351 ++++ boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.c | 274 +++ .../ek-lm4f232/usb_stick_demo/usb_stick_demo.ewd | 614 ++++++ .../ek-lm4f232/usb_stick_demo/usb_stick_demo.ewp | 792 ++++++++ .../ek-lm4f232/usb_stick_demo/usb_stick_demo.icf | 78 + boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ld | 57 + .../ek-lm4f232/usb_stick_demo/usb_stick_demo.sct | 47 + .../ek-lm4f232/usb_stick_demo/usb_stick_demo.uvopt | 317 ++++ .../usb_stick_demo/usb_stick_demo.uvproj | 434 +++++ .../usb_stick_demo/usb_stick_demo_ccs.cmd | 70 + boards/ek-lm4f232/usb_stick_update/Makefile | 86 + .../ek-lm4f232/usb_stick_update/ccs/.ccsimportspec | 10 + boards/ek-lm4f232/usb_stick_update/ccs/.ccsproject | 10 + boards/ek-lm4f232/usb_stick_update/ccs/.cproject | 189 ++ boards/ek-lm4f232/usb_stick_update/ccs/.project | 55 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + .../ccs/Debug/usb_stick_update.bin | Bin 0 -> 16112 bytes .../ccs/Debug/usb_stick_update.out | Bin 0 -> 411199 bytes .../usb_stick_update/ccs/macros.ini_initial | 1 + .../usb_stick_update/ccs/target_config.ccxml | 13 + .../ewarm/Exe/usb_stick_update.bin | Bin 0 -> 14728 bytes .../ewarm/Exe/usb_stick_update.out | Bin 0 -> 314912 bytes .../usb_stick_update/gcc/usb_stick_update.axf | Bin 0 -> 79206 bytes .../usb_stick_update/gcc/usb_stick_update.bin | Bin 0 -> 16078 bytes boards/ek-lm4f232/usb_stick_update/readme.txt | 49 + .../usb_stick_update/rvmdk/usb_stick_update.axf | Bin 0 -> 225604 bytes .../usb_stick_update/rvmdk/usb_stick_update.bin | Bin 0 -> 17400 bytes boards/ek-lm4f232/usb_stick_update/simple_fs.c | 865 +++++++++ boards/ek-lm4f232/usb_stick_update/simple_fs.h | 105 ++ boards/ek-lm4f232/usb_stick_update/startup_ccs.c | 303 +++ boards/ek-lm4f232/usb_stick_update/startup_ewarm.c | 334 ++++ boards/ek-lm4f232/usb_stick_update/startup_gcc.c | 350 ++++ boards/ek-lm4f232/usb_stick_update/startup_rvmdk.S | 359 ++++ .../ek-lm4f232/usb_stick_update/usb_stick_update.c | 929 +++++++++ .../usb_stick_update/usb_stick_update.ewd | 614 ++++++ .../usb_stick_update/usb_stick_update.ewp | 790 ++++++++ .../usb_stick_update/usb_stick_update.icf | 78 + .../usb_stick_update/usb_stick_update.ld | 57 + .../usb_stick_update/usb_stick_update.sct | 47 + .../usb_stick_update/usb_stick_update.uvopt | 317 ++++ .../usb_stick_update/usb_stick_update.uvproj | 434 +++++ .../usb_stick_update/usb_stick_update_ccs.cmd | 70 + boards/ek-lm4f232/watchdog/Makefile | 88 + boards/ek-lm4f232/watchdog/ccs/.ccsimportspec | 8 + boards/ek-lm4f232/watchdog/ccs/.ccsproject | 10 + boards/ek-lm4f232/watchdog/ccs/.cproject | 191 ++ boards/ek-lm4f232/watchdog/ccs/.project | 60 + .../ccs/.settings/org.eclipse.cdt.codan.core.prefs | 3 + boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.bin | Bin 0 -> 6832 bytes boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.out | Bin 0 -> 137496 bytes boards/ek-lm4f232/watchdog/ccs/macros.ini_initial | 1 + boards/ek-lm4f232/watchdog/ccs/target_config.ccxml | 13 + boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.bin | Bin 0 -> 5968 bytes boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.out | Bin 0 -> 116396 bytes boards/ek-lm4f232/watchdog/gcc/watchdog.axf | Bin 0 -> 69292 bytes boards/ek-lm4f232/watchdog/gcc/watchdog.bin | Bin 0 -> 6217 bytes boards/ek-lm4f232/watchdog/readme.txt | 28 + boards/ek-lm4f232/watchdog/rvmdk/watchdog.axf | Bin 0 -> 123256 bytes boards/ek-lm4f232/watchdog/rvmdk/watchdog.bin | Bin 0 -> 6276 bytes boards/ek-lm4f232/watchdog/startup_ccs.c | 302 +++ boards/ek-lm4f232/watchdog/startup_ewarm.c | 333 ++++ boards/ek-lm4f232/watchdog/startup_gcc.c | 349 ++++ boards/ek-lm4f232/watchdog/startup_rvmdk.S | 358 ++++ boards/ek-lm4f232/watchdog/watchdog.c | 268 +++ boards/ek-lm4f232/watchdog/watchdog.ewd | 614 ++++++ boards/ek-lm4f232/watchdog/watchdog.ewp | 795 ++++++++ boards/ek-lm4f232/watchdog/watchdog.icf | 78 + boards/ek-lm4f232/watchdog/watchdog.ld | 57 + boards/ek-lm4f232/watchdog/watchdog.sct | 47 + boards/ek-lm4f232/watchdog/watchdog.uvopt | 331 ++++ boards/ek-lm4f232/watchdog/watchdog.uvproj | 439 +++++ boards/ek-lm4f232/watchdog/watchdog_ccs.cmd | 70 + 866 files changed, 150269 insertions(+) create mode 100644 boards/ek-lm4f232/Makefile create mode 100644 boards/ek-lm4f232/bitband/Makefile create mode 100644 boards/ek-lm4f232/bitband/bitband.c create mode 100644 boards/ek-lm4f232/bitband/bitband.ewd create mode 100644 boards/ek-lm4f232/bitband/bitband.ewp create mode 100644 boards/ek-lm4f232/bitband/bitband.icf create mode 100644 boards/ek-lm4f232/bitband/bitband.ld create mode 100644 boards/ek-lm4f232/bitband/bitband.sct create mode 100644 boards/ek-lm4f232/bitband/bitband.uvopt create mode 100644 boards/ek-lm4f232/bitband/bitband.uvproj create mode 100644 boards/ek-lm4f232/bitband/bitband_ccs.cmd create mode 100644 boards/ek-lm4f232/bitband/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/bitband/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/bitband/ccs/.cproject create mode 100644 boards/ek-lm4f232/bitband/ccs/.project create mode 100644 boards/ek-lm4f232/bitband/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/bitband/ccs/Debug/bitband.bin create mode 100644 boards/ek-lm4f232/bitband/ccs/Debug/bitband.out create mode 100644 boards/ek-lm4f232/bitband/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/bitband/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/bitband/ewarm/Exe/bitband.bin create mode 100644 boards/ek-lm4f232/bitband/ewarm/Exe/bitband.out create mode 100644 boards/ek-lm4f232/bitband/gcc/bitband.axf create mode 100644 boards/ek-lm4f232/bitband/gcc/bitband.bin create mode 100644 boards/ek-lm4f232/bitband/readme.txt create mode 100644 boards/ek-lm4f232/bitband/rvmdk/bitband.axf create mode 100644 boards/ek-lm4f232/bitband/rvmdk/bitband.bin create mode 100644 boards/ek-lm4f232/bitband/startup_ccs.c create mode 100644 boards/ek-lm4f232/bitband/startup_ewarm.c create mode 100644 boards/ek-lm4f232/bitband/startup_gcc.c create mode 100644 boards/ek-lm4f232/bitband/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/blinky/Makefile create mode 100644 boards/ek-lm4f232/blinky/blinky.c create mode 100644 boards/ek-lm4f232/blinky/blinky.ewd create mode 100644 boards/ek-lm4f232/blinky/blinky.ewp create mode 100644 boards/ek-lm4f232/blinky/blinky.icf create mode 100644 boards/ek-lm4f232/blinky/blinky.ld create mode 100644 boards/ek-lm4f232/blinky/blinky.sct create mode 100644 boards/ek-lm4f232/blinky/blinky.uvopt create mode 100644 boards/ek-lm4f232/blinky/blinky.uvproj create mode 100644 boards/ek-lm4f232/blinky/blinky_ccs.cmd create mode 100644 boards/ek-lm4f232/blinky/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/blinky/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/blinky/ccs/.cproject create mode 100644 boards/ek-lm4f232/blinky/ccs/.project create mode 100644 boards/ek-lm4f232/blinky/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/blinky/ccs/Debug/blinky.bin create mode 100644 boards/ek-lm4f232/blinky/ccs/Debug/blinky.out create mode 100644 boards/ek-lm4f232/blinky/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/blinky/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/blinky/ewarm/Exe/blinky.bin create mode 100644 boards/ek-lm4f232/blinky/ewarm/Exe/blinky.out create mode 100644 boards/ek-lm4f232/blinky/gcc/blinky.axf create mode 100644 boards/ek-lm4f232/blinky/gcc/blinky.bin create mode 100644 boards/ek-lm4f232/blinky/readme.txt create mode 100644 boards/ek-lm4f232/blinky/rvmdk/blinky.axf create mode 100644 boards/ek-lm4f232/blinky/rvmdk/blinky.bin create mode 100644 boards/ek-lm4f232/blinky/startup_ccs.c create mode 100644 boards/ek-lm4f232/blinky/startup_ewarm.c create mode 100644 boards/ek-lm4f232/blinky/startup_gcc.c create mode 100644 boards/ek-lm4f232/blinky/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/boot_demo1/Makefile create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.c create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.ewd create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.ewp create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.icf create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.ld create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.sct create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.uvopt create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1.uvproj create mode 100644 boards/ek-lm4f232/boot_demo1/boot_demo1_ccs.cmd create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/.cproject create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/.project create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.bin create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.out create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/boot_demo1/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.bin create mode 100644 boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.out create mode 100644 boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.axf create mode 100644 boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.bin create mode 100644 boards/ek-lm4f232/boot_demo1/readme.txt create mode 100644 boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.axf create mode 100644 boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.bin create mode 100644 boards/ek-lm4f232/boot_demo1/startup_ccs.c create mode 100644 boards/ek-lm4f232/boot_demo1/startup_ewarm.c create mode 100644 boards/ek-lm4f232/boot_demo1/startup_gcc.c create mode 100644 boards/ek-lm4f232/boot_demo1/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/boot_demo2/Makefile create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.c create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.ewd create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.ewp create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.icf create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.ld create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.sct create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.uvopt create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2.uvproj create mode 100644 boards/ek-lm4f232/boot_demo2/boot_demo2_ccs.cmd create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/.cproject create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/.project create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.bin create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.out create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/boot_demo2/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.bin create mode 100644 boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.out create mode 100644 boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.axf create mode 100644 boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.bin create mode 100644 boards/ek-lm4f232/boot_demo2/readme.txt create mode 100644 boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.axf create mode 100644 boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.bin create mode 100644 boards/ek-lm4f232/boot_demo2/startup_ccs.c create mode 100644 boards/ek-lm4f232/boot_demo2/startup_ewarm.c create mode 100644 boards/ek-lm4f232/boot_demo2/startup_gcc.c create mode 100644 boards/ek-lm4f232/boot_demo2/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/boot_serial/Makefile create mode 100644 boards/ek-lm4f232/boot_serial/bl_config.h create mode 100644 boards/ek-lm4f232/boot_serial/boot_serial.ewd create mode 100644 boards/ek-lm4f232/boot_serial/boot_serial.ewp create mode 100644 boards/ek-lm4f232/boot_serial/boot_serial.uvopt create mode 100644 boards/ek-lm4f232/boot_serial/boot_serial.uvproj create mode 100644 boards/ek-lm4f232/boot_serial/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/boot_serial/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/boot_serial/ccs/.cproject create mode 100644 boards/ek-lm4f232/boot_serial/ccs/.project create mode 100644 boards/ek-lm4f232/boot_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.bin create mode 100644 boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.out create mode 100644 boards/ek-lm4f232/boot_serial/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/boot_serial/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.bin create mode 100644 boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.out create mode 100644 boards/ek-lm4f232/boot_serial/gcc/boot_serial.axf create mode 100644 boards/ek-lm4f232/boot_serial/gcc/boot_serial.bin create mode 100644 boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.axf create mode 100644 boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.bin create mode 100644 boards/ek-lm4f232/boot_usb/Makefile create mode 100644 boards/ek-lm4f232/boot_usb/bl_config.h create mode 100644 boards/ek-lm4f232/boot_usb/boot_usb.ewd create mode 100644 boards/ek-lm4f232/boot_usb/boot_usb.ewp create mode 100644 boards/ek-lm4f232/boot_usb/boot_usb.uvopt create mode 100644 boards/ek-lm4f232/boot_usb/boot_usb.uvproj create mode 100644 boards/ek-lm4f232/boot_usb/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/boot_usb/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/boot_usb/ccs/.cproject create mode 100644 boards/ek-lm4f232/boot_usb/ccs/.project create mode 100644 boards/ek-lm4f232/boot_usb/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.bin create mode 100644 boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.out create mode 100644 boards/ek-lm4f232/boot_usb/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/boot_usb/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.bin create mode 100644 boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.out create mode 100644 boards/ek-lm4f232/boot_usb/gcc/boot_usb.axf create mode 100644 boards/ek-lm4f232/boot_usb/gcc/boot_usb.bin create mode 100644 boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.axf create mode 100644 boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.bin create mode 100644 boards/ek-lm4f232/drivers/buttons.c create mode 100644 boards/ek-lm4f232/drivers/buttons.h create mode 100644 boards/ek-lm4f232/drivers/cfal96x64x16.c create mode 100644 boards/ek-lm4f232/drivers/cfal96x64x16.h create mode 100644 boards/ek-lm4f232/drivers/slidemenuwidget.c create mode 100644 boards/ek-lm4f232/drivers/slidemenuwidget.h create mode 100644 boards/ek-lm4f232/drivers/stripchartwidget.c create mode 100644 boards/ek-lm4f232/drivers/stripchartwidget.h create mode 100644 boards/ek-lm4f232/drivers/usb_sound.c create mode 100644 boards/ek-lm4f232/drivers/usb_sound.h create mode 100644 boards/ek-lm4f232/ek-lm4f232.eww create mode 100644 boards/ek-lm4f232/ek-lm4f232.uvmpw create mode 100644 boards/ek-lm4f232/hello/Makefile create mode 100644 boards/ek-lm4f232/hello/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/hello/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/hello/ccs/.cproject create mode 100644 boards/ek-lm4f232/hello/ccs/.project create mode 100644 boards/ek-lm4f232/hello/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/hello/ccs/Debug/hello.bin create mode 100644 boards/ek-lm4f232/hello/ccs/Debug/hello.out create mode 100644 boards/ek-lm4f232/hello/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/hello/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/hello/ewarm/Exe/hello.bin create mode 100644 boards/ek-lm4f232/hello/ewarm/Exe/hello.out create mode 100644 boards/ek-lm4f232/hello/gcc/hello.axf create mode 100644 boards/ek-lm4f232/hello/gcc/hello.bin create mode 100644 boards/ek-lm4f232/hello/hello.c create mode 100644 boards/ek-lm4f232/hello/hello.ewd create mode 100644 boards/ek-lm4f232/hello/hello.ewp create mode 100644 boards/ek-lm4f232/hello/hello.icf create mode 100644 boards/ek-lm4f232/hello/hello.ld create mode 100644 boards/ek-lm4f232/hello/hello.sct create mode 100644 boards/ek-lm4f232/hello/hello.uvopt create mode 100644 boards/ek-lm4f232/hello/hello.uvproj create mode 100644 boards/ek-lm4f232/hello/hello_ccs.cmd create mode 100644 boards/ek-lm4f232/hello/readme.txt create mode 100644 boards/ek-lm4f232/hello/rvmdk/hello.axf create mode 100644 boards/ek-lm4f232/hello/rvmdk/hello.bin create mode 100644 boards/ek-lm4f232/hello/startup_ccs.c create mode 100644 boards/ek-lm4f232/hello/startup_ewarm.c create mode 100644 boards/ek-lm4f232/hello/startup_gcc.c create mode 100644 boards/ek-lm4f232/hello/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/hibernate/Makefile create mode 100644 boards/ek-lm4f232/hibernate/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/hibernate/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/hibernate/ccs/.cproject create mode 100644 boards/ek-lm4f232/hibernate/ccs/.project create mode 100644 boards/ek-lm4f232/hibernate/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.bin create mode 100644 boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.out create mode 100644 boards/ek-lm4f232/hibernate/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/hibernate/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.bin create mode 100644 boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.out create mode 100644 boards/ek-lm4f232/hibernate/gcc/hibernate.axf create mode 100644 boards/ek-lm4f232/hibernate/gcc/hibernate.bin create mode 100644 boards/ek-lm4f232/hibernate/hibernate.c create mode 100644 boards/ek-lm4f232/hibernate/hibernate.ewd create mode 100644 boards/ek-lm4f232/hibernate/hibernate.ewp create mode 100644 boards/ek-lm4f232/hibernate/hibernate.icf create mode 100644 boards/ek-lm4f232/hibernate/hibernate.ld create mode 100644 boards/ek-lm4f232/hibernate/hibernate.sct create mode 100644 boards/ek-lm4f232/hibernate/hibernate.uvopt create mode 100644 boards/ek-lm4f232/hibernate/hibernate.uvproj create mode 100644 boards/ek-lm4f232/hibernate/hibernate_ccs.cmd create mode 100644 boards/ek-lm4f232/hibernate/readme.txt create mode 100644 boards/ek-lm4f232/hibernate/rvmdk/hibernate.axf create mode 100644 boards/ek-lm4f232/hibernate/rvmdk/hibernate.bin create mode 100644 boards/ek-lm4f232/hibernate/startup_ccs.c create mode 100644 boards/ek-lm4f232/hibernate/startup_ewarm.c create mode 100644 boards/ek-lm4f232/hibernate/startup_gcc.c create mode 100644 boards/ek-lm4f232/hibernate/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/interrupts/Makefile create mode 100644 boards/ek-lm4f232/interrupts/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/interrupts/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/interrupts/ccs/.cproject create mode 100644 boards/ek-lm4f232/interrupts/ccs/.project create mode 100644 boards/ek-lm4f232/interrupts/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.bin create mode 100644 boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.out create mode 100644 boards/ek-lm4f232/interrupts/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/interrupts/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.bin create mode 100644 boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.out create mode 100644 boards/ek-lm4f232/interrupts/gcc/interrupts.axf create mode 100644 boards/ek-lm4f232/interrupts/gcc/interrupts.bin create mode 100644 boards/ek-lm4f232/interrupts/interrupts.c create mode 100644 boards/ek-lm4f232/interrupts/interrupts.ewd create mode 100644 boards/ek-lm4f232/interrupts/interrupts.ewp create mode 100644 boards/ek-lm4f232/interrupts/interrupts.icf create mode 100644 boards/ek-lm4f232/interrupts/interrupts.ld create mode 100644 boards/ek-lm4f232/interrupts/interrupts.sct create mode 100644 boards/ek-lm4f232/interrupts/interrupts.uvopt create mode 100644 boards/ek-lm4f232/interrupts/interrupts.uvproj create mode 100644 boards/ek-lm4f232/interrupts/interrupts_ccs.cmd create mode 100644 boards/ek-lm4f232/interrupts/readme.txt create mode 100644 boards/ek-lm4f232/interrupts/rvmdk/interrupts.axf create mode 100644 boards/ek-lm4f232/interrupts/rvmdk/interrupts.bin create mode 100644 boards/ek-lm4f232/interrupts/startup_ccs.c create mode 100644 boards/ek-lm4f232/interrupts/startup_ewarm.c create mode 100644 boards/ek-lm4f232/interrupts/startup_gcc.c create mode 100644 boards/ek-lm4f232/interrupts/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/mpu_fault/Makefile create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/.cproject create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/.project create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.bin create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.out create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/mpu_fault/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.bin create mode 100644 boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.out create mode 100644 boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.axf create mode 100644 boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.bin create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.c create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.ewd create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.ewp create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.icf create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.ld create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.sct create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.uvopt create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault.uvproj create mode 100644 boards/ek-lm4f232/mpu_fault/mpu_fault_ccs.cmd create mode 100644 boards/ek-lm4f232/mpu_fault/readme.txt create mode 100644 boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.axf create mode 100644 boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.bin create mode 100644 boards/ek-lm4f232/mpu_fault/startup_ccs.c create mode 100644 boards/ek-lm4f232/mpu_fault/startup_ewarm.c create mode 100644 boards/ek-lm4f232/mpu_fault/startup_gcc.c create mode 100644 boards/ek-lm4f232/mpu_fault/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/qs-logger/Makefile create mode 100644 boards/ek-lm4f232/qs-logger/acquire.c create mode 100644 boards/ek-lm4f232/qs-logger/acquire.h create mode 100644 boards/ek-lm4f232/qs-logger/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/qs-logger/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/qs-logger/ccs/.cproject create mode 100644 boards/ek-lm4f232/qs-logger/ccs/.project create mode 100644 boards/ek-lm4f232/qs-logger/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.bin create mode 100644 boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.out create mode 100644 boards/ek-lm4f232/qs-logger/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/qs-logger/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/qs-logger/clocksetwidget.c create mode 100644 boards/ek-lm4f232/qs-logger/clocksetwidget.h create mode 100644 boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.bin create mode 100644 boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.out create mode 100644 boards/ek-lm4f232/qs-logger/flashstore.c create mode 100644 boards/ek-lm4f232/qs-logger/flashstore.h create mode 100644 boards/ek-lm4f232/qs-logger/gcc/qs-logger.axf create mode 100644 boards/ek-lm4f232/qs-logger/gcc/qs-logger.bin create mode 100644 boards/ek-lm4f232/qs-logger/images.c create mode 100644 boards/ek-lm4f232/qs-logger/images.h create mode 100644 boards/ek-lm4f232/qs-logger/menus.c create mode 100644 boards/ek-lm4f232/qs-logger/menus.h create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.c create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.ewd create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.ewp create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.h create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.icf create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.ld create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.sct create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.uvopt create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger.uvproj create mode 100644 boards/ek-lm4f232/qs-logger/qs-logger_ccs.cmd create mode 100644 boards/ek-lm4f232/qs-logger/readme.txt create mode 100644 boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.axf create mode 100644 boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.bin create mode 100644 boards/ek-lm4f232/qs-logger/startup_ccs.c create mode 100644 boards/ek-lm4f232/qs-logger/startup_ewarm.c create mode 100644 boards/ek-lm4f232/qs-logger/startup_gcc.c create mode 100644 boards/ek-lm4f232/qs-logger/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/qs-logger/stripchartmanager.c create mode 100644 boards/ek-lm4f232/qs-logger/stripchartmanager.h create mode 100644 boards/ek-lm4f232/qs-logger/usb_serial_structs.c create mode 100644 boards/ek-lm4f232/qs-logger/usb_serial_structs.h create mode 100644 boards/ek-lm4f232/qs-logger/usbserial.c create mode 100644 boards/ek-lm4f232/qs-logger/usbserial.h create mode 100644 boards/ek-lm4f232/qs-logger/usbstick.c create mode 100644 boards/ek-lm4f232/qs-logger/usbstick.h create mode 100644 boards/ek-lm4f232/sd_card/Makefile create mode 100644 boards/ek-lm4f232/sd_card/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/sd_card/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/sd_card/ccs/.cproject create mode 100644 boards/ek-lm4f232/sd_card/ccs/.project create mode 100644 boards/ek-lm4f232/sd_card/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.bin create mode 100644 boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.out create mode 100644 boards/ek-lm4f232/sd_card/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/sd_card/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.bin create mode 100644 boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.out create mode 100644 boards/ek-lm4f232/sd_card/gcc/sd_card.axf create mode 100644 boards/ek-lm4f232/sd_card/gcc/sd_card.bin create mode 100644 boards/ek-lm4f232/sd_card/readme.txt create mode 100644 boards/ek-lm4f232/sd_card/rvmdk/sd_card.axf create mode 100644 boards/ek-lm4f232/sd_card/rvmdk/sd_card.bin create mode 100644 boards/ek-lm4f232/sd_card/sd_card.c create mode 100644 boards/ek-lm4f232/sd_card/sd_card.ewd create mode 100644 boards/ek-lm4f232/sd_card/sd_card.ewp create mode 100644 boards/ek-lm4f232/sd_card/sd_card.icf create mode 100644 boards/ek-lm4f232/sd_card/sd_card.ld create mode 100644 boards/ek-lm4f232/sd_card/sd_card.sct create mode 100644 boards/ek-lm4f232/sd_card/sd_card.uvopt create mode 100644 boards/ek-lm4f232/sd_card/sd_card.uvproj create mode 100644 boards/ek-lm4f232/sd_card/sd_card_ccs.cmd create mode 100644 boards/ek-lm4f232/sd_card/startup_ccs.c create mode 100644 boards/ek-lm4f232/sd_card/startup_ewarm.c create mode 100644 boards/ek-lm4f232/sd_card/startup_gcc.c create mode 100644 boards/ek-lm4f232/sd_card/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/sine_demo/Makefile create mode 100644 boards/ek-lm4f232/sine_demo/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/sine_demo/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/sine_demo/ccs/.cproject create mode 100644 boards/ek-lm4f232/sine_demo/ccs/.project create mode 100644 boards/ek-lm4f232/sine_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.bin create mode 100644 boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.out create mode 100644 boards/ek-lm4f232/sine_demo/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/sine_demo/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.bin create mode 100644 boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.out create mode 100644 boards/ek-lm4f232/sine_demo/gcc/sine_demo.axf create mode 100644 boards/ek-lm4f232/sine_demo/gcc/sine_demo.bin create mode 100644 boards/ek-lm4f232/sine_demo/readme.txt create mode 100644 boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.axf create mode 100644 boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.bin create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.c create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.ewd create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.ewp create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.icf create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.ld create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.sct create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.uvopt create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo.uvproj create mode 100644 boards/ek-lm4f232/sine_demo/sine_demo_ccs.cmd create mode 100644 boards/ek-lm4f232/sine_demo/startup_ccs.c create mode 100644 boards/ek-lm4f232/sine_demo/startup_ewarm.c create mode 100644 boards/ek-lm4f232/sine_demo/startup_gcc.c create mode 100644 boards/ek-lm4f232/sine_demo/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/softuart_echo/Makefile create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/.cproject create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/.project create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.bin create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.out create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/softuart_echo/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.bin create mode 100644 boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.out create mode 100644 boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.axf create mode 100644 boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.bin create mode 100644 boards/ek-lm4f232/softuart_echo/readme.txt create mode 100644 boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.axf create mode 100644 boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.bin create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.c create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.ewd create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.ewp create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.icf create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.ld create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.sct create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.uvopt create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo.uvproj create mode 100644 boards/ek-lm4f232/softuart_echo/softuart_echo_ccs.cmd create mode 100644 boards/ek-lm4f232/softuart_echo/startup_ccs.c create mode 100644 boards/ek-lm4f232/softuart_echo/startup_ewarm.c create mode 100644 boards/ek-lm4f232/softuart_echo/startup_gcc.c create mode 100644 boards/ek-lm4f232/softuart_echo/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/timers/Makefile create mode 100644 boards/ek-lm4f232/timers/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/timers/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/timers/ccs/.cproject create mode 100644 boards/ek-lm4f232/timers/ccs/.project create mode 100644 boards/ek-lm4f232/timers/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/timers/ccs/Debug/timers.bin create mode 100644 boards/ek-lm4f232/timers/ccs/Debug/timers.out create mode 100644 boards/ek-lm4f232/timers/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/timers/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/timers/ewarm/Exe/timers.bin create mode 100644 boards/ek-lm4f232/timers/ewarm/Exe/timers.out create mode 100644 boards/ek-lm4f232/timers/gcc/timers.axf create mode 100644 boards/ek-lm4f232/timers/gcc/timers.bin create mode 100644 boards/ek-lm4f232/timers/readme.txt create mode 100644 boards/ek-lm4f232/timers/rvmdk/timers.axf create mode 100644 boards/ek-lm4f232/timers/rvmdk/timers.bin create mode 100644 boards/ek-lm4f232/timers/startup_ccs.c create mode 100644 boards/ek-lm4f232/timers/startup_ewarm.c create mode 100644 boards/ek-lm4f232/timers/startup_gcc.c create mode 100644 boards/ek-lm4f232/timers/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/timers/timers.c create mode 100644 boards/ek-lm4f232/timers/timers.ewd create mode 100644 boards/ek-lm4f232/timers/timers.ewp create mode 100644 boards/ek-lm4f232/timers/timers.icf create mode 100644 boards/ek-lm4f232/timers/timers.ld create mode 100644 boards/ek-lm4f232/timers/timers.sct create mode 100644 boards/ek-lm4f232/timers/timers.uvopt create mode 100644 boards/ek-lm4f232/timers/timers.uvproj create mode 100644 boards/ek-lm4f232/timers/timers_ccs.cmd create mode 100644 boards/ek-lm4f232/uart_echo/Makefile create mode 100644 boards/ek-lm4f232/uart_echo/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/uart_echo/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/uart_echo/ccs/.cproject create mode 100644 boards/ek-lm4f232/uart_echo/ccs/.project create mode 100644 boards/ek-lm4f232/uart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.bin create mode 100644 boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.out create mode 100644 boards/ek-lm4f232/uart_echo/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/uart_echo/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.bin create mode 100644 boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.out create mode 100644 boards/ek-lm4f232/uart_echo/gcc/uart_echo.axf create mode 100644 boards/ek-lm4f232/uart_echo/gcc/uart_echo.bin create mode 100644 boards/ek-lm4f232/uart_echo/readme.txt create mode 100644 boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.axf create mode 100644 boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.bin create mode 100644 boards/ek-lm4f232/uart_echo/startup_ccs.c create mode 100644 boards/ek-lm4f232/uart_echo/startup_ewarm.c create mode 100644 boards/ek-lm4f232/uart_echo/startup_gcc.c create mode 100644 boards/ek-lm4f232/uart_echo/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.c create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.ewd create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.ewp create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.icf create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.ld create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.sct create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.uvopt create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo.uvproj create mode 100644 boards/ek-lm4f232/uart_echo/uart_echo_ccs.cmd create mode 100644 boards/ek-lm4f232/udma_demo/Makefile create mode 100644 boards/ek-lm4f232/udma_demo/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/udma_demo/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/udma_demo/ccs/.cproject create mode 100644 boards/ek-lm4f232/udma_demo/ccs/.project create mode 100644 boards/ek-lm4f232/udma_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.bin create mode 100644 boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.out create mode 100644 boards/ek-lm4f232/udma_demo/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/udma_demo/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.bin create mode 100644 boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.out create mode 100644 boards/ek-lm4f232/udma_demo/gcc/udma_demo.axf create mode 100644 boards/ek-lm4f232/udma_demo/gcc/udma_demo.bin create mode 100644 boards/ek-lm4f232/udma_demo/readme.txt create mode 100644 boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.axf create mode 100644 boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.bin create mode 100644 boards/ek-lm4f232/udma_demo/startup_ccs.c create mode 100644 boards/ek-lm4f232/udma_demo/startup_ewarm.c create mode 100644 boards/ek-lm4f232/udma_demo/startup_gcc.c create mode 100644 boards/ek-lm4f232/udma_demo/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.c create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.ewd create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.ewp create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.icf create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.ld create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.sct create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.uvopt create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo.uvproj create mode 100644 boards/ek-lm4f232/udma_demo/udma_demo_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_dev_bulk/Makefile create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/.project create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.bin create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.out create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.bin create mode 100644 boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.out create mode 100644 boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.axf create mode 100644 boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.bin create mode 100644 boards/ek-lm4f232/usb_dev_bulk/readme.txt create mode 100644 boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.axf create mode 100644 boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.bin create mode 100644 boards/ek-lm4f232/usb_dev_bulk/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_dev_bulk/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_dev_bulk/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_dev_bulk/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.c create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.h create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.c create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewd create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewp create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.icf create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ld create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.sct create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvopt create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvproj create mode 100644 boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/Makefile create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/.project create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.out create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.out create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.axf create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/readme.txt create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.axf create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.c create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewd create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewp create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.icf create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ld create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.sct create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvopt create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvproj create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.c create mode 100644 boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.h create mode 100644 boards/ek-lm4f232/usb_dev_msc/Makefile create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/.project create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.bin create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.out create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_dev_msc/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.bin create mode 100644 boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.out create mode 100644 boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.axf create mode 100644 boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.bin create mode 100644 boards/ek-lm4f232/usb_dev_msc/readme.txt create mode 100644 boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.axf create mode 100644 boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.bin create mode 100644 boards/ek-lm4f232/usb_dev_msc/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_dev_msc/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_dev_msc/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_dev_msc/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.c create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewd create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewp create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.icf create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ld create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.sct create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvopt create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvproj create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_dev_msc_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.c create mode 100644 boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.h create mode 100644 boards/ek-lm4f232/usb_dev_msc/usbdsdcard.c create mode 100644 boards/ek-lm4f232/usb_dev_msc/usbdsdcard.h create mode 100644 boards/ek-lm4f232/usb_dev_serial/Makefile create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/.project create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.bin create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.out create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_dev_serial/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.bin create mode 100644 boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.out create mode 100644 boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.axf create mode 100644 boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.bin create mode 100644 boards/ek-lm4f232/usb_dev_serial/readme.txt create mode 100644 boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.axf create mode 100644 boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.bin create mode 100644 boards/ek-lm4f232/usb_dev_serial/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_dev_serial/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_dev_serial/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_dev_serial/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.c create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewd create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewp create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.icf create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ld create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.sct create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvopt create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvproj create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_dev_serial_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.c create mode 100644 boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.h create mode 100644 boards/ek-lm4f232/usb_host_audio/Makefile create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/.project create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.bin create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.out create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_host_audio/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.bin create mode 100644 boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.out create mode 100644 boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.axf create mode 100644 boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.bin create mode 100644 boards/ek-lm4f232/usb_host_audio/readme.txt create mode 100644 boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.axf create mode 100644 boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.bin create mode 100644 boards/ek-lm4f232/usb_host_audio/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_host_audio/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_host_audio/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_host_audio/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.c create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewd create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewp create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.icf create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.ld create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.sct create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvopt create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvproj create mode 100644 boards/ek-lm4f232/usb_host_audio/usb_host_audio_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_host_keyboard/Makefile create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/.project create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.out create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.out create mode 100644 boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.axf create mode 100644 boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_host_keyboard/readme.txt create mode 100644 boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.axf create mode 100644 boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.bin create mode 100644 boards/ek-lm4f232/usb_host_keyboard/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_host_keyboard/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_host_keyboard/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_host_keyboard/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.c create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewd create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewp create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.icf create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ld create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.sct create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvopt create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvproj create mode 100644 boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_host_mouse/Makefile create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/.project create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.bin create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.out create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_host_mouse/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.bin create mode 100644 boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.out create mode 100644 boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.axf create mode 100644 boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.bin create mode 100644 boards/ek-lm4f232/usb_host_mouse/readme.txt create mode 100644 boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.axf create mode 100644 boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.bin create mode 100644 boards/ek-lm4f232/usb_host_mouse/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_host_mouse/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_host_mouse/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_host_mouse/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.c create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewd create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewp create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.icf create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ld create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.sct create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvopt create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvproj create mode 100644 boards/ek-lm4f232/usb_host_mouse/usb_host_mouse_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_host_msc/Makefile create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/.project create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.bin create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.out create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_host_msc/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.bin create mode 100644 boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.out create mode 100644 boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.axf create mode 100644 boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.bin create mode 100644 boards/ek-lm4f232/usb_host_msc/readme.txt create mode 100644 boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.axf create mode 100644 boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.bin create mode 100644 boards/ek-lm4f232/usb_host_msc/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_host_msc/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_host_msc/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_host_msc/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.c create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewd create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewp create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.icf create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.ld create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.sct create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvopt create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvproj create mode 100644 boards/ek-lm4f232/usb_host_msc/usb_host_msc_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_stick_demo/Makefile create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/.project create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.bin create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.out create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_stick_demo/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.bin create mode 100644 boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.out create mode 100644 boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.axf create mode 100644 boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.bin create mode 100644 boards/ek-lm4f232/usb_stick_demo/readme.txt create mode 100644 boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.axf create mode 100644 boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.bin create mode 100644 boards/ek-lm4f232/usb_stick_demo/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_stick_demo/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_stick_demo/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_stick_demo/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.c create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewd create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewp create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.icf create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ld create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.sct create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvopt create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvproj create mode 100644 boards/ek-lm4f232/usb_stick_demo/usb_stick_demo_ccs.cmd create mode 100644 boards/ek-lm4f232/usb_stick_update/Makefile create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/.cproject create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/.project create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.bin create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.out create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/usb_stick_update/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.bin create mode 100644 boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.out create mode 100644 boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.axf create mode 100644 boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.bin create mode 100644 boards/ek-lm4f232/usb_stick_update/readme.txt create mode 100644 boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.axf create mode 100644 boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.bin create mode 100644 boards/ek-lm4f232/usb_stick_update/simple_fs.c create mode 100644 boards/ek-lm4f232/usb_stick_update/simple_fs.h create mode 100644 boards/ek-lm4f232/usb_stick_update/startup_ccs.c create mode 100644 boards/ek-lm4f232/usb_stick_update/startup_ewarm.c create mode 100644 boards/ek-lm4f232/usb_stick_update/startup_gcc.c create mode 100644 boards/ek-lm4f232/usb_stick_update/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.c create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewd create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewp create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.icf create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.ld create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.sct create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvopt create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvproj create mode 100644 boards/ek-lm4f232/usb_stick_update/usb_stick_update_ccs.cmd create mode 100644 boards/ek-lm4f232/watchdog/Makefile create mode 100644 boards/ek-lm4f232/watchdog/ccs/.ccsimportspec create mode 100644 boards/ek-lm4f232/watchdog/ccs/.ccsproject create mode 100644 boards/ek-lm4f232/watchdog/ccs/.cproject create mode 100644 boards/ek-lm4f232/watchdog/ccs/.project create mode 100644 boards/ek-lm4f232/watchdog/ccs/.settings/org.eclipse.cdt.codan.core.prefs create mode 100644 boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.bin create mode 100644 boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.out create mode 100644 boards/ek-lm4f232/watchdog/ccs/macros.ini_initial create mode 100644 boards/ek-lm4f232/watchdog/ccs/target_config.ccxml create mode 100644 boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.bin create mode 100644 boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.out create mode 100644 boards/ek-lm4f232/watchdog/gcc/watchdog.axf create mode 100644 boards/ek-lm4f232/watchdog/gcc/watchdog.bin create mode 100644 boards/ek-lm4f232/watchdog/readme.txt create mode 100644 boards/ek-lm4f232/watchdog/rvmdk/watchdog.axf create mode 100644 boards/ek-lm4f232/watchdog/rvmdk/watchdog.bin create mode 100644 boards/ek-lm4f232/watchdog/startup_ccs.c create mode 100644 boards/ek-lm4f232/watchdog/startup_ewarm.c create mode 100644 boards/ek-lm4f232/watchdog/startup_gcc.c create mode 100644 boards/ek-lm4f232/watchdog/startup_rvmdk.S create mode 100644 boards/ek-lm4f232/watchdog/watchdog.c create mode 100644 boards/ek-lm4f232/watchdog/watchdog.ewd create mode 100644 boards/ek-lm4f232/watchdog/watchdog.ewp create mode 100644 boards/ek-lm4f232/watchdog/watchdog.icf create mode 100644 boards/ek-lm4f232/watchdog/watchdog.ld create mode 100644 boards/ek-lm4f232/watchdog/watchdog.sct create mode 100644 boards/ek-lm4f232/watchdog/watchdog.uvopt create mode 100644 boards/ek-lm4f232/watchdog/watchdog.uvproj create mode 100644 boards/ek-lm4f232/watchdog/watchdog_ccs.cmd (limited to 'boards/ek-lm4f232') diff --git a/boards/ek-lm4f232/Makefile b/boards/ek-lm4f232/Makefile new file mode 100644 index 0000000..f4da8b4 --- /dev/null +++ b/boards/ek-lm4f232/Makefile @@ -0,0 +1,74 @@ +#****************************************************************************** +# +# Makefile - Rules for building the ek-lm4f232 examples. +# +# Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# A list of the directories containing the examples. +# +DIRS=bitband \ + blinky \ + boot_demo1 \ + boot_demo2 \ + boot_serial \ + boot_usb \ + hello \ + hibernate \ + interrupts \ + mpu_fault \ + qs-logger \ + sd_card \ + sine_demo \ + softuart_echo \ + timers \ + uart_echo \ + udma_demo \ + usb_dev_bulk \ + usb_dev_keyboard \ + usb_dev_msc \ + usb_dev_serial \ + usb_host_audio \ + usb_host_msc \ + usb_host_keyboard \ + usb_host_mouse \ + usb_stick_demo \ + usb_stick_update \ + watchdog + +# +# The default rule, which causes the examples to be built. +# +all: + @for i in ${DIRS}; \ + do \ + make -C $${i} || exit $$?; \ + done + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${wildcard *~} __dummy__ + @-for i in ${DIRS}; \ + do \ + make -C $${i} clean; \ + done diff --git a/boards/ek-lm4f232/bitband/Makefile b/boards/ek-lm4f232/bitband/Makefile new file mode 100644 index 0000000..d520026 --- /dev/null +++ b/boards/ek-lm4f232/bitband/Makefile @@ -0,0 +1,87 @@ +#****************************************************************************** +# +# Makefile - Rules for building the bitband example. +# +# Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the bitband example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/bitband.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the bitband example. +# +${COMPILER}/bitband.axf: ${COMPILER}/bitband.o +${COMPILER}/bitband.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/bitband.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/bitband.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/bitband.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/bitband.axf: bitband.ld +SCATTERgcc_bitband=bitband.ld +ENTRY_bitband=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/bitband/bitband.c b/boards/ek-lm4f232/bitband/bitband.c new file mode 100644 index 0000000..f550ba0 --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.c @@ -0,0 +1,292 @@ +//***************************************************************************** +// +// bitband.c - Bit-band manipulation example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "driverlib/fpu.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Bit-Banding (bitband)

+//! +//! This example application demonstrates the use of the bit-banding +//! capabilities of the Cortex-M3 microprocessor. All of SRAM and all of the +//! peripherals reside within bit-band regions, meaning that bit-banding +//! operations can be applied to any of them. In this example, a variable in +//! SRAM is set to a particular value one bit at a time using bit-banding +//! operations (it would be more efficient to do a single non-bit-banded write; +//! this simply demonstrates the operation of bit-banding). +// +//***************************************************************************** + +//***************************************************************************** +// +// A map of hex nibbles to ASCII characters. +// +//***************************************************************************** +static const char * const pcHex = "0123456789ABCDEF"; + +//***************************************************************************** +// +// The value that is to be modified via bit-banding. +// +//***************************************************************************** +static volatile uint32_t g_ui32Value; + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Delay for the specified number of seconds. Depending upon the current +// SysTick value, the delay will be between N-1 and N seconds (i.e. N-1 full +// seconds are guaranteed, aint32_t with the remainder of the current second). +// +//***************************************************************************** +void +Delay(uint32_t ui32Seconds) +{ + // + // Loop while there are more seconds to wait. + // + while(ui32Seconds--) + { + // + // Wait until the SysTick value is less than 1000. + // + while(ROM_SysTickValueGet() > 1000) + { + } + + // + // Wait until the SysTick value is greater than 1000. + // + while(ROM_SysTickValueGet() < 1000) + { + } + } +} + +//***************************************************************************** +// +// Print the given value as a hexadecimal string on the CSTN. +// +//***************************************************************************** +void +PrintValue(uint32_t ui32Value) +{ + char pcBuffer[9]; + + pcBuffer[0] = pcHex[(ui32Value >> 28) & 15]; + pcBuffer[1] = pcHex[(ui32Value >> 24) & 15]; + pcBuffer[2] = pcHex[(ui32Value >> 20) & 15]; + pcBuffer[3] = pcHex[(ui32Value >> 16) & 15]; + pcBuffer[4] = pcHex[(ui32Value >> 12) & 15]; + pcBuffer[5] = pcHex[(ui32Value >> 8) & 15]; + pcBuffer[6] = pcHex[(ui32Value >> 4) & 15]; + pcBuffer[7] = pcHex[(ui32Value >> 0) & 15]; + pcBuffer[8] = '\0'; + + GrStringDrawCentered(&g_sContext, pcBuffer, -1, + GrContextDpyWidthGet(&g_sContext) / 2, 28, 1); +} + +//***************************************************************************** +// +// This example demonstrates the use of bit-banding to set individual bits +// within a word of SRAM. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + uint32_t ui32Errors, ui32Idx; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context and find the middle X coordinate. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "bitband", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + + // + // Set up and enable the SysTick timer. It will be used as a reference + // for delay loops. The SysTick timer period will be set up for one + // second. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet()); + ROM_SysTickEnable(); + + // + // Set the value and error count to zero. + // + g_ui32Value = 0; + ui32Errors = 0; + + // + // Print the initial value to the CSTN. + // + PrintValue(g_ui32Value); + + // + // Delay for 1 second. + // + Delay(1); + + // + // Set the value to 0xdecafbad using bit band accesses to each individual + // bit. + // + for(ui32Idx = 0; ui32Idx < 32; ui32Idx++) + { + // + // Set this bit. + // + HWREGBITW(&g_ui32Value, 31 - ui32Idx) = + (0xdecafbad >> (31 - ui32Idx)) & 1; + + // + // Print the current value to the CSTN. + // + PrintValue(g_ui32Value); + + // + // Delay for 1 second. + // + Delay(1); + } + + // + // Make sure that the value is 0xdecafbad. + // + if(g_ui32Value != 0xdecafbad) + { + ui32Errors++; + } + + // + // Make sure that the individual bits read back correctly. + // + for(ui32Idx = 0; ui32Idx < 32; ui32Idx++) + { + if(HWREGBITW(&g_ui32Value, ui32Idx) != ((0xdecafbad >> ui32Idx) & 1)) + { + ui32Errors++; + } + } + + // + // Delay for 2 seconds. + // + Delay(2); + + // + // Print out the result. + // + if(ui32Errors) + { + GrStringDrawCentered(&g_sContext, "Errors!", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 48, 0); + } + else + { + GrStringDrawCentered(&g_sContext, "Success!", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 48, 0); + } + + // + // Flush any cached drawing operations. + // + GrFlush(&g_sContext); + + // + // Loop forever. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/bitband/bitband.ewd b/boards/ek-lm4f232/bitband/bitband.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/bitband/bitband.ewp b/boards/ek-lm4f232/bitband/bitband.ewp new file mode 100644 index 0000000..507ca0a --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.ewp @@ -0,0 +1,792 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\bitband.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + diff --git a/boards/ek-lm4f232/bitband/bitband.icf b/boards/ek-lm4f232/bitband/bitband.icf new file mode 100644 index 0000000..2f818eb --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// bitband.icf - Linker configuration file for bitband. +// +// Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/bitband/bitband.ld b/boards/ek-lm4f232/bitband/bitband.ld new file mode 100644 index 0000000..0cfe7b6 --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * bitband.ld - Linker configuration file for bitband. + * + * Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/bitband/bitband.sct b/boards/ek-lm4f232/bitband/bitband.sct new file mode 100644 index 0000000..ebff872 --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; bitband.sct - Linker configuration file for bitband. +; +; Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/bitband/bitband.uvopt b/boards/ek-lm4f232/bitband/bitband.uvopt new file mode 100644 index 0000000..938f782 --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.uvopt @@ -0,0 +1,317 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + bitband + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\bitband.c + bitband.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + + + Libraries + 1 + 0 + 0 + + 2 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 6 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/bitband/bitband.uvproj b/boards/ek-lm4f232/bitband/bitband.uvproj new file mode 100644 index 0000000..e1510ce --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband.uvproj @@ -0,0 +1,434 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + bitband + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + bitband + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\bitband.bin .\rvmdk\bitband.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + bitband.sct + + + --entry Reset_Handler + + + + + + + + Source + + + bitband.c + 1 + .\bitband.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/bitband/bitband_ccs.cmd b/boards/ek-lm4f232/bitband/bitband_ccs.cmd new file mode 100644 index 0000000..dc70d20 --- /dev/null +++ b/boards/ek-lm4f232/bitband/bitband_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * bitband_ccs.cmd - CCS linker configuration file for bitband. + * + * Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; diff --git a/boards/ek-lm4f232/bitband/ccs/.ccsimportspec b/boards/ek-lm4f232/bitband/ccs/.ccsimportspec new file mode 100644 index 0000000..9748e3c --- /dev/null +++ b/boards/ek-lm4f232/bitband/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/bitband/ccs/.ccsproject b/boards/ek-lm4f232/bitband/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/bitband/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/bitband/ccs/.cproject b/boards/ek-lm4f232/bitband/ccs/.cproject new file mode 100644 index 0000000..e627102 --- /dev/null +++ b/boards/ek-lm4f232/bitband/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/bitband/ccs/.project b/boards/ek-lm4f232/bitband/ccs/.project new file mode 100644 index 0000000..e93d575 --- /dev/null +++ b/boards/ek-lm4f232/bitband/ccs/.project @@ -0,0 +1,55 @@ + + + bitband + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + bitband.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/bitband/bitband.c + + + bitband_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/bitband/bitband_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/bitband/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/bitband/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/bitband/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/bitband/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/bitband/ccs/Debug/bitband.bin b/boards/ek-lm4f232/bitband/ccs/Debug/bitband.bin new file mode 100644 index 0000000..ee066fd Binary files /dev/null and b/boards/ek-lm4f232/bitband/ccs/Debug/bitband.bin differ diff --git a/boards/ek-lm4f232/bitband/ccs/Debug/bitband.out b/boards/ek-lm4f232/bitband/ccs/Debug/bitband.out new file mode 100644 index 0000000..a0f3cf4 Binary files /dev/null and b/boards/ek-lm4f232/bitband/ccs/Debug/bitband.out differ diff --git a/boards/ek-lm4f232/bitband/ccs/macros.ini_initial b/boards/ek-lm4f232/bitband/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/bitband/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/bitband/ccs/target_config.ccxml b/boards/ek-lm4f232/bitband/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/bitband/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/bitband/ewarm/Exe/bitband.bin b/boards/ek-lm4f232/bitband/ewarm/Exe/bitband.bin new file mode 100644 index 0000000..10aae13 Binary files /dev/null and b/boards/ek-lm4f232/bitband/ewarm/Exe/bitband.bin differ diff --git a/boards/ek-lm4f232/bitband/ewarm/Exe/bitband.out b/boards/ek-lm4f232/bitband/ewarm/Exe/bitband.out new file mode 100644 index 0000000..759d7e3 Binary files /dev/null and b/boards/ek-lm4f232/bitband/ewarm/Exe/bitband.out differ diff --git a/boards/ek-lm4f232/bitband/gcc/bitband.axf b/boards/ek-lm4f232/bitband/gcc/bitband.axf new file mode 100644 index 0000000..02828d9 Binary files /dev/null and b/boards/ek-lm4f232/bitband/gcc/bitband.axf differ diff --git a/boards/ek-lm4f232/bitband/gcc/bitband.bin b/boards/ek-lm4f232/bitband/gcc/bitband.bin new file mode 100644 index 0000000..55d76f3 Binary files /dev/null and b/boards/ek-lm4f232/bitband/gcc/bitband.bin differ diff --git a/boards/ek-lm4f232/bitband/readme.txt b/boards/ek-lm4f232/bitband/readme.txt new file mode 100644 index 0000000..5b65d59 --- /dev/null +++ b/boards/ek-lm4f232/bitband/readme.txt @@ -0,0 +1,29 @@ +Bit-Banding + +This example application demonstrates the use of the bit-banding +capabilities of the Cortex-M3 microprocessor. All of SRAM and all of the +peripherals reside within bit-band regions, meaning that bit-banding +operations can be applied to any of them. In this example, a variable in +SRAM is set to a particular value one bit at a time using bit-banding +operations (it would be more efficient to do a single non-bit-banded write; +this simply demonstrates the operation of bit-banding). + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/bitband/rvmdk/bitband.axf b/boards/ek-lm4f232/bitband/rvmdk/bitband.axf new file mode 100644 index 0000000..c9021fa Binary files /dev/null and b/boards/ek-lm4f232/bitband/rvmdk/bitband.axf differ diff --git a/boards/ek-lm4f232/bitband/rvmdk/bitband.bin b/boards/ek-lm4f232/bitband/rvmdk/bitband.bin new file mode 100644 index 0000000..4059a83 Binary files /dev/null and b/boards/ek-lm4f232/bitband/rvmdk/bitband.bin differ diff --git a/boards/ek-lm4f232/bitband/startup_ccs.c b/boards/ek-lm4f232/bitband/startup_ccs.c new file mode 100644 index 0000000..063065a --- /dev/null +++ b/boards/ek-lm4f232/bitband/startup_ccs.c @@ -0,0 +1,295 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/bitband/startup_ewarm.c b/boards/ek-lm4f232/bitband/startup_ewarm.c new file mode 100644 index 0000000..0bf6eb8 --- /dev/null +++ b/boards/ek-lm4f232/bitband/startup_ewarm.c @@ -0,0 +1,326 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/bitband/startup_gcc.c b/boards/ek-lm4f232/bitband/startup_gcc.c new file mode 100644 index 0000000..3e91d30 --- /dev/null +++ b/boards/ek-lm4f232/bitband/startup_gcc.c @@ -0,0 +1,342 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/bitband/startup_rvmdk.S b/boards/ek-lm4f232/bitband/startup_rvmdk.S new file mode 100644 index 0000000..0f99997 --- /dev/null +++ b/boards/ek-lm4f232/bitband/startup_rvmdk.S @@ -0,0 +1,351 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2009-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/blinky/Makefile b/boards/ek-lm4f232/blinky/Makefile new file mode 100644 index 0000000..d2e0838 --- /dev/null +++ b/boards/ek-lm4f232/blinky/Makefile @@ -0,0 +1,77 @@ +#****************************************************************************** +# +# Makefile - Rules for building the blinky example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find header files that do not live in the source directory. +# +IPATH=../../../.. + +# +# The default rule, which causes the blinky example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/blinky.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the blinky example. +# +${COMPILER}/blinky.axf: ${COMPILER}/blinky.o +${COMPILER}/blinky.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/blinky.axf: blinky.ld +SCATTERgcc_blinky=blinky.ld +ENTRY_blinky=ResetISR + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/blinky/blinky.c b/boards/ek-lm4f232/blinky/blinky.c new file mode 100644 index 0000000..ef69c80 --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.c @@ -0,0 +1,93 @@ +//***************************************************************************** +// +// blinky.c - Simple example to blink the on-board LED. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/tm4c123gh6pge.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Blinky (blinky)

+//! +//! A very simple example that blinks the on-board LED. +// +//***************************************************************************** + +//***************************************************************************** +// +// Blink the on-board LED. +// +//***************************************************************************** +int +main(void) +{ + volatile uint32_t ui32Loop; + + // + // Enable the GPIO port that is used for the on-board LED. + // + SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOG; + + // + // Do a dummy read to insert a few cycles after enabling the peripheral. + // + ui32Loop = SYSCTL_RCGC2_R; + + // + // Enable the GPIO pin for the LED (PG2). Set the direction as output, and + // enable the GPIO pin for digital function. + // + GPIO_PORTG_DIR_R = 0x04; + GPIO_PORTG_DEN_R = 0x04; + + // + // Loop forever. + // + while(1) + { + // + // Turn on the LED. + // + GPIO_PORTG_DATA_R |= 0x04; + + // + // Delay for a bit. + // + for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) + { + } + + // + // Turn off the LED. + // + GPIO_PORTG_DATA_R &= ~(0x04); + + // + // Delay for a bit. + // + for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) + { + } + } +} diff --git a/boards/ek-lm4f232/blinky/blinky.ewd b/boards/ek-lm4f232/blinky/blinky.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/blinky/blinky.ewp b/boards/ek-lm4f232/blinky/blinky.ewp new file mode 100644 index 0000000..44d8705 --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.ewp @@ -0,0 +1,777 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Source + + $PROJ_DIR$\blinky.c + + + $PROJ_DIR$\startup_ewarm.c + + + diff --git a/boards/ek-lm4f232/blinky/blinky.icf b/boards/ek-lm4f232/blinky/blinky.icf new file mode 100644 index 0000000..79202e7 --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// blinky.icf - Linker configuration file for blinky. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/blinky/blinky.ld b/boards/ek-lm4f232/blinky/blinky.ld new file mode 100644 index 0000000..5880d90 --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * blinky.ld - Linker configuration file for blinky. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/blinky/blinky.sct b/boards/ek-lm4f232/blinky/blinky.sct new file mode 100644 index 0000000..aec544e --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; blinky.sct - Linker configuration file for blinky. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/blinky/blinky.uvopt b/boards/ek-lm4f232/blinky/blinky.uvopt new file mode 100644 index 0000000..f88b9bd --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.uvopt @@ -0,0 +1,268 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + blinky + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\blinky.c + blinky.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + + + Documentation + 1 + 0 + 0 + + 2 + 3 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/blinky/blinky.uvproj b/boards/ek-lm4f232/blinky/blinky.uvproj new file mode 100644 index 0000000..8c62c70 --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky.uvproj @@ -0,0 +1,414 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + blinky + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + blinky + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\blinky.bin .\rvmdk\blinky.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE + + ..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + blinky.sct + + + --entry Reset_Handler + + + + + + + + Source + + + blinky.c + 1 + .\blinky.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/blinky/blinky_ccs.cmd b/boards/ek-lm4f232/blinky/blinky_ccs.cmd new file mode 100644 index 0000000..db4bc75 --- /dev/null +++ b/boards/ek-lm4f232/blinky/blinky_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * blinky_ccs.cmd - CCS linker configuration file for blinky. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 256; diff --git a/boards/ek-lm4f232/blinky/ccs/.ccsimportspec b/boards/ek-lm4f232/blinky/ccs/.ccsimportspec new file mode 100644 index 0000000..60cba3f --- /dev/null +++ b/boards/ek-lm4f232/blinky/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/blinky/ccs/.ccsproject b/boards/ek-lm4f232/blinky/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/blinky/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/blinky/ccs/.cproject b/boards/ek-lm4f232/blinky/ccs/.cproject new file mode 100644 index 0000000..7668b94 --- /dev/null +++ b/boards/ek-lm4f232/blinky/ccs/.cproject @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/blinky/ccs/.project b/boards/ek-lm4f232/blinky/ccs/.project new file mode 100644 index 0000000..add88b4 --- /dev/null +++ b/boards/ek-lm4f232/blinky/ccs/.project @@ -0,0 +1,50 @@ + + + blinky + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + blinky.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/blinky/blinky.c + + + blinky_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/blinky/blinky_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/blinky/startup_ccs.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/blinky/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/blinky/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/blinky/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/blinky/ccs/Debug/blinky.bin b/boards/ek-lm4f232/blinky/ccs/Debug/blinky.bin new file mode 100644 index 0000000..640cec2 Binary files /dev/null and b/boards/ek-lm4f232/blinky/ccs/Debug/blinky.bin differ diff --git a/boards/ek-lm4f232/blinky/ccs/Debug/blinky.out b/boards/ek-lm4f232/blinky/ccs/Debug/blinky.out new file mode 100644 index 0000000..f1436f4 Binary files /dev/null and b/boards/ek-lm4f232/blinky/ccs/Debug/blinky.out differ diff --git a/boards/ek-lm4f232/blinky/ccs/macros.ini_initial b/boards/ek-lm4f232/blinky/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/blinky/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/blinky/ccs/target_config.ccxml b/boards/ek-lm4f232/blinky/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/blinky/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/blinky/ewarm/Exe/blinky.bin b/boards/ek-lm4f232/blinky/ewarm/Exe/blinky.bin new file mode 100644 index 0000000..42ee325 Binary files /dev/null and b/boards/ek-lm4f232/blinky/ewarm/Exe/blinky.bin differ diff --git a/boards/ek-lm4f232/blinky/ewarm/Exe/blinky.out b/boards/ek-lm4f232/blinky/ewarm/Exe/blinky.out new file mode 100644 index 0000000..4ad7cb3 Binary files /dev/null and b/boards/ek-lm4f232/blinky/ewarm/Exe/blinky.out differ diff --git a/boards/ek-lm4f232/blinky/gcc/blinky.axf b/boards/ek-lm4f232/blinky/gcc/blinky.axf new file mode 100644 index 0000000..fb271f8 Binary files /dev/null and b/boards/ek-lm4f232/blinky/gcc/blinky.axf differ diff --git a/boards/ek-lm4f232/blinky/gcc/blinky.bin b/boards/ek-lm4f232/blinky/gcc/blinky.bin new file mode 100644 index 0000000..9c52458 Binary files /dev/null and b/boards/ek-lm4f232/blinky/gcc/blinky.bin differ diff --git a/boards/ek-lm4f232/blinky/readme.txt b/boards/ek-lm4f232/blinky/readme.txt new file mode 100644 index 0000000..bdc1513 --- /dev/null +++ b/boards/ek-lm4f232/blinky/readme.txt @@ -0,0 +1,23 @@ +Blinky + +A very simple example that blinks the on-board LED. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/blinky/rvmdk/blinky.axf b/boards/ek-lm4f232/blinky/rvmdk/blinky.axf new file mode 100644 index 0000000..115f5de Binary files /dev/null and b/boards/ek-lm4f232/blinky/rvmdk/blinky.axf differ diff --git a/boards/ek-lm4f232/blinky/rvmdk/blinky.bin b/boards/ek-lm4f232/blinky/rvmdk/blinky.bin new file mode 100644 index 0000000..a8e61b4 Binary files /dev/null and b/boards/ek-lm4f232/blinky/rvmdk/blinky.bin differ diff --git a/boards/ek-lm4f232/blinky/startup_ccs.c b/boards/ek-lm4f232/blinky/startup_ccs.c new file mode 100644 index 0000000..f21c31c --- /dev/null +++ b/boards/ek-lm4f232/blinky/startup_ccs.c @@ -0,0 +1,295 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/blinky/startup_ewarm.c b/boards/ek-lm4f232/blinky/startup_ewarm.c new file mode 100644 index 0000000..926333e --- /dev/null +++ b/boards/ek-lm4f232/blinky/startup_ewarm.c @@ -0,0 +1,326 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[64] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/blinky/startup_gcc.c b/boards/ek-lm4f232/blinky/startup_gcc.c new file mode 100644 index 0000000..b2f963b --- /dev/null +++ b/boards/ek-lm4f232/blinky/startup_gcc.c @@ -0,0 +1,342 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[64]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/blinky/startup_rvmdk.S b/boards/ek-lm4f232/blinky/startup_rvmdk.S new file mode 100644 index 0000000..ff7cf16 --- /dev/null +++ b/boards/ek-lm4f232/blinky/startup_rvmdk.S @@ -0,0 +1,351 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000100 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/boot_demo1/Makefile b/boards/ek-lm4f232/boot_demo1/Makefile new file mode 100644 index 0000000..52bab0b --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/Makefile @@ -0,0 +1,92 @@ +#****************************************************************************** +# +# Makefile - Rules for building the boot_demo1 example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=. +IPATH+=.. +IPATH+=../../../.. +IPATH+=../../../../third_party/bget +IPATH+=../../../../third_party + +# +# The default rule, which causes the boot_demo1 example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/boot_demo1.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the boot_demo1 example. +# +${COMPILER}/boot_demo1.axf: ${COMPILER}/boot_demo1.o +${COMPILER}/boot_demo1.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/boot_demo1.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/boot_demo1.axf: ${COMPILER}/ustdlib.o +${COMPILER}/boot_demo1.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/boot_demo1.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/boot_demo1.axf: boot_demo1.ld +SCATTERgcc_boot_demo1=boot_demo1.ld +ENTRY_boot_demo1=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.c b/boards/ek-lm4f232/boot_demo1/boot_demo1.c new file mode 100644 index 0000000..ca64f94 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.c @@ -0,0 +1,267 @@ +//***************************************************************************** +// +// boot_demo1.c - First boot loader example. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_flash.h" +#include "inc/hw_memmap.h" +#include "inc/hw_sysctl.h" +#include "inc/hw_gpio.h" +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" +#include "driverlib/pin_map.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/sysctl.h" +#include "driverlib/flash.h" +#include "driverlib/uart.h" +#include "driverlib/rom.h" +#include "utils/ustdlib.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Boot Loader Demo 1 (boot_demo1)

+//! +//! An example to demonstrate the use of a flash-based boot loader. At +//! startup, the application will configure the UART and USB peripherals, +//! and then branch to the boot loader to await the start of an +//! update. If using the serial boot loader (boot_serial), the UART will +//! always be configured at 115,200 baud and does not require the use of +//! auto-bauding. +//! +//! This application is intended for use with any of the three flash-based boot +//! loader flavors (boot_serial or boot_usb) included in the software +//! release. To accommodate the largest of these (boot_usb), the link address +//! is set to 0x2800. If you are using serial, you may change this +//! address to a 1KB boundary higher than the last address occupied +//! by the boot loader binary as long as you also rebuild the boot +//! loader itself after modifying its bl_config.h file to set APP_START_ADDRESS +//! to the same value. +//! +//! The boot_demo2 application can be used along with this application to +//! easily demonstrate that the boot loader is actually updating the on-chip +//! flash. +//! +//! Note that the LM4F232 and other Blizzard-class devices also +//! support the serial and USB boot loaders in ROM. To make use of this +//! function, link your application to run at address 0x0000 in flash and enter +//! the bootloader using the ROM_UpdateSerial and ROM_UpdateUSB functions +//! (defined in rom.h). This mechanism is used in the utils/swupdate.c +//! module when built specifically targeting a suitable Blizzard-class device. +// +//***************************************************************************** + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Passes control to the bootloader and initiates a remote software update. +// +// This function passes control to the bootloader and initiates an update of +// the main application firmware image via UART0 or USB depending +// upon the specific boot loader binary in use. +// +// \return Never returns. +// +//***************************************************************************** +void +JumpToBootLoader(void) +{ + // + // Disable all processor interrupts. Instead of disabling them + // one at a time, a direct write to NVIC is done to disable all + // peripheral interrupts. + // + HWREG(NVIC_DIS0) = 0xffffffff; + HWREG(NVIC_DIS1) = 0xffffffff; + + // + // Return control to the boot loader. This is a call to the SVC + // handler in the boot loader. + // + (*((void (*)(void))(*(uint32_t *)0x2c)))(); +} + +//***************************************************************************** +// +// Initialize UART0 and set the appropriate communication parameters. +// +//***************************************************************************** +void +SetupForUART(void) +{ + // + // We need to make sure that UART0 and its associated GPIO port are + // enabled before we pass control to the boot loader. The serial boot + // loader does not enable or configure these peripherals for us if we + // enter it via its SVC vector. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Set GPIO A0 and A1 as UART. + // + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Configure the UART for 115200, n, 8, 1 + // + ROM_UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, + (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | + UART_CONFIG_WLEN_8)); + + // + // Enable the UART operation. + // + ROM_UARTEnable(UART0_BASE); +} + +//***************************************************************************** +// +// Enable the USB controller +// +//***************************************************************************** +void +SetupForUSB(void) +{ + // + // The USB boot loader takes care of all required USB initialization so, + // if the application itself doesn't need to use the USB controller, we + // don't actually need to enable it here. The only requirement imposed by + // the USB boot loader is that the system clock is running from the PLL + // when the boot loader is entered. + // +} + +//***************************************************************************** +// +// Demonstrate the use of the boot loader. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + tContext sContext; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the system clock to run at 50MHz from the PLL + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | + SYSCTL_OSC_MAIN); + + // + // Initialize the peripherals that each of the boot loader flavors + // supports. Since this example is intended for use with any of the + // boot loaders and we don't know which is actually in use, we cover all + // bases and initialize for serial and USB use here. + // + SetupForUART(); + SetupForUSB(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "boot-demo1", -1, + GrContextDpyWidthGet(&sContext) / 2, 4, 0); + + // + // Indicate what is happening. + // + GrStringDrawCentered(&sContext, "The boot loader", -1, + GrContextDpyWidthGet(&sContext) / 2, 20, false); + GrStringDrawCentered(&sContext, "is now running", -1, + GrContextDpyWidthGet(&sContext) / 2, 30, false); + GrStringDrawCentered(&sContext, "and awaiting", -1, + GrContextDpyWidthGet(&sContext) / 2, 40, false); + GrStringDrawCentered(&sContext, "an update.", -1, + GrContextDpyWidthGet(&sContext) / 2, 50, false); + + // + // Pass control to whichever flavor of boot loader the board is configured + // with. + // + JumpToBootLoader(); + + // + // The previous function never returns but we need to stick in a return + // code here to keep the compiler from generating a warning. + // + return(0); +} diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.ewd b/boards/ek-lm4f232/boot_demo1/boot_demo1.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.ewp b/boards/ek-lm4f232/boot_demo1/boot_demo1.ewp new file mode 100644 index 0000000..d7e27a5 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.ewp @@ -0,0 +1,801 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\boot_demo1.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.icf b/boards/ek-lm4f232/boot_demo1/boot_demo1.icf new file mode 100644 index 0000000..5b8a42a --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// boot_demo1.icf - Linker configuration file for boot_demo1. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00002800 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.ld b/boards/ek-lm4f232/boot_demo1/boot_demo1.ld new file mode 100644 index 0000000..5a24669 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * boot_demo1.ld - Linker configuration file for boot_demo1. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00002800, LENGTH = 0x0003d800 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.sct b/boards/ek-lm4f232/boot_demo1/boot_demo1.sct new file mode 100644 index 0000000..6277771 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; boot_demo1.sct - Linker configuration file for boot_demo1. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00002800 0x0003d800 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00002800 0x0003d800 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.uvopt b/boards/ek-lm4f232/boot_demo1/boot_demo1.uvopt new file mode 100644 index 0000000..e89f13c --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.uvopt @@ -0,0 +1,331 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + boot_demo1 + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\boot_demo1.c + boot_demo1.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 7 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1.uvproj b/boards/ek-lm4f232/boot_demo1/boot_demo1.uvproj new file mode 100644 index 0000000..9bd4480 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1.uvproj @@ -0,0 +1,439 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + boot_demo1 + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + boot_demo1 + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\boot_demo1.bin .\rvmdk\boot_demo1.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + .;..;..\..\..\..;..\..\..\..\third_party\bget;..\..\..\..\third_party; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + boot_demo1.sct + + + --entry Reset_Handler + + + + + + + + Source + + + boot_demo1.c + 1 + .\boot_demo1.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/boot_demo1/boot_demo1_ccs.cmd b/boards/ek-lm4f232/boot_demo1/boot_demo1_ccs.cmd new file mode 100644 index 0000000..d7fe250 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/boot_demo1_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * boot_demo1_ccs.cmd - CCS linker configuration file for boot_demo1. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00002800 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x0003d800 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/boot_demo1/ccs/.ccsimportspec b/boards/ek-lm4f232/boot_demo1/ccs/.ccsimportspec new file mode 100644 index 0000000..fe6aa3d --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo1/ccs/.ccsproject b/boards/ek-lm4f232/boot_demo1/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo1/ccs/.cproject b/boards/ek-lm4f232/boot_demo1/ccs/.cproject new file mode 100644 index 0000000..58b061d --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/ccs/.cproject @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo1/ccs/.project b/boards/ek-lm4f232/boot_demo1/ccs/.project new file mode 100644 index 0000000..0920ec1 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/ccs/.project @@ -0,0 +1,60 @@ + + + boot_demo1 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + boot_demo1.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/boot_demo1/boot_demo1.c + + + boot_demo1_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/boot_demo1/boot_demo1_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/boot_demo1/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/boot_demo1/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/boot_demo1/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.bin b/boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.bin new file mode 100644 index 0000000..1b0d788 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.bin differ diff --git a/boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.out b/boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.out new file mode 100644 index 0000000..45cbe1e Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/ccs/Debug/boot_demo1.out differ diff --git a/boards/ek-lm4f232/boot_demo1/ccs/macros.ini_initial b/boards/ek-lm4f232/boot_demo1/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/boot_demo1/ccs/target_config.ccxml b/boards/ek-lm4f232/boot_demo1/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.bin b/boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.bin new file mode 100644 index 0000000..c21d2b5 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.bin differ diff --git a/boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.out b/boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.out new file mode 100644 index 0000000..dfd0998 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/ewarm/Exe/boot_demo1.out differ diff --git a/boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.axf b/boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.axf new file mode 100644 index 0000000..ca939c6 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.axf differ diff --git a/boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.bin b/boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.bin new file mode 100644 index 0000000..363e0b0 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/gcc/boot_demo1.bin differ diff --git a/boards/ek-lm4f232/boot_demo1/readme.txt b/boards/ek-lm4f232/boot_demo1/readme.txt new file mode 100644 index 0000000..2150228 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/readme.txt @@ -0,0 +1,48 @@ +Boot Loader Demo 1 + +An example to demonstrate the use of a flash-based boot loader. At +startup, the application will configure the UART and USB peripherals, +and then branch to the boot loader to await the start of an +update. If using the serial boot loader (boot_serial), the UART will +always be configured at 115,200 baud and does not require the use of +auto-bauding. + +This application is intended for use with any of the three flash-based boot +loader flavors (boot_serial or boot_usb) included in the software +release. To accommodate the largest of these (boot_usb), the link address +is set to 0x2800. If you are using serial, you may change this +address to a 1KB boundary higher than the last address occupied +by the boot loader binary as long as you also rebuild the boot +loader itself after modifying its bl_config.h file to set APP_START_ADDRESS +to the same value. + +The boot_demo2 application can be used along with this application to +easily demonstrate that the boot loader is actually updating the on-chip +flash. + +Note that the LM4F232 and other Blizzard-class devices also +support the serial and USB boot loaders in ROM. To make use of this +function, link your application to run at address 0x0000 in flash and enter +the bootloader using the ROM_UpdateSerial and ROM_UpdateUSB functions +(defined in rom.h). This mechanism is used in the utils/swupdate.c +module when built specifically targeting a suitable Blizzard-class device. + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.axf b/boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.axf new file mode 100644 index 0000000..17b69dc Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.axf differ diff --git a/boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.bin b/boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.bin new file mode 100644 index 0000000..65dde5d Binary files /dev/null and b/boards/ek-lm4f232/boot_demo1/rvmdk/boot_demo1.bin differ diff --git a/boards/ek-lm4f232/boot_demo1/startup_ccs.c b/boards/ek-lm4f232/boot_demo1/startup_ccs.c new file mode 100644 index 0000000..cc78bf4 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/startup_ccs.c @@ -0,0 +1,364 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler, // PWM 1 Fault + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // Remote Temperature Sensor 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // Power Regulator Bus 0 + (void (*)(void))0xFF01FF02, // HEADER PREFIX 0 + (void (*)(void))0xFF03FF04, // HEADER PREFIX 1 + (void (*)(void))0xFFFFFFFF, // HEADER IMAGE LEN + (void (*)(void))0xFFFFFFFF, // HEADER CRC32 + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF // HEADER Reserved +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/boot_demo1/startup_ewarm.c b/boards/ek-lm4f232/boot_demo1/startup_ewarm.c new file mode 100644 index 0000000..08bc6bc --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/startup_ewarm.c @@ -0,0 +1,395 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler, // PWM 1 Fault + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // Remote Temperature Sensor 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // Power Regulator Bus 0 + (void (*)(void))0xFF01FF02, // HEADER PREFIX 0 + (void (*)(void))0xFF03FF04, // HEADER PREFIX 1 + (void (*)(void))0xFFFFFFFF, // HEADER IMAGE LEN + (void (*)(void))0xFFFFFFFF, // HEADER CRC32 + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF // HEADER Reserved +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/boot_demo1/startup_gcc.c b/boards/ek-lm4f232/boot_demo1/startup_gcc.c new file mode 100644 index 0000000..f3c14cf --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/startup_gcc.c @@ -0,0 +1,411 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler, // PWM 1 Fault + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // Remote Temperature Sensor 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // Power Regulator Bus 0 + (void (*)(void))0xFF01FF02, // HEADER PREFIX 0 + (void (*)(void))0xFF03FF04, // HEADER PREFIX 1 + (void (*)(void))0xFFFFFFFF, // HEADER IMAGE LEN + (void (*)(void))0xFFFFFFFF, // HEADER CRC32 + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF // HEADER Reserved +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/boot_demo1/startup_rvmdk.S b/boards/ek-lm4f232/boot_demo1/startup_rvmdk.S new file mode 100644 index 0000000..729d4ec --- /dev/null +++ b/boards/ek-lm4f232/boot_demo1/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + DCD 0xFF01FF02 ; HEADER PREFIX 0 + DCD 0xFF03FF04 ; HEADER PREFIX 1 + DCD 0xFFFFFFFF ; HEADER IMAGE LEN + DCD 0xFFFFFFFF ; HEADER CRC32 + DCD 0xFFFFFFFF ; HEADER Reserved + DCD 0xFFFFFFFF ; HEADER Reserved + DCD 0xFFFFFFFF ; HEADER Reserved + DCD 0xFFFFFFFF ; HEADER Reserved + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/boot_demo2/Makefile b/boards/ek-lm4f232/boot_demo2/Makefile new file mode 100644 index 0000000..3c86cfa --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/Makefile @@ -0,0 +1,93 @@ +#****************************************************************************** +# +# Makefile - Rules for building the boot_demo2 example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=. +IPATH+=.. +IPATH+=../../../.. +IPATH+=../../../../third_party/bget +IPATH+=../../../../third_party + +# +# The default rule, which causes the boot_demo2 example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/boot_demo2.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the boot_demo2 example. +# +${COMPILER}/boot_demo2.axf: ${COMPILER}/boot_demo2.o +${COMPILER}/boot_demo2.axf: ${COMPILER}/buttons.o +${COMPILER}/boot_demo2.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/boot_demo2.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/boot_demo2.axf: ${COMPILER}/ustdlib.o +${COMPILER}/boot_demo2.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/boot_demo2.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/boot_demo2.axf: boot_demo2.ld +SCATTERgcc_boot_demo2=boot_demo2.ld +ENTRY_boot_demo2=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.c b/boards/ek-lm4f232/boot_demo2/boot_demo2.c new file mode 100644 index 0000000..35d333c --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.c @@ -0,0 +1,311 @@ +//***************************************************************************** +// +// boot_demo2.c - Second boot loader example. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "inc/hw_memmap.h" +#include "inc/hw_nvic.h" +#include "inc/hw_sysctl.h" +#include "inc/hw_gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/flash.h" +#include "driverlib/uart.h" +#include "driverlib/uart.h" +#include "driverlib/gpio.h" +#include "driverlib/rom.h" +#include "driverlib/sysctl.h" +#include "driverlib/pin_map.h" +#include "utils/ustdlib.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/buttons.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Boot Loader Demo 2 (boot_demo2)

+//! +//! An example to demonstrate the use of a flash-based boot loader. At startup, +//! the application will configure the UART, USB and Ethernet peripherals, wait +//! for a widget on the screen to be pressed, and then branch to the boot +//! loader to await the start of an update. If using the serial boot loader +//! (boot_serial), the UART will always be configured at 115,200 baud and does +//! not require the use of auto-bauding. +//! +//! This application is intended for use with any of the three flash-based boot +//! loader flavors (boot_eth, boot_serial or boot_usb) included in the software +//! release. To accommodate the largest of these (boot_usb), the link address +//! is set to 0x2800. If you are using serial or Ethernet boot loader, you +//! may change this address to a 1KB boundary higher than the last address +//! occupied by the boot loader binary as long as you also rebuild the boot +//! loader itself after modifying its bl_config.h file to set APP_START_ADDRESS +//! to the same value. +//! +//! The boot_demo1 application can be used along with this application to +//! easily demonstrate that the boot loader is actually updating the on-chip +//! flash. +//! +//! Note that the LM4F232 and other Blizzard-class devices also the +//! support serial and USB boot loaders in ROM. To make use of this +//! function, link your application to run at address 0x0000 in flash and enter +//! the bootloader using either the ROM_UpdateUSB or ROM_UpdateSerial +//! functions (defined in rom.h). This mechanism is used in the +//! utils/swupdate.c module when built specifically targeting a suitable +//! Blizzard-class device. +// +//***************************************************************************** + +//***************************************************************************** +// +// The number of SysTick ticks per second. +// +//***************************************************************************** +#define TICKS_PER_SECOND 100 + +//***************************************************************************** +// +// A global we use to keep track of when the user presses the "Update now" +// button. +// +//***************************************************************************** +volatile bool g_bFirmwareUpdate = false; + +//***************************************************************************** +// +// Buffers used to hold the Ethernet MAC and IP addresses for the board. +// +//***************************************************************************** +#define SIZE_MAC_ADDR_BUFFER 32 +#define SIZE_IP_ADDR_BUFFER 32 +int8_t g_pi8MACAddr[SIZE_MAC_ADDR_BUFFER]; +int8_t g_pi8IPAddr[SIZE_IP_ADDR_BUFFER]; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Passes control to the bootloader and initiates a remote software update. +// +// This function passes control to the bootloader and initiates an update of +// the main application firmware image via UART0, Ethernet or USB depending +// upon the specific boot loader binary in use. +// +// \return Never returns. +// +//***************************************************************************** +void +JumpToBootLoader(void) +{ + // + // We must make sure we turn off SysTick and its interrupt before entering + // the boot loader! + // + ROM_SysTickIntDisable(); + ROM_SysTickDisable(); + + // + // Disable all processor interrupts. Instead of disabling them + // one at a time, a direct write to NVIC is done to disable all + // peripheral interrupts. + // + HWREG(NVIC_DIS0) = 0xffffffff; + HWREG(NVIC_DIS1) = 0xffffffff; + + // + // Return control to the boot loader. This is a call to the SVC + // handler in the boot loader. + // + (*((void (*)(void))(*(uint32_t *)0x2c)))(); +} + +//***************************************************************************** +// +// Initialize UART0 and set the appropriate communication parameters. +// +//***************************************************************************** +void +SetupForUART(void) +{ + // + // We need to make sure that UART0 and its associated GPIO port are + // enabled before we pass control to the boot loader. The serial boot + // loader does not enable or configure these peripherals for us if we + // enter it via its SVC vector. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Set GPIO A0 and A1 as UART. + // + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Configure the UART for 115200, n, 8, 1 + // + ROM_UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, + (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | + UART_CONFIG_WLEN_8)); + + // + // Enable the UART operation. + // + ROM_UARTEnable(UART0_BASE); +} + +//***************************************************************************** +// +// Enable the USB controller +// +//***************************************************************************** +void +SetupForUSB(void) +{ + // + // The USB boot loader takes care of all required USB initialization so, + // if the application itself doesn't need to use the USB controller, we + // don't actually need to enable it here. The only requirement imposed by + // the USB boot loader is that the system clock is running from the PLL + // when the boot loader is entered. + // +} + +//***************************************************************************** +// +// A simple application demonstrating use of the boot loader, +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + tContext sContext; + uint32_t ui32SysClock; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the system clock to run at 50MHz from the PLL + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | + SYSCTL_OSC_MAIN); + ui32SysClock = ROM_SysCtlClockGet(); + + // + // Initialize the peripherals that each of the boot loader flavors + // supports. Since this example is intended for use with any of the + // boot loaders and we don't know which is actually in use, we cover all + // bases and initialize for serial, Ethernet and USB use here. + // + SetupForUART(); + SetupForUSB(); + + // + // Initialize the buttons driver. + // + ButtonsInit(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "boot-demo2", -1, + GrContextDpyWidthGet(&sContext) / 2, 4, 0); + + GrStringDrawCentered(&sContext, "Press select", -1, + GrContextDpyWidthGet(&sContext) / 2, 20, false); + GrStringDrawCentered(&sContext, "button to", -1, + GrContextDpyWidthGet(&sContext) / 2, 30, false); + GrStringDrawCentered(&sContext, "update.", -1, + GrContextDpyWidthGet(&sContext) / 2, 40, false); + + // + // Wait for select button to be pressed. + // + while ((ButtonsPoll(0, 0) & SELECT_BUTTON) == 0) + { + ROM_SysCtlDelay(ui32SysClock / 1000); + } + + GrStringDrawCentered(&sContext, " ", -1, + GrContextDpyWidthGet(&sContext) / 2, 20, true); + GrStringDrawCentered(&sContext, " Updating... ", -1, + GrContextDpyWidthGet(&sContext) / 2, 30, true); + GrStringDrawCentered(&sContext, " ", -1, + GrContextDpyWidthGet(&sContext) / 2, 40, true); + + // + // Transfer control to the boot loader. + // + JumpToBootLoader(); + + // + // The previous function never returns but we need to stick in a return + // code here to keep the compiler from generating a warning. + // + return(0); +} diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.ewd b/boards/ek-lm4f232/boot_demo2/boot_demo2.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.ewp b/boards/ek-lm4f232/boot_demo2/boot_demo2.ewp new file mode 100644 index 0000000..cd1a6bc --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.ewp @@ -0,0 +1,804 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\boot_demo2.c + + + $PROJ_DIR$\..\drivers\buttons.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.icf b/boards/ek-lm4f232/boot_demo2/boot_demo2.icf new file mode 100644 index 0000000..3c185e5 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// boot_demo2.icf - Linker configuration file for boot_demo2. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00002800 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.ld b/boards/ek-lm4f232/boot_demo2/boot_demo2.ld new file mode 100644 index 0000000..1c62c76 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * boot_demo2.ld - Linker configuration file for boot_demo2. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00002800, LENGTH = 0x0003d800 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.sct b/boards/ek-lm4f232/boot_demo2/boot_demo2.sct new file mode 100644 index 0000000..97a10ac --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; boot_demo2.sct - Linker configuration file for boot_demo2. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00002800 0x0003d800 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00002800 0x0003d800 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.uvopt b/boards/ek-lm4f232/boot_demo2/boot_demo2.uvopt new file mode 100644 index 0000000..5be2dfe --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.uvopt @@ -0,0 +1,345 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + boot_demo2 + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\boot_demo2.c + boot_demo2.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\buttons.c + buttons.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 4 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 8 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2.uvproj b/boards/ek-lm4f232/boot_demo2/boot_demo2.uvproj new file mode 100644 index 0000000..314333a --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2.uvproj @@ -0,0 +1,444 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + boot_demo2 + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + boot_demo2 + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\boot_demo2.bin .\rvmdk\boot_demo2.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + .;..;..\..\..\..;..\..\..\..\third_party\bget;..\..\..\..\third_party; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + boot_demo2.sct + + + --entry Reset_Handler + + + + + + + + Source + + + boot_demo2.c + 1 + .\boot_demo2.c + + + buttons.c + 1 + ..\drivers\buttons.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/boot_demo2/boot_demo2_ccs.cmd b/boards/ek-lm4f232/boot_demo2/boot_demo2_ccs.cmd new file mode 100644 index 0000000..1a171c2 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/boot_demo2_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * boot_demo2_ccs.cmd - CCS linker configuration file for boot_demo2. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00002800 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x0003d800 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/boot_demo2/ccs/.ccsimportspec b/boards/ek-lm4f232/boot_demo2/ccs/.ccsimportspec new file mode 100644 index 0000000..1a6970a --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo2/ccs/.ccsproject b/boards/ek-lm4f232/boot_demo2/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo2/ccs/.cproject b/boards/ek-lm4f232/boot_demo2/ccs/.cproject new file mode 100644 index 0000000..94735ea --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/ccs/.cproject @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo2/ccs/.project b/boards/ek-lm4f232/boot_demo2/ccs/.project new file mode 100644 index 0000000..7a5dfb3 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/ccs/.project @@ -0,0 +1,65 @@ + + + boot_demo2 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + boot_demo2.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/boot_demo2/boot_demo2.c + + + boot_demo2_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/boot_demo2/boot_demo2_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/boot_demo2/startup_ccs.c + + + drivers/buttons.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/buttons.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/boot_demo2/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/boot_demo2/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.bin b/boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.bin new file mode 100644 index 0000000..b490c71 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.bin differ diff --git a/boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.out b/boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.out new file mode 100644 index 0000000..52e3aad Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/ccs/Debug/boot_demo2.out differ diff --git a/boards/ek-lm4f232/boot_demo2/ccs/macros.ini_initial b/boards/ek-lm4f232/boot_demo2/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/boot_demo2/ccs/target_config.ccxml b/boards/ek-lm4f232/boot_demo2/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.bin b/boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.bin new file mode 100644 index 0000000..cfef7da Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.bin differ diff --git a/boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.out b/boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.out new file mode 100644 index 0000000..47deab8 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/ewarm/Exe/boot_demo2.out differ diff --git a/boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.axf b/boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.axf new file mode 100644 index 0000000..b60b464 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.axf differ diff --git a/boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.bin b/boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.bin new file mode 100644 index 0000000..6203bab Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/gcc/boot_demo2.bin differ diff --git a/boards/ek-lm4f232/boot_demo2/readme.txt b/boards/ek-lm4f232/boot_demo2/readme.txt new file mode 100644 index 0000000..22d00e7 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/readme.txt @@ -0,0 +1,49 @@ +Boot Loader Demo 2 + +An example to demonstrate the use of a flash-based boot loader. At startup, +the application will configure the UART, USB and Ethernet peripherals, wait +for a widget on the screen to be pressed, and then branch to the boot +loader to await the start of an update. If using the serial boot loader +(boot_serial), the UART will always be configured at 115,200 baud and does +not require the use of auto-bauding. + +This application is intended for use with any of the three flash-based boot +loader flavors (boot_eth, boot_serial or boot_usb) included in the software +release. To accommodate the largest of these (boot_usb), the link address +is set to 0x2800. If you are using serial or Ethernet boot loader, you +may change this address to a 1KB boundary higher than the last address +occupied by the boot loader binary as long as you also rebuild the boot +loader itself after modifying its bl_config.h file to set APP_START_ADDRESS +to the same value. + +The boot_demo1 application can be used along with this application to +easily demonstrate that the boot loader is actually updating the on-chip +flash. + +Note that the LM4F232 and other Blizzard-class devices also the +support serial and USB boot loaders in ROM. To make use of this +function, link your application to run at address 0x0000 in flash and enter +the bootloader using either the ROM_UpdateUSB or ROM_UpdateSerial +functions (defined in rom.h). This mechanism is used in the +utils/swupdate.c module when built specifically targeting a suitable +Blizzard-class device. + +------------------------------------------------------------------------------- + +Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.axf b/boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.axf new file mode 100644 index 0000000..13ff729 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.axf differ diff --git a/boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.bin b/boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.bin new file mode 100644 index 0000000..514baf5 Binary files /dev/null and b/boards/ek-lm4f232/boot_demo2/rvmdk/boot_demo2.bin differ diff --git a/boards/ek-lm4f232/boot_demo2/startup_ccs.c b/boards/ek-lm4f232/boot_demo2/startup_ccs.c new file mode 100644 index 0000000..cc78bf4 --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/startup_ccs.c @@ -0,0 +1,364 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler, // PWM 1 Fault + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // Remote Temperature Sensor 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // Power Regulator Bus 0 + (void (*)(void))0xFF01FF02, // HEADER PREFIX 0 + (void (*)(void))0xFF03FF04, // HEADER PREFIX 1 + (void (*)(void))0xFFFFFFFF, // HEADER IMAGE LEN + (void (*)(void))0xFFFFFFFF, // HEADER CRC32 + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF // HEADER Reserved +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/boot_demo2/startup_ewarm.c b/boards/ek-lm4f232/boot_demo2/startup_ewarm.c new file mode 100644 index 0000000..08bc6bc --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/startup_ewarm.c @@ -0,0 +1,395 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler, // PWM 1 Fault + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // Remote Temperature Sensor 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // Power Regulator Bus 0 + (void (*)(void))0xFF01FF02, // HEADER PREFIX 0 + (void (*)(void))0xFF03FF04, // HEADER PREFIX 1 + (void (*)(void))0xFFFFFFFF, // HEADER IMAGE LEN + (void (*)(void))0xFFFFFFFF, // HEADER CRC32 + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF // HEADER Reserved +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/boot_demo2/startup_gcc.c b/boards/ek-lm4f232/boot_demo2/startup_gcc.c new file mode 100644 index 0000000..f3c14cf --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/startup_gcc.c @@ -0,0 +1,411 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler, // PWM 1 Fault + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C6 Master and Slave + IntDefaultHandler, // I2C7 Master and Slave + IntDefaultHandler, // HIM Scan Matrix Keyboard 0 + IntDefaultHandler, // One Wire 0 + IntDefaultHandler, // Remote Temperature Sensor 0 + IntDefaultHandler, // HIM PS/2 0 + IntDefaultHandler, // HIM LED Sequencer 0 + IntDefaultHandler, // HIM Consumer IR 0 + IntDefaultHandler, // Power Regulator Bus 0 + (void (*)(void))0xFF01FF02, // HEADER PREFIX 0 + (void (*)(void))0xFF03FF04, // HEADER PREFIX 1 + (void (*)(void))0xFFFFFFFF, // HEADER IMAGE LEN + (void (*)(void))0xFFFFFFFF, // HEADER CRC32 + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF, // HEADER Reserved + (void (*)(void))0xFFFFFFFF // HEADER Reserved +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/boot_demo2/startup_rvmdk.S b/boards/ek-lm4f232/boot_demo2/startup_rvmdk.S new file mode 100644 index 0000000..729d4ec --- /dev/null +++ b/boards/ek-lm4f232/boot_demo2/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + DCD 0xFF01FF02 ; HEADER PREFIX 0 + DCD 0xFF03FF04 ; HEADER PREFIX 1 + DCD 0xFFFFFFFF ; HEADER IMAGE LEN + DCD 0xFFFFFFFF ; HEADER CRC32 + DCD 0xFFFFFFFF ; HEADER Reserved + DCD 0xFFFFFFFF ; HEADER Reserved + DCD 0xFFFFFFFF ; HEADER Reserved + DCD 0xFFFFFFFF ; HEADER Reserved + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/boot_serial/Makefile b/boards/ek-lm4f232/boot_serial/Makefile new file mode 100644 index 0000000..926dc31 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/Makefile @@ -0,0 +1,98 @@ +#****************************************************************************** +# +# Makefile - Rules for building the Serial Port Boot Loader. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../../../../boot_loader + +# +# Where to find header files that do not live in the source directory. +# +IPATH=. +IPATH+=../../../.. +IPATH+=../../../../boot_loader + +# +# The default rule, which causes the Serial Port Boot Loader to be built. +# +all: ${COMPILER} +all: ${COMPILER}/boot_serial.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the Serial Port Boot Loader. +# +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_autobaud.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_can.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_check.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_crc32.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_decrypt.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_emac.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_flash.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_i2c.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_main.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_packet.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_ssi.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_startup_${COMPILER}.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_uart.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_usb.o +${COMPILER}/boot_serial.axf: ${COMPILER}/bl_usbfuncs.o +${COMPILER}/boot_serial.axf: ../../../../boot_loader/bl_link.ld +SCATTERgcc_boot_serial=../../../../boot_loader/bl_link.ld +ENTRY_boot_serial=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/boot_serial/bl_config.h b/boards/ek-lm4f232/boot_serial/bl_config.h new file mode 100644 index 0000000..fb98252 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/bl_config.h @@ -0,0 +1,1137 @@ +//***************************************************************************** +// +// bl_config.h - The configurable parameters of the boot loader. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __BL_CONFIG_H__ +#define __BL_CONFIG_H__ + +//***************************************************************************** +// +// The following defines are used to configure the operation of the boot +// loader. For each define, its interactions with other defines are described. +// First is the dependencies (in other words, the defines that must also be +// defined if it is defined), next are the exclusives (in other words, the +// defines that can not be defined if it is defined), and finally are the +// requirements (in other words, the defines that must be defined if it is +// defined). +// +// The following defines must be defined in order for the boot loader to +// operate: +// +// One of CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// SSI_ENABLE_UPDATE, UART_ENABLE_UPDATE, or USB_ENABLE_UPDATE +// APP_START_ADDRESS +// VTABLE_START_ADDRESS +// FLASH_PAGE_SIZE +// STACK_SIZE +// +//***************************************************************************** + +//***************************************************************************** +// +// The frequency of the crystal used to clock the microcontroller. +// +// This defines the crystal frequency used by the microcontroller running the +// boot loader. If this is unknown at the time of production, then use the +// UART_AUTOBAUD feature to properly configure the UART. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define CRYSTAL_FREQ 16000000 + +//***************************************************************************** +// +// The starting address of the application. This must be a multiple of 1024 +// bytes (making it aligned to a page boundary). A vector table is expected at +// this location, and the perceived validity of the vector table (stack located +// in SRAM, reset vector located in flash) is used as an indication of the +// validity of the application image. +// +// The flash image of the boot loader must not be larger than this value. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define APP_START_ADDRESS 0x2800 + +//***************************************************************************** +// +// The address at which the application locates its exception vector table. +// This must be a multiple of 1024 bytes (making it aligned to a page +// boundary). Typically, an application will start with its vector table and +// this value should be set to APP_START_ADDRESS. This option is provided to +// cater for applications which run from external memory which may not be +// accessible by the NVIC (the vector table offset register is only 30 bits +// long). +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define VTABLE_START_ADDRESS 0x2800 + +//***************************************************************************** +// +// The size of a single, erasable page in the flash. This must be a power +// of 2. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define FLASH_PAGE_SIZE 0x00000400 + +//***************************************************************************** +// +// The amount of space at the end of flash to reserved. This must be a +// multiple of 1024 bytes (making it aligned to a page boundary). This +// reserved space is not erased when the application is updated, providing +// non-volatile storage that can be used for parameters. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define FLASH_RSVD_SPACE 0x00000800 + +//***************************************************************************** +// +// The number of words of stack space to reserve for the boot loader. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define STACK_SIZE 48 + +//***************************************************************************** +// +// The number of words in the data buffer used for receiving packets. This +// value must be at least 3. If using auto-baud on the UART, this must be at +// least 20. The maximum usable value is 65 (larger values will result in +// unused space in the buffer). +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define BUFFER_SIZE 20 + +//***************************************************************************** +// +// Enables updates to the boot loader. Updating the boot loader is an unsafe +// operation since it is not fully fault tolerant (losing power to the device +// part way though could result in the boot loader no longer being present in +// flash). +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENABLE_BL_UPDATE + +//***************************************************************************** +// +// Enables runtime and download CRC32 checking of the main firmware image. +// If this is defined, the boot loader will scan the main firmware image for +// an image information header (stored immediately above the vector table and +// marked by the words 0xFF01FF02 and 0xFF03FF04). If the header is found and +// the CRC32 value it contains matches that calculated for the image, the +// firmware is run. If the CRC32 does not match or the image information +// is not found, the boot loader retains control and waits for a new download. +// To aid debugging, if this option is used without ENFORCE_CRC being set, the +// image will also be booted if the header is present but the length field is +// set to 0xFFFFFFFF, typically indicating that the firmware file has not been +// run through the post-processing tool which inserts the length and CRC values. +// +// Note that firmware images intended for use with CRC checking must have been +// built with an 8 word image header appended to the top of the vector table +// and the binary must have been processed by a tool such as tools/binpack.exe +// to ensure that the required length (3rd word) and CRC32 (4th word) fields +// are populated in the header. +// +// Depends on: ENFORCE_CRC +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CHECK_CRC + +//***************************************************************************** +// +// This definition may be used alongside CHECK_CRC to remove the debug behavior +// which will allow an image with an uninitialized header to be run. With +// ENFORCE_CRC defined firmware images will only be booted if they contain a +// valid image information header and if the embedded CRC32 in that header +// matches the calculated value. +// +// Depends on: None +// Exclusive of: None +// Requires: CHECK_CRC +// +//***************************************************************************** +//#define ENFORCE_CRC + +//***************************************************************************** +// +// This definition will cause the the boot loader to erase the entire flash on +// updates to the boot loader or to erase the entire application area when the +// application is updated. This erases any unused sections in the flash before +// the firmware is updated. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define FLASH_CODE_PROTECTION + +//***************************************************************************** +// +// Enables the call to decrypt the downloaded data before writing it into +// flash. The decryption routine is empty in the reference boot loader source, +// which simply provides a placeholder for adding an actual decryption +// algorithm. Although this option is retained for backwards compatibility, it +// is recommended that a decryption function be specified using the newer hook +// function mechanism and BL_DECRYPT_FN_HOOK instead. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENABLE_DECRYPTION + +//***************************************************************************** +// +// Enables support for the MOSCFAIL handler in the NMI interrupt. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENABLE_MOSCFAIL_HANDLER + +//***************************************************************************** +// +// Enables the pin-based forced update check. When enabled, the boot loader +// will go into update mode instead of calling the application if a pin is read +// at a particular polarity, forcing an update operation. In either case, the +// application is still able to return control to the boot loader in order to +// start an update. For applications which need to perform more complex +// checking than is possible using a single GPIO, a hook function may be +// provided using BL_CHECK_UPDATE_FN_HOOK instead. +// +// Depends on: None +// Exclusive of: None +// Requires: FORCED_UPDATE_PERIPH, FORCED_UPDATE_PORT, FORCED_UPDATE_PIN, +// FORCED_UPDATE_POLARITY +// +//***************************************************************************** +//#define ENABLE_UPDATE_CHECK + +//***************************************************************************** +// +// The GPIO module to enable in order to check for a forced update. This will +// be one of the SYSCTL_RCGC2_GPIOx values, where "x" is replaced with the port +// name (such as B). The value of "x" should match the value of "x" for +// FORCED_UPDATE_PORT. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_PERIPH SYSCTL_RCGC2_GPIOB + +//***************************************************************************** +// +// The GPIO port to check for a forced update. This will be one of the +// GPIO_PORTx_BASE values, where "x" is replaced with the port name (such as +// B). The value of "x" should match the value of "x" for +// FORCED_UPDATE_PERIPH. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_PORT GPIO_PORTB_BASE + +//***************************************************************************** +// +// The pin to check for a forced update. This is a value between 0 and 7. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_PIN 4 + +//***************************************************************************** +// +// The polarity of the GPIO pin that results in a forced update. This value +// should be 0 if the pin should be low and 1 if the pin should be high. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_POLARITY 0 + +//***************************************************************************** +// +// This enables a weak pull-up or pull-down for the GPIO pin used in a forced +// update. Only one of FORCED_UPDATE_WPU or FORCED_UPDATE_WPD should be +// defined, or neither if a weak pull-up or pull-down is not required. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_WPU +//#define FORCED_UPDATE_WPD + +//***************************************************************************** +// +// This enables the use of the GPIO_LOCK mechanism for configuration of +// protected GPIO pins (for example JTAG pins). If this value is not defined, +// the locking mechanism will not be used. The only legal values for this +// feature are GPIO_LOCK_KEY for Fury devices and GPIO_LOCK_KEY_DD for all +// other devices except Sandstorm devices, which do not support this feature. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_KEY GPIO_LOCK_KEY +//#define FORCED_UPDATE_KEY GPIO_LOCK_KEY_DD + +//***************************************************************************** +// +// Selects the UART as the port for communicating with the boot loader. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// SSI_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: UART_AUTOBAUD or UART_FIXED_BAUDRATE, BUFFER_SIZE +// +//***************************************************************************** +#define UART_ENABLE_UPDATE + +//***************************************************************************** +// +// Enables automatic baud rate detection. This can be used if the crystal +// frequency is unknown, or if operation at different baud rates is desired. +// +// Depends on: UART_ENABLE_UPDATE +// Exclusive of: UART_FIXED_BAUDRATE +// Requires: None +// +//***************************************************************************** +//#define UART_AUTOBAUD + +//***************************************************************************** +// +// Selects the baud rate to be used for the UART. +// +// Depends on: UART_ENABLE_UPDATE, CRYSTAL_FREQ +// Exclusive of: UART_AUTOBAUD +// Requires: None +// +//***************************************************************************** +#define UART_FIXED_BAUDRATE 115200 + +//***************************************************************************** +// +// Selects the SSI port as the port for communicating with the boot loader. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: BUFFER_SIZE +// +//***************************************************************************** +//#define SSI_ENABLE_UPDATE + +//***************************************************************************** +// +// Selects the I2C port as the port for communicating with the boot loader. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, SSI_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: I2C_SLAVE_ADDR, BUFFER_SIZE +// +//***************************************************************************** +//#define I2C_ENABLE_UPDATE + +//***************************************************************************** +// +// Specifies the I2C address of the boot loader. +// +// Depends on: I2C_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define I2C_SLAVE_ADDR 0x42 + +//***************************************************************************** +// +// Selects Ethernet update via the BOOTP/TFTP protocol. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, I2C_ENABLE_UPDATE, SSI_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: CRYSTAL_FREQ +// +//***************************************************************************** +//#define ENET_ENABLE_UPDATE + +//***************************************************************************** +// +// Enables the use of the Ethernet status LED outputs to indicate traffic and +// connection status. +// +// Depends on: ENET_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENET_ENABLE_LEDS + +//***************************************************************************** +// +// Specifies the hard coded MAC address for the Ethernet interface. There are +// six individual values (ENET_MAC_ADDR0 through ENET_MAC_ADDR5) that provide +// the six bytes of the MAC address, where ENET_MAC_ADDR0 though ENET_MAC_ADDR2 +// provide the organizationally unique identifier (OUI) and ENET_MAC_ADDR3 +// through ENET_MAC_ADDR5 provide the extension identifier. If these values +// are not provided, the MAC address will be extracted from the user registers. +// +// Depends on: ENET_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENET_MAC_ADDR0 0x00 +//#define ENET_MAC_ADDR1 0x00 +//#define ENET_MAC_ADDR2 0x00 +//#define ENET_MAC_ADDR3 0x00 +//#define ENET_MAC_ADDR4 0x00 +//#define ENET_MAC_ADDR5 0x00 + +//***************************************************************************** +// +// Specifies the name of the BOOTP server from which to request information. +// The use of this specifier allows a board-specific BOOTP server to co-exist +// on a network with the DHCP server that may be part of the network +// infrastructure. The BOOTP server provided by Texas Instruments requires +// that this be set to "stellaris". +// +// Depends on: ENET_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENET_BOOTP_SERVER "stellaris" + +//***************************************************************************** +// +// Selects USB update via Device Firmware Update class. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// SSI_ENABLE_UPDATE, UART_ENABLE_UPDATE, +// Requires: CRYSTAL_FREQ, USB_VENDOR_ID, USB_PRODUCT_ID, USB_DEVICE_ID, +// USB_MAX_POWER +// +//***************************************************************************** +//#define USB_ENABLE_UPDATE + +//***************************************************************************** +// +// The USB vendor ID published by the DFU device. This value is the TI +// Tiva vendor ID. Change this to the vendor ID you have been assigned by the +// USB-IF. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_VENDOR_ID 0x1cbe + +//***************************************************************************** +// +// The USB device ID published by the DFU device. If you are using your own +// vendor ID, chose a device ID that is different from the ID you use in +// non-update operation. If you have sublicensed TI's vendor ID, you must +// use an assigned product ID here. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_PRODUCT_ID 0x00ff + +//***************************************************************************** +// +// Selects the BCD USB device release number published in the device +// descriptor. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_DEVICE_ID 0x0001 + +//***************************************************************************** +// +// Sets the maximum power consumption that the DFU device will report to the +// USB host in the configuration descriptor. Units are milliamps. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MAX_POWER 150 + +//***************************************************************************** +// +// Specifies whether the DFU device reports to the host that it is self-powered +// (defined as 0) or bus-powered (defined as 1). +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_BUS_POWERED 1 + +//***************************************************************************** +// +// Specifies whether the target board uses a multiplexer to select between USB +// host and device modes. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_MUX_PERIPH, USB_MUX_PORT, USB_MUX_PIN, USB_MUX_DEVICE +// +//***************************************************************************** +//#define USB_HAS_MUX + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used to select +// between USB host and device modes. The value is of the form +// SYSCTL_RCGC2_GPIOx, where GPIOx represents the required GPIO port. +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_PERIPH SYSCTL_RCGC2_GPIOH + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used to select between +// USB host and device modes. The value is of the form GPIO_PORTx_BASE, where +// PORTx represents the required GPIO port. +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_PORT GPIO_PORTH_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used to select between USB host and device +// modes. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_PIN 2 + +//***************************************************************************** +// +// Specifies the state of the GPIO pin required to select USB device-mode +// operation. Valid values are 0 (low) or 1 (high). +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_DEVICE 1 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for VBUS. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_VBUS_PERIPH, USB_VBUS_PORT, USB_VBUS_PIN +// +//***************************************************************************** +//#define USB_VBUS_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for VBUS. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_VBUS_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_VBUS_PERIPH SYSCTL_RCGCGPIO_R1 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for VBUS. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_VBUS_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_VBUS_PORT GPIO_PORTB_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for VBUS. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_VBUS_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_VBUS_PIN 1 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for ID. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_ID_PERIPH, USB_ID_PORT, USB_ID_PIN +// +//***************************************************************************** +//#define USB_ID_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for ID. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_ID_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_ID_PERIPH SYSCTL_RCGCGPIO_R1 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for ID. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_ID_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_ID_PORT GPIO_PORTB_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for ID. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_ID_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_ID_PIN 0 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for DP. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_DP_PERIPH, USB_DP_PORT, USB_DP_PIN +// +//***************************************************************************** +//#define USB_DP_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for DP. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_DP_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_DP_PERIPH SYSCTL_RCGCGPIO_R10 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for DP. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_DP_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_DP_PORT GPIO_PORTL_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for DP. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_DP_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_DP_PIN 6 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for DM. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_DM_PERIPH, USB_DM_PORT, USB_DM_PIN +// +//***************************************************************************** +//#define USB_DM_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for DM. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_DM_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_DM_PERIPH SYSCTL_RCGCGPIO_R10 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for DM. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_DM_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_DM_PORT GPIO_PORTL_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for DM. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_DM_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_DM_PIN 7 + +//***************************************************************************** +// +// Selects an update via the CAN port. +// +// Depends on: None +// Exclusive of: ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, SSI_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: CAN_RX_PERIPH, CAN_RX_PORT, CAN_RX_PIN, CAN_TX_PERIPH, +// CAN_TX_PORT, CAN_TX_PIN, CAN_BIT_RATE, CRYSTAL_FREQ. +// +//***************************************************************************** +//#define CAN_ENABLE_UPDATE + +//***************************************************************************** +// +// Enables the UART to CAN bridging for use when the CAN port is selected for +// communicating with the boot loader. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_UART_BRIDGE + +//***************************************************************************** +// +// The GPIO module to enable in order to configure the CAN0 Rx pin. This will +// be one of the SYSCTL_RCGC2_GPIOx values, where "x" is replaced with the port +// name (such as B). The value of "x" should match the value of "x" for +// CAN_RX_PORT. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_RX_PERIPH SYSCTL_RCGC2_GPIOA + +//***************************************************************************** +// +// The GPIO port used to configure the CAN0 Rx pin. This will be one of the +// GPIO_PORTx_BASE values, where "x" is replaced with the port name (such as +// B). The value of "x" should match the value of "x" for CAN_RX_PERIPH. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_RX_PORT GPIO_PORTA_BASE + +//***************************************************************************** +// +// The GPIO pin that is shared with the CAN0 Rx pin. This is a value between 0 +// and 7. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_RX_PIN 4 + +//***************************************************************************** +// +// The GPIO module to enable in order to configure the CAN0 Tx pin. This will +// be one of the SYSCTL_RCGC2_GPIOx values, where "x" is replaced with the port +// name (such as B). The value of "x" should match the value of "x" for +// CAN_TX_PORT. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_TX_PERIPH SYSCTL_RCGC2_GPIOA + +//***************************************************************************** +// +// The GPIO port used to configure the CAN0 Tx pin. This will be one of the +// GPIO_PORTx_BASE values, where "x" is replaced with the port name (such as +// B). The value of "x" should match the value of "x" for CAN_TX_PERIPH. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_TX_PORT GPIO_PORTA_BASE + +//***************************************************************************** +// +// The GPIO pin that is shared with the CAN0 Tx pin. This is a value between 0 +// and 7. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_TX_PIN 5 + +//***************************************************************************** +// +// The bit rate used on the CAN bus. This must be one of 20000, 50000, 125000, +// 250000, 500000, or 1000000. The CAN bit rate must be less than or equal to +// the crystal frequency divided by 8 (CRYSTAL_FREQ / 8). +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_BIT_RATE 1000000 + +//***************************************************************************** +// +// Performs application-specific low level hardware initialization on system +// reset. If hooked, this function will be called immediately after the boot +// loader code relocation completes. An application may perform any required +// low-level hardware initialization during this function. Note that the +// system clock has not been set when this function is called. Initialization +// that assumes the system clock is set may be performed in the BL_INIT_FN_HOOK +// function instead. +// +// void MyHwInitFunc(void); +// +//***************************************************************************** +//#define BL_HW_INIT_FN_HOOK MyHwInitFunc + +//***************************************************************************** +// +// Performs application-specific initialization on system reset. If hooked, +// this function will be called during boot loader initialization to perform +// any board- or application-specific initialization which is required. The +// function is called following a reset immediately after the selected boot +// loader peripheral has been configured and the system clock has been set. +// +// void MyInitFunc(void); +// +//***************************************************************************** +//#define BL_INIT_FN_HOOK MyInitFunc + +//***************************************************************************** +// +// Performs application-specific reinitialization on boot loader entry via SVC. +// If hooked, this function will be called during boot loader reinitialization +// to perform any board- or application-specific initialization which is +// required. The function is called following boot loader entry from an +// application, after any system clock rate adjustments have been made. +// +// void MyReinitFunc(void); +// +//***************************************************************************** +//#define BL_REINIT_FN_HOOK MyReinitFunc + +//***************************************************************************** +// +// Informs an application that a download is starting. If hooked, this +// function will be called when a firmware download is about to begin. The +// function is called after the first data packet of the download is received +// but before it has been written to flash. +// +// void MyStartFunc(void); +// +//***************************************************************************** +//#define BL_START_FN_HOOK MyStartFunc + +//***************************************************************************** +// +// Informs an application of download progress. If hooked, this function will +// be called periodically during a firmware download to provide progress +// information. The function is called after each data packet is received from +// the host. Parameters provide the number of bytes of data received and, in +// cases other than Ethernet update, the expected total number of bytes in the +// download (the TFTP protocol used by the Ethernet boot loader does not send +// the final image size before the download starts so in this case the ulTotal +// parameter is set to 0 to indicate that the size is unknown). +// +// void MyProgressFunc(unsigned long ulCompleted, unsigned long ulTotal); +// +//***************************************************************************** +//#define BL_PROGRESS_FN_HOOK MyProgressFunc + +//***************************************************************************** +// +// Informs an application that a download has completed. If hooked, this +// function will be called when a firmware download has just completed. The +// function is called after the final data packet of the download has been +// written to flash. +// +// void MyEndFunc(void); +// +//***************************************************************************** +//#define BL_END_FN_HOOK MyEndFunc + +//***************************************************************************** +// +// Allows an application to perform in-place data decryption during download. +// If hooked, this function will be called to perform in-place decryption of +// each data packet received during a firmware download. +// +// void MyDecryptionFunc(unsigned char *pucBuffer, unsigned long ulSize); +// +// This value takes precedence over ENABLE_DECRYPTION. If both are defined, +// the hook function defined using BL_DECRYPT_FN_HOOK is called rather than the +// previously-defined DecryptData() stub function. +// +//***************************************************************************** +//#define BL_DECRYPT_FN_HOOK MyDecryptionFunc + +//***************************************************************************** +// +// Allows an application to force a new firmware download. If hooked, this +// function will be called during boot loader initialization to determine +// whether a firmware update should be performed regardless of whether a valid +// main code image is already present. If the function returns 0, the existing +// main code image is booted (if present), otherwise the boot loader will wait +// for a new firmware image to be downloaded. +// +// unsigned long MyCheckUpdateFunc(void); +// +// This value takes precedence over ENABLE_UPDATE_CHECK} if both are defined. +// If you wish to perform a GPIO check in addition to any other update check +// processing required, the GPIO code must be included within the hook function +// itself. +// +//***************************************************************************** +//#define BL_CHECK_UPDATE_FN_HOOK MyCheckUpdateFunc + +//***************************************************************************** +// +// Allows an application to replace the flash block erase function. If hooked, +// this function will be called whenever a block of flash is to be erased. The +// function must erase the block and wait until the operation has completed. +// The size of the block which will be erased is defined by FLASH_BLOCK_SIZE. +// +// void MyFlashEraseFunc(unsigned long ulBlockAddr); +// +//***************************************************************************** +//#define BL_FLASH_ERASE_FN_HOOK MyFlashEraseFunc + +//***************************************************************************** +// +// Allows an application to replace the flash programming function. If hooked, +// this function will be called to program the flash with firmware image data +// received during download operations. The function must program the supplied +// data and wait until the operation has completed. +// +// void MyFlashProgramFunc(unsigned long ulDstAddr, +// unsigned char *pucSrcData, +// unsigned long ulLength); +// +//***************************************************************************** +//#define BL_FLASH_PROGRAM_FN_HOOK MyFlashProgramFunc + +//***************************************************************************** +// +// Allows an application to replace the flash error clear function. If hooked, +// this function must clear any flash error indicators and prepare to detect +// access violations that may occur in a future erase or program operations. +// +// void MyFlashClearErrorFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_CL_ERR_FN_HOOK MyFlashClearErrorFunc + +//***************************************************************************** +// +// Reports whether or not a flash access violation error has occurred. If +// hooked, this function will be called after flash erase or program +// operations. The return code indicates whether or not an access violation +// error occurred since the last call to the function defined by +// BL_FLASH_CL_ERR_FN_HOOK, with 0 indicating no errors and non-zero indicating +// an error. +// +// unsigned long MyFlashErrorFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_ERROR_FN_HOOK MyFlashErrorFunc + +//***************************************************************************** +// +// Reports the total size of the device flash. If hooked, this function will +// be called to determine the size of the supported flash device. The return +// code is the number of bytes of flash in the device. Note that this does not +// take into account any reserved space defined via the FLASH_RSVD_SPACE value. +// +// unsigned long MyFlashSizeFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_SIZE_FN_HOOK MyFlashSizeFunc + +//***************************************************************************** +// +// Reports the address of the first byte after the end of the device flash. If +// hooked, this function will be called to determine the address of the end of +// valid flash. Note that this does not take into account any reserved space +// defined via the FLASH_RSVD_SPACE value. +// +// unsigned long MyFlashEndFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_END_FN_HOOK MyFlashEndFunc + +//***************************************************************************** +// +// Checks whether the start address and size of an image are valid. If hooked, +// this function will be called when a new firmware download is about to start. +// Parameters provided are the requested start address for the new download +// and, when using protocols which transmit the image length in advance, the +// size of the image that is to be downloaded. The return code will be +// non-zero to indicate that the start address is valid and the image will fit +// in the available space, or 0 if either the address is invalid or the image +// is too large for the device. +// +// unsigned long MyFlashAddrCheckFunc(unsigned long ulAddr, +// unsigned long ulSize); +// +//***************************************************************************** +//#define BL_FLASH_AD_CHECK_FN_HOOK MyFlashAddrCheckFunc + +#endif // __BL_CONFIG_H__ diff --git a/boards/ek-lm4f232/boot_serial/boot_serial.ewd b/boards/ek-lm4f232/boot_serial/boot_serial.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/boot_serial.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/boot_serial/boot_serial.ewp b/boards/ek-lm4f232/boot_serial/boot_serial.ewp new file mode 100644 index 0000000..419b347 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/boot_serial.ewp @@ -0,0 +1,821 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Source + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_autobaud.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_can.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_check.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_crc32.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_decrypt.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_emac.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_flash.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_i2c.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_main.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_packet.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_ssi.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_startup_ewarm.S + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_uart.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_usb.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_usbfuncs.c + + + diff --git a/boards/ek-lm4f232/boot_serial/boot_serial.uvopt b/boards/ek-lm4f232/boot_serial/boot_serial.uvopt new file mode 100644 index 0000000..aa8da10 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/boot_serial.uvopt @@ -0,0 +1,450 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + boot_serial + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S2 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_autobaud.c + bl_autobaud.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_can.c + bl_can.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_check.c + bl_check.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_crc32.c + bl_crc32.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_decrypt.c + bl_decrypt.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_emac.c + bl_emac.c + + + 1 + 7 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_flash.c + bl_flash.c + + + 1 + 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_i2c.c + bl_i2c.c + + + 1 + 9 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_main.c + bl_main.c + + + 1 + 10 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_packet.c + bl_packet.c + + + 1 + 11 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_ssi.c + bl_ssi.c + + + 1 + 12 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_startup_rvmdk.S + bl_startup_rvmdk.S + + + 1 + 13 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_uart.c + bl_uart.c + + + 1 + 14 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_usb.c + bl_usb.c + + + 1 + 15 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_usbfuncs.c + bl_usbfuncs.c + + + + + Documentation + 1 + 0 + 0 + + 2 + 16 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + ..\..\..\..\boot_loader\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + ..\..\..\..\boot_loader\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/boot_serial/boot_serial.uvproj b/boards/ek-lm4f232/boot_serial/boot_serial.uvproj new file mode 100644 index 0000000..b131ea3 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/boot_serial.uvproj @@ -0,0 +1,479 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + boot_serial + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(16000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + boot_serial + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + armcc --device DLM -I . -E -o bl_config.inc ..\..\..\..\boot_loader\bl_config.c + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\boot_serial.bin .\rvmdk\boot_serial.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + .;..\..\..\..;..\..\..\..\boot_loader; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + ..\..\..\..\boot_loader\bl_link.sct + + + --entry Reset_Handler + + + + + + + + Source + + + bl_autobaud.c + 1 + ..\..\..\..\boot_loader\bl_autobaud.c + + + bl_can.c + 1 + ..\..\..\..\boot_loader\bl_can.c + + + bl_check.c + 1 + ..\..\..\..\boot_loader\bl_check.c + + + bl_crc32.c + 1 + ..\..\..\..\boot_loader\bl_crc32.c + + + bl_decrypt.c + 1 + ..\..\..\..\boot_loader\bl_decrypt.c + + + bl_emac.c + 1 + ..\..\..\..\boot_loader\bl_emac.c + + + bl_flash.c + 1 + ..\..\..\..\boot_loader\bl_flash.c + + + bl_i2c.c + 1 + ..\..\..\..\boot_loader\bl_i2c.c + + + bl_main.c + 1 + ..\..\..\..\boot_loader\bl_main.c + + + bl_packet.c + 1 + ..\..\..\..\boot_loader\bl_packet.c + + + bl_ssi.c + 1 + ..\..\..\..\boot_loader\bl_ssi.c + + + bl_startup_rvmdk.S + 2 + ..\..\..\..\boot_loader\bl_startup_rvmdk.S + + + bl_uart.c + 1 + ..\..\..\..\boot_loader\bl_uart.c + + + bl_usb.c + 1 + ..\..\..\..\boot_loader\bl_usb.c + + + bl_usbfuncs.c + 1 + ..\..\..\..\boot_loader\bl_usbfuncs.c + + + + + Documentation + + + readme.txt + 5 + ..\..\..\..\boot_loader\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/boot_serial/ccs/.ccsimportspec b/boards/ek-lm4f232/boot_serial/ccs/.ccsimportspec new file mode 100644 index 0000000..34afca1 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/ccs/.ccsimportspec @@ -0,0 +1,6 @@ + + + + + + diff --git a/boards/ek-lm4f232/boot_serial/ccs/.ccsproject b/boards/ek-lm4f232/boot_serial/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_serial/ccs/.cproject b/boards/ek-lm4f232/boot_serial/ccs/.cproject new file mode 100644 index 0000000..26adde6 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_serial/ccs/.project b/boards/ek-lm4f232/boot_serial/ccs/.project new file mode 100644 index 0000000..6f5cb26 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/ccs/.project @@ -0,0 +1,115 @@ + + + boot_serial + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + boot_loader/bl_autobaud.c + 1 + SW_ROOT/boot_loader/bl_autobaud.c + + + boot_loader/bl_can.c + 1 + SW_ROOT/boot_loader/bl_can.c + + + boot_loader/bl_check.c + 1 + SW_ROOT/boot_loader/bl_check.c + + + boot_loader/bl_crc32.c + 1 + SW_ROOT/boot_loader/bl_crc32.c + + + boot_loader/bl_decrypt.c + 1 + SW_ROOT/boot_loader/bl_decrypt.c + + + boot_loader/bl_emac.c + 1 + SW_ROOT/boot_loader/bl_emac.c + + + boot_loader/bl_flash.c + 1 + SW_ROOT/boot_loader/bl_flash.c + + + boot_loader/bl_i2c.c + 1 + SW_ROOT/boot_loader/bl_i2c.c + + + boot_loader/bl_link_ccs.cmd + 1 + SW_ROOT/boot_loader/bl_link_ccs.cmd + + + boot_loader/bl_main.c + 1 + SW_ROOT/boot_loader/bl_main.c + + + boot_loader/bl_packet.c + 1 + SW_ROOT/boot_loader/bl_packet.c + + + boot_loader/bl_ssi.c + 1 + SW_ROOT/boot_loader/bl_ssi.c + + + boot_loader/bl_startup_ccs.s + 1 + SW_ROOT/boot_loader/bl_startup_ccs.s + + + boot_loader/bl_uart.c + 1 + SW_ROOT/boot_loader/bl_uart.c + + + boot_loader/bl_usb.c + 1 + SW_ROOT/boot_loader/bl_usb.c + + + boot_loader/bl_usbfuncs.c + 1 + SW_ROOT/boot_loader/bl_usbfuncs.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/boot_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/boot_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.bin b/boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.bin new file mode 100644 index 0000000..4e706c3 Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.bin differ diff --git a/boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.out b/boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.out new file mode 100644 index 0000000..38b8037 Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/ccs/Debug/boot_serial.out differ diff --git a/boards/ek-lm4f232/boot_serial/ccs/macros.ini_initial b/boards/ek-lm4f232/boot_serial/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/boot_serial/ccs/target_config.ccxml b/boards/ek-lm4f232/boot_serial/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/boot_serial/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.bin b/boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.bin new file mode 100644 index 0000000..2b9857b Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.bin differ diff --git a/boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.out b/boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.out new file mode 100644 index 0000000..d406865 Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/ewarm/Exe/boot_serial.out differ diff --git a/boards/ek-lm4f232/boot_serial/gcc/boot_serial.axf b/boards/ek-lm4f232/boot_serial/gcc/boot_serial.axf new file mode 100644 index 0000000..4f0b22d Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/gcc/boot_serial.axf differ diff --git a/boards/ek-lm4f232/boot_serial/gcc/boot_serial.bin b/boards/ek-lm4f232/boot_serial/gcc/boot_serial.bin new file mode 100644 index 0000000..43f1b3e Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/gcc/boot_serial.bin differ diff --git a/boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.axf b/boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.axf new file mode 100644 index 0000000..831cabd Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.axf differ diff --git a/boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.bin b/boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.bin new file mode 100644 index 0000000..16b8bae Binary files /dev/null and b/boards/ek-lm4f232/boot_serial/rvmdk/boot_serial.bin differ diff --git a/boards/ek-lm4f232/boot_usb/Makefile b/boards/ek-lm4f232/boot_usb/Makefile new file mode 100644 index 0000000..f5491e9 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/Makefile @@ -0,0 +1,98 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB Boot Loader. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../../../../boot_loader + +# +# Where to find header files that do not live in the source directory. +# +IPATH=. +IPATH+=../../../.. +IPATH+=../../../../boot_loader + +# +# The default rule, which causes the USB Boot Loader to be built. +# +all: ${COMPILER} +all: ${COMPILER}/boot_usb.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB Boot Loader. +# +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_autobaud.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_can.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_check.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_crc32.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_decrypt.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_emac.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_flash.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_i2c.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_main.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_packet.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_ssi.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_startup_${COMPILER}.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_uart.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_usb.o +${COMPILER}/boot_usb.axf: ${COMPILER}/bl_usbfuncs.o +${COMPILER}/boot_usb.axf: ../../../../boot_loader/bl_link.ld +SCATTERgcc_boot_usb=../../../../boot_loader/bl_link.ld +ENTRY_boot_usb=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/boot_usb/bl_config.h b/boards/ek-lm4f232/boot_usb/bl_config.h new file mode 100644 index 0000000..d9155f5 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/bl_config.h @@ -0,0 +1,1137 @@ +//***************************************************************************** +// +// bl_config.h - The configurable parameters of the boot loader. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __BL_CONFIG_H__ +#define __BL_CONFIG_H__ + +//***************************************************************************** +// +// The following defines are used to configure the operation of the boot +// loader. For each define, its interactions with other defines are described. +// First is the dependencies (in other words, the defines that must also be +// defined if it is defined), next are the exclusives (in other words, the +// defines that can not be defined if it is defined), and finally are the +// requirements (in other words, the defines that must be defined if it is +// defined). +// +// The following defines must be defined in order for the boot loader to +// operate: +// +// One of CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// SSI_ENABLE_UPDATE, UART_ENABLE_UPDATE, or USB_ENABLE_UPDATE +// APP_START_ADDRESS +// VTABLE_START_ADDRESS +// FLASH_PAGE_SIZE +// STACK_SIZE +// +//***************************************************************************** + +//***************************************************************************** +// +// The frequency of the crystal used to clock the microcontroller. +// +// This defines the crystal frequency used by the microcontroller running the +// boot loader. If this is unknown at the time of production, then use the +// UART_AUTOBAUD feature to properly configure the UART. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define CRYSTAL_FREQ 16000000 + +//***************************************************************************** +// +// The starting address of the application. This must be a multiple of 1024 +// bytes (making it aligned to a page boundary). A vector table is expected at +// this location, and the perceived validity of the vector table (stack located +// in SRAM, reset vector located in flash) is used as an indication of the +// validity of the application image. +// +// The flash image of the boot loader must not be larger than this value. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define APP_START_ADDRESS 0x2800 + +//***************************************************************************** +// +// The address at which the application locates its exception vector table. +// This must be a multiple of 1024 bytes (making it aligned to a page +// boundary). Typically, an application will start with its vector table and +// this value should be set to APP_START_ADDRESS. This option is provided to +// cater for applications which run from external memory which may not be +// accessible by the NVIC (the vector table offset register is only 30 bits +// long). +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define VTABLE_START_ADDRESS 0x2800 + +//***************************************************************************** +// +// The size of a single, erasable page in the flash. This must be a power +// of 2. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define FLASH_PAGE_SIZE 0x00000400 + +//***************************************************************************** +// +// The amount of space at the end of flash to reserved. This must be a +// multiple of 1024 bytes (making it aligned to a page boundary). This +// reserved space is not erased when the application is updated, providing +// non-volatile storage that can be used for parameters. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define FLASH_RSVD_SPACE 0x00000800 + +//***************************************************************************** +// +// The number of words of stack space to reserve for the boot loader. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define STACK_SIZE 128 + +//***************************************************************************** +// +// The number of words in the data buffer used for receiving packets. This +// value must be at least 3. If using auto-baud on the UART, this must be at +// least 20. The maximum usable value is 65 (larger values will result in +// unused space in the buffer). +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define BUFFER_SIZE 20 + +//***************************************************************************** +// +// Enables updates to the boot loader. Updating the boot loader is an unsafe +// operation since it is not fully fault tolerant (losing power to the device +// part way though could result in the boot loader no longer being present in +// flash). +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENABLE_BL_UPDATE + +//***************************************************************************** +// +// Enables runtime and download CRC32 checking of the main firmware image. +// If this is defined, the boot loader will scan the main firmware image for +// an image information header (stored immediately above the vector table and +// marked by the words 0xFF01FF02 and 0xFF03FF04). If the header is found and +// the CRC32 value it contains matches that calculated for the image, the +// firmware is run. If the CRC32 does not match or the image information +// is not found, the boot loader retains control and waits for a new download. +// To aid debugging, if this option is used without ENFORCE_CRC being set, the +// image will also be booted if the header is present but the length field is +// set to 0xFFFFFFFF, typically indicating that the firmware file has not been +// run through the post-processing tool which inserts the length and CRC values. +// +// Note that firmware images intended for use with CRC checking must have been +// built with an 8 word image header appended to the top of the vector table +// and the binary must have been processed by a tool such as tools/binpack.exe +// to ensure that the required length (3rd word) and CRC32 (4th word) fields +// are populated in the header. +// +// Depends on: ENFORCE_CRC +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CHECK_CRC + +//***************************************************************************** +// +// This definition may be used alongside CHECK_CRC to remove the debug behavior +// which will allow an image with an uninitialized header to be run. With +// ENFORCE_CRC defined firmware images will only be booted if they contain a +// valid image information header and if the embedded CRC32 in that header +// matches the calculated value. +// +// Depends on: None +// Exclusive of: None +// Requires: CHECK_CRC +// +//***************************************************************************** +//#define ENFORCE_CRC + +//***************************************************************************** +// +// This definition will cause the the boot loader to erase the entire flash on +// updates to the boot loader or to erase the entire application area when the +// application is updated. This erases any unused sections in the flash before +// the firmware is updated. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define FLASH_CODE_PROTECTION + +//***************************************************************************** +// +// Enables the call to decrypt the downloaded data before writing it into +// flash. The decryption routine is empty in the reference boot loader source, +// which simply provides a placeholder for adding an actual decryption +// algorithm. Although this option is retained for backwards compatibility, it +// is recommended that a decryption function be specified using the newer hook +// function mechanism and BL_DECRYPT_FN_HOOK instead. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENABLE_DECRYPTION + +//***************************************************************************** +// +// Enables support for the MOSCFAIL handler in the NMI interrupt. +// +// Depends on: None +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENABLE_MOSCFAIL_HANDLER + +//***************************************************************************** +// +// Enables the pin-based forced update check. When enabled, the boot loader +// will go into update mode instead of calling the application if a pin is read +// at a particular polarity, forcing an update operation. In either case, the +// application is still able to return control to the boot loader in order to +// start an update. For applications which need to perform more complex +// checking than is possible using a single GPIO, a hook function may be +// provided using BL_CHECK_UPDATE_FN_HOOK instead. +// +// Depends on: None +// Exclusive of: None +// Requires: FORCED_UPDATE_PERIPH, FORCED_UPDATE_PORT, FORCED_UPDATE_PIN, +// FORCED_UPDATE_POLARITY +// +//***************************************************************************** +//#define ENABLE_UPDATE_CHECK + +//***************************************************************************** +// +// The GPIO module to enable in order to check for a forced update. This will +// be one of the SYSCTL_RCGC2_GPIOx values, where "x" is replaced with the port +// name (such as B). The value of "x" should match the value of "x" for +// FORCED_UPDATE_PORT. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_PERIPH SYSCTL_RCGC2_GPIOB + +//***************************************************************************** +// +// The GPIO port to check for a forced update. This will be one of the +// GPIO_PORTx_BASE values, where "x" is replaced with the port name (such as +// B). The value of "x" should match the value of "x" for +// FORCED_UPDATE_PERIPH. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_PORT GPIO_PORTB_BASE + +//***************************************************************************** +// +// The pin to check for a forced update. This is a value between 0 and 7. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_PIN 4 + +//***************************************************************************** +// +// The polarity of the GPIO pin that results in a forced update. This value +// should be 0 if the pin should be low and 1 if the pin should be high. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_POLARITY 0 + +//***************************************************************************** +// +// This enables a weak pull-up or pull-down for the GPIO pin used in a forced +// update. Only one of FORCED_UPDATE_WPU or FORCED_UPDATE_WPD should be +// defined, or neither if a weak pull-up or pull-down is not required. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_WPU +//#define FORCED_UPDATE_WPD + +//***************************************************************************** +// +// This enables the use of the GPIO_LOCK mechanism for configuration of +// protected GPIO pins (for example JTAG pins). If this value is not defined, +// the locking mechanism will not be used. The only legal values for this +// feature are GPIO_LOCK_KEY for Fury devices and GPIO_LOCK_KEY_DD for all +// other devices except Sandstorm devices, which do not support this feature. +// +// Depends on: ENABLE_UPDATE_CHECK +// Exclusive of: None +// Requries: None +// +//***************************************************************************** +//#define FORCED_UPDATE_KEY GPIO_LOCK_KEY +//#define FORCED_UPDATE_KEY GPIO_LOCK_KEY_DD + +//***************************************************************************** +// +// Selects the UART as the port for communicating with the boot loader. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// SSI_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: UART_AUTOBAUD or UART_FIXED_BAUDRATE, BUFFER_SIZE +// +//***************************************************************************** +//#define UART_ENABLE_UPDATE + +//***************************************************************************** +// +// Enables automatic baud rate detection. This can be used if the crystal +// frequency is unknown, or if operation at different baud rates is desired. +// +// Depends on: UART_ENABLE_UPDATE +// Exclusive of: UART_FIXED_BAUDRATE +// Requires: None +// +//***************************************************************************** +//#define UART_AUTOBAUD + +//***************************************************************************** +// +// Selects the baud rate to be used for the UART. +// +// Depends on: UART_ENABLE_UPDATE, CRYSTAL_FREQ +// Exclusive of: UART_AUTOBAUD +// Requires: None +// +//***************************************************************************** +//#define UART_FIXED_BAUDRATE 115200 + +//***************************************************************************** +// +// Selects the SSI port as the port for communicating with the boot loader. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: BUFFER_SIZE +// +//***************************************************************************** +//#define SSI_ENABLE_UPDATE + +//***************************************************************************** +// +// Selects the I2C port as the port for communicating with the boot loader. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, SSI_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: I2C_SLAVE_ADDR, BUFFER_SIZE +// +//***************************************************************************** +//#define I2C_ENABLE_UPDATE + +//***************************************************************************** +// +// Specifies the I2C address of the boot loader. +// +// Depends on: I2C_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define I2C_SLAVE_ADDR 0x42 + +//***************************************************************************** +// +// Selects Ethernet update via the BOOTP/TFTP protocol. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, I2C_ENABLE_UPDATE, SSI_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: CRYSTAL_FREQ +// +//***************************************************************************** +//#define ENET_ENABLE_UPDATE + +//***************************************************************************** +// +// Enables the use of the Ethernet status LED outputs to indicate traffic and +// connection status. +// +// Depends on: ENET_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENET_ENABLE_LEDS + +//***************************************************************************** +// +// Specifies the hard coded MAC address for the Ethernet interface. There are +// six individual values (ENET_MAC_ADDR0 through ENET_MAC_ADDR5) that provide +// the six bytes of the MAC address, where ENET_MAC_ADDR0 though ENET_MAC_ADDR2 +// provide the organizationally unique identifier (OUI) and ENET_MAC_ADDR3 +// through ENET_MAC_ADDR5 provide the extension identifier. If these values +// are not provided, the MAC address will be extracted from the user registers. +// +// Depends on: ENET_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENET_MAC_ADDR0 0x00 +//#define ENET_MAC_ADDR1 0x00 +//#define ENET_MAC_ADDR2 0x00 +//#define ENET_MAC_ADDR3 0x00 +//#define ENET_MAC_ADDR4 0x00 +//#define ENET_MAC_ADDR5 0x00 + +//***************************************************************************** +// +// Specifies the name of the BOOTP server from which to request information. +// The use of this specifier allows a board-specific BOOTP server to co-exist +// on a network with the DHCP server that may be part of the network +// infrastructure. The BOOTP server provided by Texas Instruments requires +// that this be set to "stellaris". +// +// Depends on: ENET_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define ENET_BOOTP_SERVER "stellaris" + +//***************************************************************************** +// +// Selects USB update via Device Firmware Update class. +// +// Depends on: None +// Exclusive of: CAN_ENABLE_UPDATE, ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, +// SSI_ENABLE_UPDATE, UART_ENABLE_UPDATE, +// Requires: CRYSTAL_FREQ, USB_VENDOR_ID, USB_PRODUCT_ID, USB_DEVICE_ID, +// USB_MAX_POWER +// +//***************************************************************************** +#define USB_ENABLE_UPDATE + +//***************************************************************************** +// +// The USB vendor ID published by the DFU device. This value is the TI +// Tiva vendor ID. Change this to the vendor ID you have been assigned by the +// USB-IF. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_VENDOR_ID 0x1cbe + +//***************************************************************************** +// +// The USB device ID published by the DFU device. If you are using your own +// vendor ID, chose a device ID that is different from the ID you use in +// non-update operation. If you have sublicensed TI's vendor ID, you must +// use an assigned product ID here. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_PRODUCT_ID 0x00FF + +//***************************************************************************** +// +// Selects the BCD USB device release number published in the device +// descriptor. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_DEVICE_ID 0x0001 + +//***************************************************************************** +// +// Sets the maximum power consumption that the DFU device will report to the +// USB host in the configuration descriptor. Units are milliamps. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_MAX_POWER 150 + +//***************************************************************************** +// +// Specifies whether the DFU device reports to the host that it is self-powered +// (defined as 0) or bus-powered (defined as 1). +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_BUS_POWERED 1 + +//***************************************************************************** +// +// Specifies whether the target board uses a multiplexer to select between USB +// host and device modes. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_MUX_PERIPH, USB_MUX_PORT, USB_MUX_PIN, USB_MUX_DEVICE +// +//***************************************************************************** +//#define USB_HAS_MUX + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used to select +// between USB host and device modes. The value is of the form +// SYSCTL_RCGC2_GPIOx, where GPIOx represents the required GPIO port. +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_PERIPH SYSCTL_RCGC2_GPIOH + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used to select between +// USB host and device modes. The value is of the form GPIO_PORTx_BASE, where +// PORTx represents the required GPIO port. +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_PORT GPIO_PORTH_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used to select between USB host and device +// modes. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_PIN 2 + +//***************************************************************************** +// +// Specifies the state of the GPIO pin required to select USB device-mode +// operation. Valid values are 0 (low) or 1 (high). +// +// Depends on: USB_ENABLE_UPDATE, USB_HAS_MUX +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define USB_MUX_DEVICE 1 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for VBUS. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_VBUS_PERIPH, USB_VBUS_PORT, USB_VBUS_PIN +// +//***************************************************************************** +#define USB_VBUS_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for VBUS. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_VBUS_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_VBUS_PERIPH SYSCTL_RCGCGPIO_R1 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for VBUS. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_VBUS_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_VBUS_PORT GPIO_PORTB_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for VBUS. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_VBUS_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_VBUS_PIN 1 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for ID. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_ID_PERIPH, USB_ID_PORT, USB_ID_PIN +// +//***************************************************************************** +#define USB_ID_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for ID. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_ID_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_ID_PERIPH SYSCTL_RCGCGPIO_R1 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for ID. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_ID_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_ID_PORT GPIO_PORTB_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for ID. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_ID_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_ID_PIN 0 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for DP. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_DP_PERIPH, USB_DP_PORT, USB_DP_PIN +// +//***************************************************************************** +#define USB_DP_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for DP. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_DP_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_DP_PERIPH SYSCTL_RCGCGPIO_R10 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for DP. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_DP_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_DP_PORT GPIO_PORTL_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for DP. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_DP_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_DP_PIN 6 + +//***************************************************************************** +// +// Specifies whether the target board requires configuration of the pin used +// for DM. This applies to Blizzard class and later devices. +// +// Depends on: USB_ENABLE_UPDATE +// Exclusive of: None +// Requires: USB_DM_PERIPH, USB_DM_PORT, USB_DM_PIN +// +//***************************************************************************** +#define USB_DM_CONFIG + +//***************************************************************************** +// +// Specifies the GPIO peripheral containing the pin which is used for DM. +// The value is of the form SYSCTL_RCGCGPIO_Rx, where the Rx represents +// the required GPIO port. This applies to Blizzard class and later +// devices. +// +// Depends on: USB_ENABLE_UPDATE, USB_DM_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_DM_PERIPH SYSCTL_RCGCGPIO_R10 + +//***************************************************************************** +// +// Specifies the GPIO port containing the pin which is used for DM. The value +// is of the form GPIO_PORTx_BASE, where PORTx represents the required GPIO +// port. +// +// Depends on: USB_ENABLE_UPDATE, USB_DM_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_DM_PORT GPIO_PORTL_BASE + +//***************************************************************************** +// +// Specifies the GPIO pin number used for DM. Valid values are 0 through 7. +// +// Depends on: USB_ENABLE_UPDATE, USB_DM_CONFIG +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +#define USB_DM_PIN 7 + +//***************************************************************************** +// +// Selects an update via the CAN port. +// +// Depends on: None +// Exclusive of: ENET_ENABLE_UPDATE, I2C_ENABLE_UPDATE, SSI_ENABLE_UPDATE, +// UART_ENABLE_UPDATE, USB_ENABLE_UPDATE +// Requires: CAN_RX_PERIPH, CAN_RX_PORT, CAN_RX_PIN, CAN_TX_PERIPH, +// CAN_TX_PORT, CAN_TX_PIN, CAN_BIT_RATE, CRYSTAL_FREQ. +// +//***************************************************************************** +//#define CAN_ENABLE_UPDATE + +//***************************************************************************** +// +// Enables the UART to CAN bridging for use when the CAN port is selected for +// communicating with the boot loader. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_UART_BRIDGE + +//***************************************************************************** +// +// The GPIO module to enable in order to configure the CAN0 Rx pin. This will +// be one of the SYSCTL_RCGC2_GPIOx values, where "x" is replaced with the port +// name (such as B). The value of "x" should match the value of "x" for +// CAN_RX_PORT. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_RX_PERIPH SYSCTL_RCGC2_GPIOA + +//***************************************************************************** +// +// The GPIO port used to configure the CAN0 Rx pin. This will be one of the +// GPIO_PORTx_BASE values, where "x" is replaced with the port name (such as +// B). The value of "x" should match the value of "x" for CAN_RX_PERIPH. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_RX_PORT GPIO_PORTA_BASE + +//***************************************************************************** +// +// The GPIO pin that is shared with the CAN0 Rx pin. This is a value between 0 +// and 7. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_RX_PIN 4 + +//***************************************************************************** +// +// The GPIO module to enable in order to configure the CAN0 Tx pin. This will +// be one of the SYSCTL_RCGC2_GPIOx values, where "x" is replaced with the port +// name (such as B). The value of "x" should match the value of "x" for +// CAN_TX_PORT. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_TX_PERIPH SYSCTL_RCGC2_GPIOA + +//***************************************************************************** +// +// The GPIO port used to configure the CAN0 Tx pin. This will be one of the +// GPIO_PORTx_BASE values, where "x" is replaced with the port name (such as +// B). The value of "x" should match the value of "x" for CAN_TX_PERIPH. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_TX_PORT GPIO_PORTA_BASE + +//***************************************************************************** +// +// The GPIO pin that is shared with the CAN0 Tx pin. This is a value between 0 +// and 7. +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_TX_PIN 5 + +//***************************************************************************** +// +// The bit rate used on the CAN bus. This must be one of 20000, 50000, 125000, +// 250000, 500000, or 1000000. The CAN bit rate must be less than or equal to +// the crystal frequency divided by 8 (CRYSTAL_FREQ / 8). +// +// Depends on: CAN_ENABLE_UPDATE +// Exclusive of: None +// Requires: None +// +//***************************************************************************** +//#define CAN_BIT_RATE 1000000 + +//***************************************************************************** +// +// Performs application-specific low level hardware initialization on system +// reset. If hooked, this function will be called immediately after the boot +// loader code relocation completes. An application may perform any required +// low-level hardware initialization during this function. Note that the +// system clock has not been set when this function is called. Initialization +// that assumes the system clock is set may be performed in the BL_INIT_FN_HOOK +// function instead. +// +// void MyHwInitFunc(void); +// +//***************************************************************************** +//#define BL_HW_INIT_FN_HOOK MyHwInitFunc + +//***************************************************************************** +// +// Performs application-specific initialization on system reset. If hooked, +// this function will be called during boot loader initialization to perform +// any board- or application-specific initialization which is required. The +// function is called following a reset immediately after the selected boot +// loader peripheral has been configured and the system clock has been set. +// +// void MyInitFunc(void); +// +//***************************************************************************** +//#define BL_INIT_FN_HOOK MyInitFunc + +//***************************************************************************** +// +// Performs application-specific reinitialization on boot loader entry via SVC. +// If hooked, this function will be called during boot loader reinitialization +// to perform any board- or application-specific initialization which is +// required. The function is called following boot loader entry from an +// application, after any system clock rate adjustments have been made. +// +// void MyReinitFunc(void); +// +//***************************************************************************** +//#define BL_REINIT_FN_HOOK MyReinitFunc + +//***************************************************************************** +// +// Informs an application that a download is starting. If hooked, this +// function will be called when a firmware download is about to begin. The +// function is called after the first data packet of the download is received +// but before it has been written to flash. +// +// void MyStartFunc(void); +// +//***************************************************************************** +//#define BL_START_FN_HOOK MyStartFunc + +//***************************************************************************** +// +// Informs an application of download progress. If hooked, this function will +// be called periodically during a firmware download to provide progress +// information. The function is called after each data packet is received from +// the host. Parameters provide the number of bytes of data received and, in +// cases other than Ethernet update, the expected total number of bytes in the +// download (the TFTP protocol used by the Ethernet boot loader does not send +// the final image size before the download starts so in this case the ulTotal +// parameter is set to 0 to indicate that the size is unknown). +// +// void MyProgressFunc(unsigned long ulCompleted, unsigned long ulTotal); +// +//***************************************************************************** +//#define BL_PROGRESS_FN_HOOK MyProgressFunc + +//***************************************************************************** +// +// Informs an application that a download has completed. If hooked, this +// function will be called when a firmware download has just completed. The +// function is called after the final data packet of the download has been +// written to flash. +// +// void MyEndFunc(void); +// +//***************************************************************************** +//#define BL_END_FN_HOOK MyEndFunc + +//***************************************************************************** +// +// Allows an application to perform in-place data decryption during download. +// If hooked, this function will be called to perform in-place decryption of +// each data packet received during a firmware download. +// +// void MyDecryptionFunc(unsigned char *pucBuffer, unsigned long ulSize); +// +// This value takes precedence over ENABLE_DECRYPTION. If both are defined, +// the hook function defined using BL_DECRYPT_FN_HOOK is called rather than the +// previously-defined DecryptData() stub function. +// +//***************************************************************************** +//#define BL_DECRYPT_FN_HOOK MyDecryptionFunc + +//***************************************************************************** +// +// Allows an application to force a new firmware download. If hooked, this +// function will be called during boot loader initialization to determine +// whether a firmware update should be performed regardless of whether a valid +// main code image is already present. If the function returns 0, the existing +// main code image is booted (if present), otherwise the boot loader will wait +// for a new firmware image to be downloaded. +// +// unsigned long MyCheckUpdateFunc(void); +// +// This value takes precedence over ENABLE_UPDATE_CHECK} if both are defined. +// If you wish to perform a GPIO check in addition to any other update check +// processing required, the GPIO code must be included within the hook function +// itself. +// +//***************************************************************************** +//#define BL_CHECK_UPDATE_FN_HOOK MyCheckUpdateFunc + +//***************************************************************************** +// +// Allows an application to replace the flash block erase function. If hooked, +// this function will be called whenever a block of flash is to be erased. The +// function must erase the block and wait until the operation has completed. +// The size of the block which will be erased is defined by FLASH_BLOCK_SIZE. +// +// void MyFlashEraseFunc(unsigned long ulBlockAddr); +// +//***************************************************************************** +//#define BL_FLASH_ERASE_FN_HOOK MyFlashEraseFunc + +//***************************************************************************** +// +// Allows an application to replace the flash programming function. If hooked, +// this function will be called to program the flash with firmware image data +// received during download operations. The function must program the supplied +// data and wait until the operation has completed. +// +// void MyFlashProgramFunc(unsigned long ulDstAddr, +// unsigned char *pucSrcData, +// unsigned long ulLength); +// +//***************************************************************************** +//#define BL_FLASH_PROGRAM_FN_HOOK MyFlashProgramFunc + +//***************************************************************************** +// +// Allows an application to replace the flash error clear function. If hooked, +// this function must clear any flash error indicators and prepare to detect +// access violations that may occur in a future erase or program operations. +// +// void MyFlashClearErrorFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_CL_ERR_FN_HOOK MyFlashClearErrorFunc + +//***************************************************************************** +// +// Reports whether or not a flash access violation error has occurred. If +// hooked, this function will be called after flash erase or program +// operations. The return code indicates whether or not an access violation +// error occurred since the last call to the function defined by +// BL_FLASH_CL_ERR_FN_HOOK, with 0 indicating no errors and non-zero indicating +// an error. +// +// unsigned long MyFlashErrorFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_ERROR_FN_HOOK MyFlashErrorFunc + +//***************************************************************************** +// +// Reports the total size of the device flash. If hooked, this function will +// be called to determine the size of the supported flash device. The return +// code is the number of bytes of flash in the device. Note that this does not +// take into account any reserved space defined via the FLASH_RSVD_SPACE value. +// +// unsigned long MyFlashSizeFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_SIZE_FN_HOOK MyFlashSizeFunc + +//***************************************************************************** +// +// Reports the address of the first byte after the end of the device flash. If +// hooked, this function will be called to determine the address of the end of +// valid flash. Note that this does not take into account any reserved space +// defined via the FLASH_RSVD_SPACE value. +// +// unsigned long MyFlashEndFunc(void); +// +//***************************************************************************** +//#define BL_FLASH_END_FN_HOOK MyFlashEndFunc + +//***************************************************************************** +// +// Checks whether the start address and size of an image are valid. If hooked, +// this function will be called when a new firmware download is about to start. +// Parameters provided are the requested start address for the new download +// and, when using protocols which transmit the image length in advance, the +// size of the image that is to be downloaded. The return code will be +// non-zero to indicate that the start address is valid and the image will fit +// in the available space, or 0 if either the address is invalid or the image +// is too large for the device. +// +// unsigned long MyFlashAddrCheckFunc(unsigned long ulAddr, +// unsigned long ulSize); +// +//***************************************************************************** +//#define BL_FLASH_AD_CHECK_FN_HOOK MyFlashAddrCheckFunc + +#endif // __BL_CONFIG_H__ diff --git a/boards/ek-lm4f232/boot_usb/boot_usb.ewd b/boards/ek-lm4f232/boot_usb/boot_usb.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/boot_usb.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/boot_usb/boot_usb.ewp b/boards/ek-lm4f232/boot_usb/boot_usb.ewp new file mode 100644 index 0000000..37c0aa7 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/boot_usb.ewp @@ -0,0 +1,821 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Source + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_autobaud.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_can.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_check.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_crc32.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_decrypt.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_emac.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_flash.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_i2c.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_main.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_packet.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_ssi.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_startup_ewarm.S + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_uart.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_usb.c + + + $PROJ_DIR$\..\..\..\..\boot_loader\bl_usbfuncs.c + + + diff --git a/boards/ek-lm4f232/boot_usb/boot_usb.uvopt b/boards/ek-lm4f232/boot_usb/boot_usb.uvopt new file mode 100644 index 0000000..565fa51 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/boot_usb.uvopt @@ -0,0 +1,450 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + boot_usb + 0x4 + ARM-ADS + + 16000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S2 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_autobaud.c + bl_autobaud.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_can.c + bl_can.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_check.c + bl_check.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_crc32.c + bl_crc32.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_decrypt.c + bl_decrypt.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_emac.c + bl_emac.c + + + 1 + 7 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_flash.c + bl_flash.c + + + 1 + 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_i2c.c + bl_i2c.c + + + 1 + 9 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_main.c + bl_main.c + + + 1 + 10 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_packet.c + bl_packet.c + + + 1 + 11 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_ssi.c + bl_ssi.c + + + 1 + 12 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_startup_rvmdk.S + bl_startup_rvmdk.S + + + 1 + 13 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_uart.c + bl_uart.c + + + 1 + 14 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_usb.c + bl_usb.c + + + 1 + 15 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\boot_loader\bl_usbfuncs.c + bl_usbfuncs.c + + + + + Documentation + 1 + 0 + 0 + + 2 + 16 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + ..\..\..\..\boot_loader\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + ..\..\..\..\boot_loader\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/boot_usb/boot_usb.uvproj b/boards/ek-lm4f232/boot_usb/boot_usb.uvproj new file mode 100644 index 0000000..2b7c93b --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/boot_usb.uvproj @@ -0,0 +1,479 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + boot_usb + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(16000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + boot_usb + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + armcc --device DLM -I . -E -o bl_config.inc ..\..\..\..\boot_loader\bl_config.c + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\boot_usb.bin .\rvmdk\boot_usb.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + .;..\..\..\..;..\..\..\..\boot_loader; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + ..\..\..\..\boot_loader\bl_link.sct + + + --entry Reset_Handler + + + + + + + + Source + + + bl_autobaud.c + 1 + ..\..\..\..\boot_loader\bl_autobaud.c + + + bl_can.c + 1 + ..\..\..\..\boot_loader\bl_can.c + + + bl_check.c + 1 + ..\..\..\..\boot_loader\bl_check.c + + + bl_crc32.c + 1 + ..\..\..\..\boot_loader\bl_crc32.c + + + bl_decrypt.c + 1 + ..\..\..\..\boot_loader\bl_decrypt.c + + + bl_emac.c + 1 + ..\..\..\..\boot_loader\bl_emac.c + + + bl_flash.c + 1 + ..\..\..\..\boot_loader\bl_flash.c + + + bl_i2c.c + 1 + ..\..\..\..\boot_loader\bl_i2c.c + + + bl_main.c + 1 + ..\..\..\..\boot_loader\bl_main.c + + + bl_packet.c + 1 + ..\..\..\..\boot_loader\bl_packet.c + + + bl_ssi.c + 1 + ..\..\..\..\boot_loader\bl_ssi.c + + + bl_startup_rvmdk.S + 2 + ..\..\..\..\boot_loader\bl_startup_rvmdk.S + + + bl_uart.c + 1 + ..\..\..\..\boot_loader\bl_uart.c + + + bl_usb.c + 1 + ..\..\..\..\boot_loader\bl_usb.c + + + bl_usbfuncs.c + 1 + ..\..\..\..\boot_loader\bl_usbfuncs.c + + + + + Documentation + + + readme.txt + 5 + ..\..\..\..\boot_loader\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/boot_usb/ccs/.ccsimportspec b/boards/ek-lm4f232/boot_usb/ccs/.ccsimportspec new file mode 100644 index 0000000..34afca1 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/ccs/.ccsimportspec @@ -0,0 +1,6 @@ + + + + + + diff --git a/boards/ek-lm4f232/boot_usb/ccs/.ccsproject b/boards/ek-lm4f232/boot_usb/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_usb/ccs/.cproject b/boards/ek-lm4f232/boot_usb/ccs/.cproject new file mode 100644 index 0000000..88dfbcb --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_usb/ccs/.project b/boards/ek-lm4f232/boot_usb/ccs/.project new file mode 100644 index 0000000..94250c3 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/ccs/.project @@ -0,0 +1,115 @@ + + + boot_usb + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + boot_loader/bl_autobaud.c + 1 + SW_ROOT/boot_loader/bl_autobaud.c + + + boot_loader/bl_can.c + 1 + SW_ROOT/boot_loader/bl_can.c + + + boot_loader/bl_check.c + 1 + SW_ROOT/boot_loader/bl_check.c + + + boot_loader/bl_crc32.c + 1 + SW_ROOT/boot_loader/bl_crc32.c + + + boot_loader/bl_decrypt.c + 1 + SW_ROOT/boot_loader/bl_decrypt.c + + + boot_loader/bl_emac.c + 1 + SW_ROOT/boot_loader/bl_emac.c + + + boot_loader/bl_flash.c + 1 + SW_ROOT/boot_loader/bl_flash.c + + + boot_loader/bl_i2c.c + 1 + SW_ROOT/boot_loader/bl_i2c.c + + + boot_loader/bl_link_ccs.cmd + 1 + SW_ROOT/boot_loader/bl_link_ccs.cmd + + + boot_loader/bl_main.c + 1 + SW_ROOT/boot_loader/bl_main.c + + + boot_loader/bl_packet.c + 1 + SW_ROOT/boot_loader/bl_packet.c + + + boot_loader/bl_ssi.c + 1 + SW_ROOT/boot_loader/bl_ssi.c + + + boot_loader/bl_startup_ccs.s + 1 + SW_ROOT/boot_loader/bl_startup_ccs.s + + + boot_loader/bl_uart.c + 1 + SW_ROOT/boot_loader/bl_uart.c + + + boot_loader/bl_usb.c + 1 + SW_ROOT/boot_loader/bl_usb.c + + + boot_loader/bl_usbfuncs.c + 1 + SW_ROOT/boot_loader/bl_usbfuncs.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/boot_usb/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/boot_usb/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.bin b/boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.bin new file mode 100644 index 0000000..304fed8 Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.bin differ diff --git a/boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.out b/boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.out new file mode 100644 index 0000000..67814bf Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/ccs/Debug/boot_usb.out differ diff --git a/boards/ek-lm4f232/boot_usb/ccs/macros.ini_initial b/boards/ek-lm4f232/boot_usb/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/boot_usb/ccs/target_config.ccxml b/boards/ek-lm4f232/boot_usb/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/boot_usb/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.bin b/boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.bin new file mode 100644 index 0000000..dd07b1d Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.bin differ diff --git a/boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.out b/boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.out new file mode 100644 index 0000000..a81534e Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/ewarm/Exe/boot_usb.out differ diff --git a/boards/ek-lm4f232/boot_usb/gcc/boot_usb.axf b/boards/ek-lm4f232/boot_usb/gcc/boot_usb.axf new file mode 100644 index 0000000..accdbe2 Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/gcc/boot_usb.axf differ diff --git a/boards/ek-lm4f232/boot_usb/gcc/boot_usb.bin b/boards/ek-lm4f232/boot_usb/gcc/boot_usb.bin new file mode 100644 index 0000000..ed269be Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/gcc/boot_usb.bin differ diff --git a/boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.axf b/boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.axf new file mode 100644 index 0000000..3cb27d4 Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.axf differ diff --git a/boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.bin b/boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.bin new file mode 100644 index 0000000..1175813 Binary files /dev/null and b/boards/ek-lm4f232/boot_usb/rvmdk/boot_usb.bin differ diff --git a/boards/ek-lm4f232/drivers/buttons.c b/boards/ek-lm4f232/drivers/buttons.c new file mode 100644 index 0000000..9dc9ce9 --- /dev/null +++ b/boards/ek-lm4f232/drivers/buttons.c @@ -0,0 +1,186 @@ +//***************************************************************************** +// +// buttons.c - Evaluation board driver for push buttons. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom_map.h" +#include "driverlib/sysctl.h" +#include "inc/hw_types.h" +#include "inc/hw_memmap.h" +#include "buttons.h" + +//***************************************************************************** +// +//! \addtogroup buttons_api +//! @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// Holds the current, debounced state of each button. A 0 in a bit indicates +// that that button is currently pressed, otherwise it is released. +// We assume that we start with all the buttons released (though if one is +// pressed when the application starts, this will be detected). +// +//***************************************************************************** +static uint8_t g_ui8ButtonStates = ALL_BUTTONS; + +//***************************************************************************** +// +//! Polls the current state of the buttons and determines which have changed. +//! +//! \param pui8Delta points to a character that will be written to indicate +//! which button states changed since the last time this function was called. +//! This value is derived from the debounced state of the buttons. +//! \param pui8RawState points to a location where the raw button state will +//! be stored. +//! +//! This function should be called periodically by the application to poll the +//! pushbuttons. It determines both the current debounced state of the buttons +//! and also which buttons have changed state since the last time the function +//! was called. +//! +//! In order for button debouncing to work properly, this function should be +//! caled at a regular interval, even if the state of the buttons is not needed +//! that often. +//! +//! If button debouncing is not required, the the caller can pass a pointer +//! for the \e pui8RawState parameter in order to get the raw state of the +//! buttons. The value returned in \e pui8RawState will be a bit mask where +//! a 1 indicates the buttons is pressed. +//! +//! \return Returns the current debounced state of the buttons where a 1 in the +//! button ID's position indicates that the button is pressed and a 0 +//! indicates that it is released. +// +//***************************************************************************** +uint8_t +ButtonsPoll(uint8_t *pui8Delta, uint8_t *pui8RawState) +{ + uint32_t ui32Delta; + uint32_t ui32Data; + static uint8_t ui8SwitchClockA = 0; + static uint8_t ui8SwitchClockB = 0; + + // + // Read the raw state of the push buttons. Save the raw state + // (inverting the bit sense) if the caller supplied storage for the + // raw value. + // + ui32Data = (MAP_GPIOPinRead(BUTTONS_GPIO_BASE, ALL_BUTTONS)); + if(pui8RawState) + { + *pui8RawState = (uint8_t)~ui32Data; + } + + // + // Determine the switches that are at a different state than the debounced + // state. + // + ui32Delta = ui32Data ^ g_ui8ButtonStates; + + // + // Increment the clocks by one. + // + ui8SwitchClockA ^= ui8SwitchClockB; + ui8SwitchClockB = ~ui8SwitchClockB; + + // + // Reset the clocks corresponding to switches that have not changed state. + // + ui8SwitchClockA &= ui32Delta; + ui8SwitchClockB &= ui32Delta; + + // + // Get the new debounced switch state. + // + g_ui8ButtonStates &= ui8SwitchClockA | ui8SwitchClockB; + g_ui8ButtonStates |= (~(ui8SwitchClockA | ui8SwitchClockB)) & ui32Data; + + // + // Determine the switches that just changed debounced state. + // + ui32Delta ^= (ui8SwitchClockA | ui8SwitchClockB); + + // + // Store the bit mask for the buttons that have changed for return to + // caller. + // + if(pui8Delta) + { + *pui8Delta = (uint8_t)ui32Delta; + } + + // + // Return the debounced buttons states to the caller. Invert the bit + // sense so that a '1' indicates the button is pressed, which is a + // sensible way to interpret the return value. + // + return(~g_ui8ButtonStates); +} + +//***************************************************************************** +// +//! Initializes the GPIO pins used by the board pushbuttons. +//! +//! This function must be called during application initialization to +//! configure the GPIO pins to which the pushbuttons are attached. It enables +//! the port used by the buttons and configures each button GPIO as an input +//! with a weak pull-up. +//! +//! \return None. +// +//***************************************************************************** +void +ButtonsInit(void) +{ + // + // Enable the GPIO port to which the pushbuttons are connected. + // + MAP_SysCtlPeripheralEnable(BUTTONS_GPIO_PERIPH); + + // + // Set each of the button GPIO pins as an input with a pull-up. + // + MAP_GPIODirModeSet(BUTTONS_GPIO_BASE, ALL_BUTTONS, GPIO_DIR_MODE_IN); + MAP_GPIOPadConfigSet(BUTTONS_GPIO_BASE, ALL_BUTTONS, + GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); + + // + // Initialize the debounced button state with the current state read from + // the GPIO bank. + // + g_ui8ButtonStates = MAP_GPIOPinRead(BUTTONS_GPIO_BASE, ALL_BUTTONS); +} + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** diff --git a/boards/ek-lm4f232/drivers/buttons.h b/boards/ek-lm4f232/drivers/buttons.h new file mode 100644 index 0000000..fa52fa4 --- /dev/null +++ b/boards/ek-lm4f232/drivers/buttons.h @@ -0,0 +1,103 @@ +//***************************************************************************** +// +// buttons.h - Prototypes for the evaluation board buttons driver. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __BUTTONS_H__ +#define __BUTTONS_H__ + +//***************************************************************************** +// +// Defines for the hardware resources used by the pushbuttons. +// +// The switches are on the following ports/pins: +// +// PM0 - Up +// PM1 - Down +// PM2 - Left +// PM3 - Right +// PM4 - Select/Wake +// +// The switches tie the GPIO to ground, so the GPIOs need to be configured +// with pull-ups, and a value of 0 means the switch is pressed. +// +//***************************************************************************** +#define BUTTONS_GPIO_PERIPH SYSCTL_PERIPH_GPIOM +#define BUTTONS_GPIO_BASE GPIO_PORTM_BASE + +#define NUM_BUTTONS 5 +#define UP_BUTTON GPIO_PIN_0 +#define DOWN_BUTTON GPIO_PIN_1 +#define LEFT_BUTTON GPIO_PIN_2 +#define RIGHT_BUTTON GPIO_PIN_3 +#define SELECT_BUTTON GPIO_PIN_4 + +#define ALL_BUTTONS (LEFT_BUTTON | RIGHT_BUTTON | UP_BUTTON | \ + DOWN_BUTTON | SELECT_BUTTON) + +//***************************************************************************** +// +// Useful macros for detecting button events. +// +//***************************************************************************** +#define BUTTON_PRESSED(button, buttons, changed) \ + (((button) & (changed)) && ((button) & (buttons))) + +#define BUTTON_RELEASED(button, buttons, changed) \ + (((button) & (changed)) && !((button) & (buttons))) + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Functions exported from buttons.c +// +//***************************************************************************** +extern void ButtonsInit(void); +extern uint8_t ButtonsPoll(uint8_t *pui8Delta, + uint8_t *pui8Raw); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +//***************************************************************************** +// +// Prototypes for the globals exported by this driver. +// +//***************************************************************************** + +#endif // __BUTTONS_H__ diff --git a/boards/ek-lm4f232/drivers/cfal96x64x16.c b/boards/ek-lm4f232/drivers/cfal96x64x16.c new file mode 100644 index 0000000..1036643 --- /dev/null +++ b/boards/ek-lm4f232/drivers/cfal96x64x16.c @@ -0,0 +1,816 @@ +//***************************************************************************** +// +// cfal96x64x16.c - Display driver for the Crystalfontz CFAL9664-F-B1 OLED +// display with an SSD1332. This version uses an SSI +// interface to the display controller. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +//***************************************************************************** +// +//! \addtogroup display_api +//! @{ +// +//***************************************************************************** + +#include +#include +#include "inc/hw_memmap.h" +#include "driverlib/gpio.h" +#include "driverlib/ssi.h" +#include "driverlib/sysctl.h" +#include "driverlib/rom.h" +#include "driverlib/pin_map.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +// Defines the SSI and GPIO peripherals that are used for this display. +// +//***************************************************************************** +#define DISPLAY_SSI_PERIPH SYSCTL_PERIPH_SSI2 +#define DISPLAY_SSI_GPIO_PERIPH SYSCTL_PERIPH_GPIOH +#define DISPLAY_RST_GPIO_PERIPH SYSCTL_PERIPH_GPIOG + +//***************************************************************************** +// +// Defines the GPIO pin configuration macros for the pins that are used for +// the SSI function. +// +//***************************************************************************** +#define DISPLAY_PINCFG_SSICLK GPIO_PH4_SSI2CLK +#define DISPLAY_PINCFG_SSIFSS GPIO_PH5_SSI2FSS +#define DISPLAY_PINCFG_SSITX GPIO_PH7_SSI2TX + +//***************************************************************************** +// +// Defines the port and pins for the SSI peripheral. +// +//***************************************************************************** +#define DISPLAY_SSI_PORT GPIO_PORTH_BASE +#define DISPLAY_SSI_PINS (GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_7) + +//***************************************************************************** +// +// Defines the port and pins for the display voltage enable signal. +// +//***************************************************************************** +#define DISPLAY_ENV_PORT GPIO_PORTG_BASE +#define DISPLAY_ENV_PIN GPIO_PIN_0 + +//***************************************************************************** +// +// Defines the port and pins for the display reset signal. +// +//***************************************************************************** +#define DISPLAY_RST_PORT GPIO_PORTG_BASE +#define DISPLAY_RST_PIN GPIO_PIN_1 + +//***************************************************************************** +// +// Defines the port and pins for the display Data/Command (D/C) signal. +// +//***************************************************************************** +#define DISPLAY_D_C_PORT GPIO_PORTH_BASE +#define DISPLAY_D_C_PIN GPIO_PIN_6 + +//***************************************************************************** +// +// Defines the SSI peripheral used and the data speed. +// +//***************************************************************************** +#define DISPLAY_SSI_BASE SSI2_BASE // SSI2 +#define DISPLAY_SSI_CLOCK 4000000 + +//***************************************************************************** +// +// An array that holds a set of commands that are sent to the display when +// it is initialized. +// +//***************************************************************************** +static +uint8_t g_ui8DisplayInitCommands[] = +{ +// 0xAE, // display off + 0x87, 0x07, // master control current 7/16 + 0x81, 0xA0, // contrast A control + 0x82, 0x60, // contrast B control + 0x83, 0xB0, // contrast C control + 0xA0, 0x20,//00 // remap and data format - use 8-bit color mode + 0xBB, 0x1F, // Vpa + 0xBC, 0x1F, // Vpb + 0xBD, 0x1F, // Vpc +// 0xAD, 0x8E, // internal Vp, external supply + 0x26, 0x01, // rectangle fill enabled + 0xAF // display on +}; +#define NUM_INIT_BYTES sizeof(g_ui8DisplayInitCommands) + +//***************************************************************************** +// +// Translates a 24-bit RGB color to a display driver-specific color. +// +// \param c is the 24-bit RGB color. The least-significant byte is the blue +// channel, the next byte is the green channel, and the third byte is the red +// channel. +// +// This macro translates a 24-bit RGB color into a value that can be written +// into the display's frame buffer in order to reproduce that color, or the +// closest possible approximation of that color. +// +// \return Returns the display-driver specific color. +// +// 24-bit format: XXXX XXXX RRRR RRRR GGGG GGGG BBBB BBBB +// 16-bit format: ---- ---- ---- ---- RRRR RGGG GGGB BBBB +// 8-bit format: ---- ---- ---- ---- ---- ---- RRRG GGBB +// +// +//***************************************************************************** +#define DPYCOLORTRANSLATE16(c) ((((c) & 0x00f80000) >> 8) | \ + (((c) & 0x0000fc00) >> 5) | \ + (((c) & 0x000000f8) >> 3)) +#define DPYCOLORTRANSLATE8(c) ((((c) & 0x00e00000) >> 16) | \ + (((c) & 0x0000e000) >> 11) | \ + (((c) & 0x000000c0) >> 6)) +#define DPYCOLORTRANSLATE DPYCOLORTRANSLATE8 + +//***************************************************************************** +// +//! Write a set of command bytes to the display controller. +// +//! \param pi8Cmd is a pointer to a set of command bytes. +//! \param ui32Count is the count of command bytes. +//! +//! This function provides a way to send multiple command bytes to the display +//! controller. It can be used for single commands, or multiple commands +//! chained together in a buffer. It will wait for any previous operation to +//! finish, and then copy all the command bytes to the controller. It will +//! not return until the last command byte has been written to the SSI FIFO, +//! but data could still be shifting out to the display controller when this +//! function returns. +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16WriteCommand(const uint8_t *pi8Cmd, uint32_t ui32Count) +{ + // + // Wait for any previous SSI operation to finish. + // + while(ROM_SSIBusy(DISPLAY_SSI_BASE)) + { + } + + // + // Set the D/C pin low to indicate command + // + ROM_GPIOPinWrite(DISPLAY_D_C_PORT, DISPLAY_D_C_PIN, 0); + + // + // Send all the command bytes to the display + // + while(ui32Count--) + { + ROM_SSIDataPut(DISPLAY_SSI_BASE, *pi8Cmd); + pi8Cmd++; + } +} + +//***************************************************************************** +// +//! Write a set of data bytes to the display controller. +// +//! \param pi8Data is a pointer to a set of data bytes, containing pixel data. +//! \param ui32Count is the count of command bytes. +//! +//! This function provides a way to send a set of pixel data to the display. +//! The data will draw pixels according to whatever the most recent col, row +//! settings are for the display. It will wait for any previous operation to +//! finish, and then copy all the data bytes to the controller. It will +//! not return until the last data byte has been written to the SSI FIFO, +//! but data could still be shifting out to the display controller when this +//! function returns. +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16WriteData(const uint8_t *pi8Data, uint32_t ui32Count) +{ + // + // Wait for any previous SSI operation to finish. + // + while(ROM_SSIBusy(DISPLAY_SSI_BASE)) + { + } + + // + // Set the D/C pin high to indicate data + // + ROM_GPIOPinWrite(DISPLAY_D_C_PORT, DISPLAY_D_C_PIN, DISPLAY_D_C_PIN); + + // + // Send all the data bytes to the display + // + while(ui32Count--) + { + ROM_SSIDataPut(DISPLAY_SSI_BASE, *pi8Data); + pi8Data++; + } +} + +//***************************************************************************** +// +//! Draws a pixel on the screen. +//! +//! \param pvDisplayData is a pointer to the driver-specific data for this +//! display driver. +//! \param i32X is the X coordinate of the pixel. +//! \param i32Y is the Y coordinate of the pixel. +//! \param ui32Value is the color of the pixel. +//! +//! This function sets the given pixel to a particular color. The coordinates +//! of the pixel are assumed to be within the extents of the display. +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16PixelDraw(void *pvDisplayData, int32_t i32X, int32_t i32Y, + uint32_t ui32Value) +{ + uint8_t ui8Cmd[8]; + + // + // Load column command, start and end column + // + ui8Cmd[0] = 0x15; + ui8Cmd[1] = (uint8_t)i32X; + ui8Cmd[2] = (uint8_t)i32X; + + // + // Load row command, start and end row + // + ui8Cmd[3] = 0x75; + ui8Cmd[4] = (uint8_t)i32Y; + ui8Cmd[5] = (uint8_t)i32Y; + + // + // Send the column, row commands to the display + // + CFAL96x64x16WriteCommand(ui8Cmd, 6); + + // + // Send the data value representing the pixel to the display + // + CFAL96x64x16WriteData((uint8_t *)&ui32Value, 1); +} + +//***************************************************************************** +// +//! Draws a horizontal sequence of pixels on the screen. +//! +//! \param pvDisplayData is a pointer to the driver-specific data for this +//! display driver. +//! \param i32X is the X coordinate of the first pixel. +//! \param i32Y is the Y coordinate of the first pixel. +//! \param i32X0 is sub-pixel offset within the pixel data, which is valid for 1 +//! or 4 bit per pixel formats. +//! \param i32Count is the number of pixels to draw. +//! \param i32BPP is the number of bits per pixel; must be 1, 4, or 8 optionally +//! ORed with various flags unused by this driver. +//! \param pui8Data is a pointer to the pixel data. For 1 and 4 bit per pixel +//! formats, the most significant bit(s) represent the left-most pixel. +//! \param pui8Palette is a pointer to the palette used to draw the pixels. +//! +//! This function draws a horizontal sequence of pixels on the screen, using +//! the supplied palette. For 1 bit per pixel format, the palette contains +//! pre-translated colors; for 4 and 8 bit per pixel formats, the palette +//! contains 24-bit RGB values that must be translated before being written to +//! the display. +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16PixelDrawMultiple(void *pvDisplayData, int32_t i32X, int32_t i32Y, int32_t i32X0, + int32_t i32Count, int32_t i32BPP, + const uint8_t *pui8Data, + const uint8_t *pui8Palette) +{ + uint32_t ui32Byte; + uint8_t ui8Cmd[8]; + + // + // Load column command. Use the specified X for the start and just set + // the end to the rightmost column since we dont know where the data ends. + // + ui8Cmd[0] = 0x15; + ui8Cmd[1] = (uint8_t)i32X; + ui8Cmd[2] = 95; + + // + // Load row command. Use the specified Y for the start row and just set + // the end row to the bottom row since we dont know where the data ends. + // + ui8Cmd[3] = 0x75; + ui8Cmd[4] = (uint8_t)i32Y; + ui8Cmd[5] = 63; + + // + // Send the column, row commands to the display + // + CFAL96x64x16WriteCommand(ui8Cmd, 6); + + // + // Determine how to interpret the pixel data based on the number of bits + // per pixel. + // + switch(i32BPP & 0xFF) + { + // + // The pixel data is in 1 bit per pixel format. + // + case 1: + { + // + // Loop while there are more pixels to draw. + // + while(i32Count) + { + // + // Get the next byte of image data. + // + ui32Byte = *pui8Data++; + + // + // Loop through the pixels in this byte of image data. + // + for(; (i32X0 < 8) && i32Count; i32X0++, i32Count--) + { + // + // Draw this pixel in the appropriate color. + // + uint8_t ui8BPP = ((uint32_t *)pui8Palette) + [(ui32Byte >> (7 - i32X0)) & 1]; + CFAL96x64x16WriteData(&ui8BPP, 1); + } + + // + // Start at the beginning of the next byte of image data. + // + i32X0 = 0; + } + + // + // The image data has been drawn. + // + break; + } + + // + // The pixel data is in 4 bit per pixel format. + // + case 4: + { + // + // Loop while there are more pixels to draw. "Duff's device" is + // used to jump into the middle of the loop if the first nibble of + // the pixel data should not be used. Duff's device makes use of + // the fact that a case statement is legal anywhere within a + // sub-block of a switch statement. See + // http://en.wikipedia.org/wiki/Duff's_device for detailed + // information about Duff's device. + // + switch(i32X0 & 1) + { + case 0: + while(i32Count) + { + uint8_t ui8Color; + + // + // Get the upper nibble of the next byte of pixel data + // and extract the corresponding entry from the + // palette. + // + ui32Byte = (*pui8Data >> 4) * 3; + ui32Byte = (*(uint32_t *)(pui8Palette + ui32Byte) & + 0x00ffffff); + + // + // Translate this palette entry and write it to the + // screen. + // + ui8Color = DPYCOLORTRANSLATE(ui32Byte); + CFAL96x64x16WriteData(&ui8Color, 1); + + // + // Decrement the count of pixels to draw. + // + i32Count--; + + // + // See if there is another pixel to draw. + // + if(i32Count) + { + case 1: + // + // Get the lower nibble of the next byte of pixel + // data and extract the corresponding entry from + // the palette. + // + ui32Byte = (*pui8Data++ & 15) * 3; + ui32Byte = (*(uint32_t *)(pui8Palette + ui32Byte) & + 0x00ffffff); + + // + // Translate this palette entry and write it to the + // screen. + // + ui8Color = DPYCOLORTRANSLATE(ui32Byte); + CFAL96x64x16WriteData(&ui8Color, 1); + + // + // Decrement the count of pixels to draw. + // + i32Count--; + } + } + } + + // + // The image data has been drawn. + // + break; + } + + // + // The pixel data is in 8 bit per pixel format. + // + case 8: + { + // + // Loop while there are more pixels to draw. + // + while(i32Count--) + { + uint8_t ui8Color; + + // + // Get the next byte of pixel data and extract the + // corresponding entry from the palette. + // + ui32Byte = *pui8Data++ * 3; + ui32Byte = *(uint32_t *)(pui8Palette + ui32Byte) & 0x00ffffff; + + // + // Translate this palette entry and write it to the screen. + // + ui8Color = DPYCOLORTRANSLATE(ui32Byte); + CFAL96x64x16WriteData(&ui8Color, 1); + } + + // + // The image data has been drawn. + // + break; + } + } +} + +//***************************************************************************** +// +//! Draws a horizontal line. +//! +//! \param pvDisplayData is a pointer to the driver-specific data for this +//! display driver. +//! \param i32X1 is the X coordinate of the start of the line. +//! \param i32X2 is the X coordinate of the end of the line. +//! \param i32Y is the Y coordinate of the line. +//! \param ui32Value is the color of the line. +//! +//! This function draws a horizontal line on the display. The coordinates of +//! the line are assumed to be within the extents of the display. +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16LineDrawH(void *pvDisplayData, int32_t i32X1, int32_t i32X2, int32_t i32Y, + uint32_t ui32Value) +{ + uint8_t ui8LineBuf[16]; + unsigned int uIdx; + + // + // Send command for starting row and column + // + ui8LineBuf[0] = 0x15; + ui8LineBuf[1] = i32X1 < i32X2 ? i32X1 : i32X2; + ui8LineBuf[2] = 95; + ui8LineBuf[3] = 0x75; + ui8LineBuf[4] = i32Y; + ui8LineBuf[5] = 63; + CFAL96x64x16WriteCommand(ui8LineBuf, 6); + + // + // Use buffer of pixels to draw line, so multiple bytes can be sent at + // one time. Fill the buffer with the line color. + // + for(uIdx = 0; uIdx < sizeof(ui8LineBuf); uIdx++) + { + ui8LineBuf[uIdx] = ui32Value; + } + + uIdx = (i32X1 < i32X2) ? (i32X2 - i32X1) : (i32X1 - i32X2); + uIdx += 1; + while(uIdx) + { + CFAL96x64x16WriteData(ui8LineBuf, (uIdx < 16) ? uIdx : 16); + uIdx -= (uIdx < 16) ? uIdx : 16; + } +} + +//***************************************************************************** +// +//! Draws a vertical line. +//! +//! \param pvDisplayData is a pointer to the driver-specific data for this +//! display driver. +//! \param i32X is the X coordinate of the line. +//! \param i32Y1 is the Y coordinate of the start of the line. +//! \param i32Y2 is the Y coordinate of the end of the line. +//! \param ui32Value is the color of the line. +//! +//! This function draws a vertical line on the display. The coordinates of the +//! line are assumed to be within the extents of the display. +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16LineDrawV(void *pvDisplayData, int32_t i32X, int32_t i32Y1, int32_t i32Y2, + uint32_t ui32Value) +{ + uint8_t ui8LineBuf[16]; + unsigned int uIdx; + + // + // Send command for starting row and column. Also, set vertical + // address increment. + // + ui8LineBuf[0] = 0x15; + ui8LineBuf[1] = i32X; + ui8LineBuf[2] = 95; + ui8LineBuf[3] = 0x75; + ui8LineBuf[4] = i32Y1 < i32Y2 ? i32Y1 : i32Y2; + ui8LineBuf[5] = 63; + ui8LineBuf[6] = 0xA0; + ui8LineBuf[7] = 0x21; + CFAL96x64x16WriteCommand(ui8LineBuf, 8); + + // + // Use buffer of pixels to draw line, so multiple bytes can be sent at + // one time. Fill the buffer with the line color. + // + for(uIdx = 0; uIdx < sizeof(ui8LineBuf); uIdx++) + { + ui8LineBuf[uIdx] = ui32Value; + } + + uIdx = (i32Y1 < i32Y2) ? (i32Y2 - i32Y1) : (i32Y1 - i32Y2); + uIdx += 1; + while(uIdx) + { + CFAL96x64x16WriteData(ui8LineBuf, (uIdx < 16) ? uIdx : 16); + uIdx -= (uIdx < 16) ? uIdx : 16; + } + + // + // Restore horizontal address increment + // + ui8LineBuf[0] = 0xA0; + ui8LineBuf[1] = 0x20; + CFAL96x64x16WriteCommand(ui8LineBuf, 2); +} + +//***************************************************************************** +// +//! Fills a rectangle. +//! +//! \param pvDisplayData is a pointer to the driver-specific data for this +//! display driver. +//! \param pRect is a pointer to the structure describing the rectangle. +//! \param ui32Value is the color of the rectangle. +//! +//! This function fills a rectangle on the display. The coordinates of the +//! rectangle are assumed to be within the extents of the display, and the +//! rectangle specification is fully inclusive (in other words, both i16XMin and +//! i16XMax are drawn, aint32_t with i16YMin and i16YMax). +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16RectFill(void *pvDisplayData, const tRectangle *pRect, + uint32_t ui32Value) +{ + unsigned int uY; + + for(uY = pRect->i16YMin; uY <= pRect->i16YMax; uY++) + { + CFAL96x64x16LineDrawH(0, pRect->i16XMin, pRect->i16XMax, uY, ui32Value); + } +} + +//***************************************************************************** +// +//! Translates a 24-bit RGB color to a display driver-specific color. +//! +//! \param pvDisplayData is a pointer to the driver-specific data for this +//! display driver. +//! \param ui32Value is the 24-bit RGB color. The least-significant byte is the +//! blue channel, the next byte is the green channel, and the third byte is the +//! red channel. +//! +//! This function translates a 24-bit RGB color into a value that can be +//! written into the display's frame buffer in order to reproduce that color, +//! or the closest possible approximation of that color. +//! +//! \return Returns the display-driver specific color. +// +//***************************************************************************** +static uint32_t +CFAL96x64x16ColorTranslate(void *pvDisplayData, uint32_t ui32Value) +{ + // + // Translate from a 24-bit RGB color to a 3-3-2 RGB color. + // + return(DPYCOLORTRANSLATE(ui32Value)); +} + +//***************************************************************************** +// +//! Flushes any cached drawing operations. +//! +//! \param pvDisplayData is a pointer to the driver-specific data for this +//! display driver. +//! +//! This functions flushes any cached drawing operations to the display. This +//! is useful when a local frame buffer is used for drawing operations, and the +//! flush would copy the local frame buffer to the display. Since no memory +//! based frame buffer is used for this driver, the flush is a no operation. +//! +//! \return None. +// +//***************************************************************************** +static void +CFAL96x64x16Flush(void *pvDisplayData) +{ + // + // There is nothing to be done. + // +} + +//***************************************************************************** +// +//! The display structure that describes the driver for the Crystalfontz +//! CFAL9664-F-B1 OLED panel with SSD 1332 controller. +// +//***************************************************************************** +const tDisplay g_sCFAL96x64x16 = +{ + sizeof(tDisplay), + 0, + 96, + 64, + CFAL96x64x16PixelDraw, + CFAL96x64x16PixelDrawMultiple, + CFAL96x64x16LineDrawH, + CFAL96x64x16LineDrawV, + CFAL96x64x16RectFill, + CFAL96x64x16ColorTranslate, + CFAL96x64x16Flush +}; + +//***************************************************************************** +// +//! Initializes the display driver. +//! +//! This function initializes the SSD1332 display controller on the panel, +//! preparing it to display data. +//! +//! \return None. +// +//***************************************************************************** +void +CFAL96x64x16Init(void) +{ + tRectangle sRect; + + // + // Enable the peripherals used by this driver + // + ROM_SysCtlPeripheralEnable(DISPLAY_SSI_PERIPH); + ROM_SysCtlPeripheralEnable(DISPLAY_SSI_GPIO_PERIPH); + ROM_SysCtlPeripheralEnable(DISPLAY_RST_GPIO_PERIPH); + + // + // Select the SSI function for the appropriate pins + // + ROM_GPIOPinConfigure(DISPLAY_PINCFG_SSICLK); + ROM_GPIOPinConfigure(DISPLAY_PINCFG_SSIFSS); + ROM_GPIOPinConfigure(DISPLAY_PINCFG_SSITX); + + + // + // Configure the pins for the SSI function + // + ROM_GPIOPinTypeSSI(DISPLAY_SSI_PORT, DISPLAY_SSI_PINS); + + // + // Configure display control pins as GPIO output + // + ROM_GPIOPinTypeGPIOOutput(DISPLAY_RST_PORT, DISPLAY_RST_PIN); + ROM_GPIOPinTypeGPIOOutput(DISPLAY_ENV_PORT, DISPLAY_ENV_PIN); + ROM_GPIOPinTypeGPIOOutput(DISPLAY_D_C_PORT, DISPLAY_D_C_PIN); + + // + // Reset pin high, power off + // + ROM_GPIOPinWrite(DISPLAY_RST_PORT, DISPLAY_RST_PIN, DISPLAY_RST_PIN); + ROM_GPIOPinWrite(DISPLAY_ENV_PORT, DISPLAY_ENV_PIN, 0); + ROM_SysCtlDelay(1000); + + // + // Drive the reset pin low while we do other stuff + // + ROM_GPIOPinWrite(DISPLAY_RST_PORT, DISPLAY_RST_PIN, 0); + + // + // Configure the SSI port + // + ROM_SSIDisable(DISPLAY_SSI_BASE); + ROM_SSIConfigSetExpClk(DISPLAY_SSI_BASE, ROM_SysCtlClockGet(), + SSI_FRF_MOTO_MODE_3, SSI_MODE_MASTER, + DISPLAY_SSI_CLOCK, 8); + ROM_SSIEnable(DISPLAY_SSI_BASE); + + // + // Take the display out of reset + // + ROM_SysCtlDelay(1000); + ROM_GPIOPinWrite(DISPLAY_RST_PORT, DISPLAY_RST_PIN, DISPLAY_RST_PIN); + ROM_SysCtlDelay(1000); + + // + // Enable display power supply + // + ROM_GPIOPinWrite(DISPLAY_ENV_PORT, DISPLAY_ENV_PIN, DISPLAY_ENV_PIN); + ROM_SysCtlDelay(1000); + + // + // Send the initial configuration command bytes to the display + // + CFAL96x64x16WriteCommand(g_ui8DisplayInitCommands, + sizeof(g_ui8DisplayInitCommands)); + ROM_SysCtlDelay(1000); + + // + // Fill the entire display with a black rectangle, to clear it. + // + sRect.i16XMin = 0; + sRect.i16XMax = 95; + sRect.i16YMin = 0; + sRect.i16YMax = 63; + CFAL96x64x16RectFill(0, &sRect, 0); +} + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** diff --git a/boards/ek-lm4f232/drivers/cfal96x64x16.h b/boards/ek-lm4f232/drivers/cfal96x64x16.h new file mode 100644 index 0000000..880be00 --- /dev/null +++ b/boards/ek-lm4f232/drivers/cfal96x64x16.h @@ -0,0 +1,37 @@ +//***************************************************************************** +// +// cfal96x64x16.h - Prototypes for the Crystalfontz CFAL9664-F-B1 OLED display +// with an SSD1332 controller. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __CFAL96X64X16_H__ +#define __CFAL96X64X16_H__ + +//***************************************************************************** +// +// Prototypes for the globals exported by this driver. +// +//***************************************************************************** +extern void CFAL96x64x16Init(void); +extern const tDisplay g_sCFAL96x64x16; + +#endif // __CFAL96X64X16_H__ diff --git a/boards/ek-lm4f232/drivers/slidemenuwidget.c b/boards/ek-lm4f232/drivers/slidemenuwidget.c new file mode 100644 index 0000000..805b77b --- /dev/null +++ b/boards/ek-lm4f232/drivers/slidemenuwidget.c @@ -0,0 +1,1424 @@ +//***************************************************************************** +// +// slidemenuwidget.c - A sliding menu drawing widget. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "utils/uartstdio.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "slidemenuwidget.h" + +//***************************************************************************** +// +//! \addtogroup slidemenuwidget_api +//! @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// This is a custom widget for drawing a menu system on the display. The +// widget presents the menus using a "sliding" animation. The menu items +// are shown in a vertical list, and as the user scrolls through the list +// of menu items, the menu slides up and down the display. When a menu item +// is selected to descend in the menu tree, the widget slides the old menu +// off the to left while the new menu slides in from the right. Likewise, +// going up in the menu tree, the higher level menu slides back onto the +// screen from the left. +// +// Additional structures are provided to implement a menu, and menu items. +// Each menu contains menu items, and each menu item can have a child menu. +// These structures can be used to build a menu tree. The menu widget will +// show one menu at any given time, the menu that is displayed on the screen. +// +// In addition to child menus, any menu item can have instead a child widget. +// If this is used, then when the user selects a menu item, a new widget can +// be activated to perform some function. When the function of the child +// widget completes, then the widget slides back off the screen (to the right) +// and the parent menu is displayed again. +// +// A given menu can have menu items that are individually selectable or +// multiple-selectable. For individually selectable menu items, the item +// is selected by leaving the menu with the focus on the selected item. For +// example navigating down to a submenu with choices A, B and C, and then +// navigating until the focus is on item B will cause item B to be selected. +// The menu will remember that item B was selected even when navigating away +// from that menu. +// +// If a menu is configured to be multiple-selectable, then each menu item has +// a check box that is checked by pressing the select button. When the item +// is selected the box will show an X. Any or all or none can be selected in +// this way. When a menu is configured to be multi-selectable, the menu items +// cannot have any child menus or widgets. +// +// The menu widget provides some visual clues to the user about how to +// navigate the menu tree. Whenever a menu item has a child menu or child +// widget, then a small right arrow is shown on the right side of the menu +// item that has the focus. This tells the user to press the "right" button +// to descend to the next menu or widget. When it is possible to go up a +// level in the menu tree (when showing a child menu), a small left arrow +// will be shown on the menu item with the focus. This is an indication to the +// user that they should press the "left" button. +// +// This widget is meant to work with key/button presses. It expects there +// to be up/down/left/right and select buttons. The widget will need to be +// modified in order to work with a pointer input. +// +// In order to perform the sliding animation, the menu widget requires that +// it be provided with two off-screen displays. The menu widget renders the +// two menus (the old and the new) into the two buffers, and then repeatedly +// paints both to the physical display while adjusting the coordinates as +// appropriate. This will cause the menus to appear animated and move across +// the display. When the menus are being animated, the menu widget is taking +// all the non-interrupt processor time in order to draw the buffers to the +// display. This operation occurs in response to the widget processing of the +// key/button events and will occur in the thread that calls +// WidgetMessageQueueProcess(). The programmer should be aware of this +// processing burden when designing an application that uses the sliding +// menu widget. +// +//***************************************************************************** + +//***************************************************************************** +// +// A graphics image of a small right arrow icon. +// +//***************************************************************************** +const uint8_t g_ui8RtArrow[] = +{ + IMAGE_FMT_1BPP_UNCOMP, + 4, 0, + 8, 0, + + 0x80, + 0xC0, + 0xE0, + 0xF0, + 0xE0, + 0xC0, + 0x80, + 0 +}; + +//***************************************************************************** +// +// A graphics image of a small left arrow icon. +// +//***************************************************************************** +const uint8_t g_ui8LtArrow[] = +{ + IMAGE_FMT_1BPP_UNCOMP, + 4, 0, + 8, 0, + + 0x10, + 0x30, + 0x70, + 0xF0, + 0x70, + 0x30, + 0x10, + 0 +}; + +//***************************************************************************** +// +// A graphics image of a small unchecked box icon. +// +//***************************************************************************** +const uint8_t g_ui8Unchecked[] = +{ + IMAGE_FMT_1BPP_UNCOMP, + 7, 0, + 8, 0, + + 0xFE, + 0x82, + 0x82, + 0x82, + 0x82, + 0x82, + 0xFE, + 0 +}; + +//***************************************************************************** +// +// A graphics image of a small checked box icon. +// +//***************************************************************************** +const uint8_t g_ui8Checked[] = +{ + IMAGE_FMT_1BPP_UNCOMP, + 7, 0, + 8, 0, + + 0xFE, + 0xC6, + 0xAA, + 0x92, + 0xAA, + 0xC6, + 0xFE, + 0 +}; + +//***************************************************************************** +// +//! Draws the current menu into a drawing context, off-screen buffer. +//! +//! \param psMenuWidget points at the SlideMenuWidget being processed. +//! \param psContext points to the context where all drawing should be done. +//! \param i32OffsetY is the Y offset for drawing the menu. +//! +//! This function renders a menu (set of menu items), into a drawing context. +//! It assumes that the drawing context is an off-screen buffer, and that +//! the entire buffer belongs to this widget. The vertical position of the +//! menu can be adjusted by using the parameter i32OffsetY. This value can be +//! positive or negative and can cause the menu to be rendered above or below +//! the normal position in the display. +//! +//! \return None. +// +//***************************************************************************** +void +SlideMenuDraw(tSlideMenuWidget *psMenuWidget, tContext *psContext, + int32_t i32OffsetY) +{ + tSlideMenu *psMenu; + uint32_t ui32Idx; + tRectangle sRect; + + // + // Check the arguments + // + ASSERT(psMenuWidget); + ASSERT(psContext); + + // + // Set the foreground color for the rectangle fill to match what we want + // as the menu background. + // + GrContextForegroundSet(psContext, psMenuWidget->ui32ColorBackground); + GrRectFill(psContext, &psContext->sClipRegion); + + // + // Get the current menu that is being displayed + // + psMenu = psMenuWidget->psSlideMenu; + + // + // Set the foreground to the color we want for the menu item boundaries + // and text color, text font. + // + GrContextForegroundSet(psContext, psMenuWidget->ui32ColorForeground); + GrContextFontSet(psContext, psMenuWidget->psFont); + + // + // Set the rectangle bounds for the first menu item. + // The starting Y value is calculated based on which menu item is currently + // centered. Y coordinates are subtracted to find the Y start location + // of the first menu item, which could even be off the display. + // + // Set the X coords of the menu item to the extents of the display + // + sRect.i16XMin = 0; + sRect.i16XMax = psContext->sClipRegion.i16XMax; + + // + // Find the Y coordinate of the centered menu item + // + sRect.i16YMin = (psContext->psDisplay->ui16Height / 2) - + (psMenuWidget->ui32MenuItemHeight / 2); + + // + // Adjust to find Y coordinate of first menu item + // + sRect.i16YMin -= psMenu->ui32CenterIndex * psMenuWidget->ui32MenuItemHeight; + + // + // Now adjust for the offset that was passed in by caller. This allows + // for drawing menu items above or below the main display. + // + sRect.i16YMin += i32OffsetY; + + // + // Find the ending Y coordinate of first menu item + // + sRect.i16YMax = sRect.i16YMin + psMenuWidget->ui32MenuItemHeight - 1; + + // + // Start the index at the first menu item. It is possible that this + // menu item is off the display. + // + ui32Idx = 0; + + // + // Loop through all menu items, drawing on the display. Note that some + // may not be on the screen, but they will be clipped. + // + while(ui32Idx < psMenu->ui32Items) + { + // + // If this index is the one that is highlighted, then change the + // background + // + if(ui32Idx == psMenu->ui32FocusIndex) + { + // + // Set the foreground to the highlight color, and fill the + // rectangle of the background of this menu item. + // + GrContextForegroundSet(psContext, psMenuWidget->ui32ColorHighlight); + GrRectFill(psContext, &sRect); + + // + // Set the new foreground to the normal foreground color, and + // set the background to the highlight color. This is so + // remaining drawing operations will have the correct background + // and foreground colors for this highlighted menu item cell. + // + GrContextForegroundSet(psContext, psMenuWidget->ui32ColorForeground); + GrContextBackgroundSet(psContext, psMenuWidget->ui32ColorHighlight); + + // + // If this menu has a parent, then draw a left arrow icon on the + // focused menu item. + // + if(psMenu->psParent) + { + GrImageDraw(psContext, g_ui8LtArrow, sRect.i16XMin + 4, + sRect.i16YMin + + (psMenuWidget->ui32MenuItemHeight / 2) - 4); + } + + // + // If this menu has a child menu or child widget, then draw a + // right arrow icon on the focused menu item. + // + if(psMenu->psSlideMenuItems[ui32Idx].psChildMenu || + psMenu->psSlideMenuItems[ui32Idx].psChildWidget) + { + GrImageDraw(psContext, g_ui8RtArrow, sRect.i16XMax - 8, + sRect.i16YMin + + (psMenuWidget->ui32MenuItemHeight / 2) - 4); + } + } + + // + // Otherwise this is a normal, non-highlighted menu item cell, + // so set the normal background color. + // + else + { + GrContextBackgroundSet(psContext, psMenuWidget->ui32ColorBackground); + } + + // + // If the current menu is multi-selectable, then draw a checkbox on + // the menu item. Draw a checked or unchecked box depending on whether + // the item has been selected. + // + if(psMenu->bMultiSelectable) + { + if(psMenu->ui32SelectedFlags & (1 << ui32Idx)) + { + GrImageDraw(psContext, g_ui8Checked, sRect.i16XMax - 12, + sRect.i16YMin + + (psMenuWidget->ui32MenuItemHeight / 2) - 4); + } + else + { + GrImageDraw(psContext, g_ui8Unchecked, sRect.i16XMax - 12, + sRect.i16YMin + + (psMenuWidget->ui32MenuItemHeight / 2) - 4); + } + + } + + // + // Draw the rectangle representing the menu item + // + GrRectDraw(psContext, &sRect); + + // + // Draw the text for this menu item in the middle of the menu item + // rectangle (cell). + // + GrStringDrawCentered(psContext, + psMenu->psSlideMenuItems[ui32Idx].pcText, + -1, + psMenuWidget->sBase.psDisplay->ui16Width / 2, + sRect.i16YMin + \ + (psMenuWidget->ui32MenuItemHeight / 2) - 1, 0); + + // + // Advance to the next menu item, and update the menu item rectangle + // bounds to the next position + // + ui32Idx++; + sRect.i16YMin += psMenuWidget->ui32MenuItemHeight; + sRect.i16YMax += psMenuWidget->ui32MenuItemHeight; + + // + // Note that this may attempt to render menu items that run off the + // bottom of the drawing area, but these will just be clipped and a + // little bit of processing time is wasted. + // + } +} + +//***************************************************************************** +// +//! Paints a menu, menu items on a display. +//! +//! \param psWidget is a pointer to the slide menu widget to be drawn. +//! +//! This function draws the contents of a slide menu on the display. This is +//! called in response to a \b WIDGET_MSG_PAINT message. +//! +//! \return None. +// +//***************************************************************************** +static void +SlideMenuPaint(tWidget *psWidget) +{ + tSlideMenuWidget *psMenuWidget; + tContext sContext; + + // + // Check the arguments. + // + ASSERT(psWidget); + + // + // If this widget has a child widget, that means that the menu has + // slid off the screen and the child widget is in control. Therefore + // there is nothing to paint here. Just exit and the child widget will + // be painted. + // + if(psWidget->psChild) + { + return; + } + + // + // Convert the generic widget pointer into a slide menu widget pointer, + // and get a pointer to its context. + // + psMenuWidget = (tSlideMenuWidget *)psWidget; + + // + // Initialize a context for the primary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + GrContextInit(&sContext, psMenuWidget->psDisplayA); + + // + // Render the menu into the off-screen buffer, using normal vertical + // position. + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Initialize a drawing context for the display where the widget is to be + // drawn. This is the physical display, not an off-screen buffer. + // + GrContextInit(&sContext, psWidget->psDisplay); + + // + // Initialize the clipping region on the physical display, based on the + // extents of this widget. + // + GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); + + // + // Now copy the rendered menu into the physical display. This will show + // the menu on the display. + // + GrImageDraw(&sContext, psMenuWidget->psDisplayA->pvDisplayData, + psWidget->sPosition.i16XMin, psWidget->sPosition.i16YMin); +} + +//***************************************************************************** +// +//! Performs the sliding menu operation, in response to the "down" button. +//! +//! \param psWidget is a pointer to the slide menu widget to move down. +//! +//! This function will respond to the "down" key/button event. The down +//! button is used to select the next menu item down the list, and the effect +//! is that the menu itself slides up, leaving the highlighted menu item +//! in the middle of the screen. +//! +//! This function repeatedly draws the menu onto the display until the sliding +//! animation is finished and will not return to the caller until then. This +//! function is usually called from the thread context of +//! WidgetMessageQueueProcess(). +//! +//! \return Returns a non-zero value if the menu was moved or was not moved +//! because it is already at the last position. If a child widget is active +//! then this function does nothing and returns a 0. +// +//***************************************************************************** +static int32_t +SlideMenuDown(tWidget *psWidget) +{ + tSlideMenuWidget *psMenuWidget; + tSlideMenu *psMenu; + tContext sContext; + uint32_t ui32MenuHeight; + uint32_t ui32Y; + + // + // If this menu widget has a child widget, that means the child widget + // is in control of the display, and there is nothing to do here. + // + if(psWidget->psChild) + { + return(0); + } + + // + // Get handy pointers to the menu widget, and the menu that is currently + // displayed. + // + psMenuWidget = (tSlideMenuWidget *)psWidget; + psMenu = psMenuWidget->psSlideMenu; + + // + // If we are already at the end of the list of menu items, then there + // is nothing else to do. + // + if(psMenu->ui32FocusIndex >= (psMenu->ui32Items - 1)) + { + return(1); + } + + // + // Increment focus menu item. This has the effect of selecting the next + // menu item in the list. + // + psMenu->ui32FocusIndex++; + + // + // Initialize a context for the primary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + GrContextInit(&sContext, psMenuWidget->psDisplayA); + + // + // Render the menu into the off-screen buffer. This will be the same + // menu appearance as before, except the highlighted item has changed + // to the next menu item down. + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Draw a continuation of this menu in the second offscreen buffer. + // This is the part of the menu that would be drawn if the display were + // twice as tall. We are effectively creating a virtual display that is + // twice as tall as the physical display. + // + GrContextInit(&sContext, psMenuWidget->psDisplayB); + SlideMenuDraw(psMenuWidget, &sContext, -1 * + (psMenuWidget->sBase.sPosition.i16YMax - + psMenuWidget->sBase.sPosition.i16YMin)); + + // + // Initialize a drawing context for the display where the widget is to be + // drawn. This is the physical display, not an off-screen buffer. + // + GrContextInit(&sContext, psWidget->psDisplay); + + // + // Initialize the clipping region on the physical display, based on the + // extents of this widget. + // + GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); + + // + // Get the height of the displayed part of the menu. + // + ui32MenuHeight = psMenuWidget->psDisplayA->ui16Height; + + // + // Now copy the rendered menu into the physical display + // + // Iterate over the Y displacement of one menu item cell. This loop + // will repeatedly draw both off screen buffers to the physical display, + // adjusting the position of each by one pixel each time it is drawn. Each + // time the offset is changed so that both buffers are drawn one higher + // than the previous time. This will have the effect of "sliding" the + // entire menu up by the height of one menu item cell. + // The speed of the animation is controlled entirely by the speed of the + // processor and the speed of the interface to the physical display. + // + for(ui32Y = 0; ui32Y <= psMenuWidget->ui32MenuItemHeight; ui32Y++) + { + GrImageDraw(&sContext, psMenuWidget->psDisplayA->pvDisplayData, + psWidget->sPosition.i16XMin, + psWidget->sPosition.i16YMin - ui32Y); + GrImageDraw(&sContext, psMenuWidget->psDisplayB->pvDisplayData, + psWidget->sPosition.i16XMin, + psWidget->sPosition.i16YMin + ui32MenuHeight - ui32Y); + } + + // + // Increment centered menu item. This will now match the menu item with + // the focus. When the menu is repainted again, the newly selected + // menu item will be centered and highlighted. + // + psMenu->ui32CenterIndex = psMenu->ui32FocusIndex; + + // + // Initialize a context for the primary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + GrContextInit(&sContext, psMenuWidget->psDisplayA); + + // + // Render the menu into the off-screen buffer. This will be the same + // menu appearance as before, except the highlighted item has changed + // to the next menu item down. Now when a repaint occurs the menu + // will be redrawn with the newly highlighted menu item. + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Return indication that we handled the key event. + // + return(1); +} + +//***************************************************************************** +// +//! Performs the sliding menu operation, in response to the "up" button. +//! +//! \param psWidget is a pointer to the slide menu widget to move up. +//! +//! This function will respond to the "up" key/button event. The up +//! button is used to select the previous menu item down the list, and the +//! effect is that the menu itself slides down, leaving the highlighted menu +//! item in the middle of the screen. +//! +//! This function repeatedly draws the menu onto the display until the sliding +//! animation is finished and will not return to the caller until then. This +//! function is usually called from the thread context of +//! WidgetMessageQueueProcess(). +//! +//! \return Returns a non-zero value if the menu was moved or was not moved +//! because it is already at the first position. If a child widget is active +//! then this function does nothing and returns a 0. +// +//***************************************************************************** +static int32_t +SlideMenuUp(tWidget *psWidget) +{ + tSlideMenuWidget *psMenuWidget; + tSlideMenu *psMenu; + tContext sContext; + uint32_t ui32MenuHeight; + uint32_t ui32Y; + + // + // If this menu widget has a child widget, that means the child widget + // is in control of the display, and there is nothing to do here. + // + if(psWidget->psChild) + { + return(0); + } + + // + // Get handy pointers to the menu widget, and the menu that is currently + // displayed. + // + psMenuWidget = (tSlideMenuWidget *)psWidget; + psMenu = psMenuWidget->psSlideMenu; + + // + // If we are already at the start of the list of menu items, then there + // is nothing else to do. + // + if(psMenu->ui32FocusIndex == 0) + { + return(1); + } + + // + // Decrement the focus menu item. This has the effect of selecting the + // previous menu item in the list. + // + psMenu->ui32FocusIndex--; + + // + // Initialize a context for the primary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + GrContextInit(&sContext, psMenuWidget->psDisplayA); + + // + // Render the menu into the off-screen buffer. This will be the same + // menu appearance as before, except the highlighted item has changed + // to the previous menu item up. + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Draw a continuation of this menu in the second offscreen buffer. + // This is the part of the menu that would be drawn above this menu if the + // display were twice as tall. We are effectively creating a virtual + // display that is twice as tall as the physical display. + // + GrContextInit(&sContext, psMenuWidget->psDisplayB); + SlideMenuDraw(psMenuWidget, &sContext, + (psMenuWidget->sBase.sPosition.i16YMax - + psMenuWidget->sBase.sPosition.i16YMin)); + + // + // Initialize a drawing context for the display where the widget is to be + // drawn. This is the physical display, not an off-screen buffer. + // + GrContextInit(&sContext, psWidget->psDisplay); + + // + // Initialize the clipping region on the physical display, based on the + // extents of this widget. + // + GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); + + // + // Get the height of the displayed part of the menu. + // + ui32MenuHeight = psMenuWidget->psDisplayA->ui16Height; + + // + // Now copy the rendered menu into the physical display + // + // Iterate over the Y displacement of one menu item cell. This loop + // will repeatedly draw both off screen buffers to the physical display, + // adjusting the position of each by one pixel each time it is drawn. Each + // time the offset is changed so that both buffers are drawn one lower + // than the previous time. This will have the effect of "sliding" the + // entire menu down by the height of one menu item cell. + // The speed of the animation is controlled entirely by the speed of the + // processor and the speed of the interface to the physical display. + // + for(ui32Y = 0; ui32Y <= psMenuWidget->ui32MenuItemHeight; ui32Y++) + { + GrImageDraw(&sContext, psMenuWidget->psDisplayB->pvDisplayData, + psWidget->sPosition.i16XMin, + psWidget->sPosition.i16YMin + ui32Y - ui32MenuHeight); + GrImageDraw(&sContext, psMenuWidget->psDisplayA->pvDisplayData, + psWidget->sPosition.i16XMin, + psWidget->sPosition.i16YMin + ui32Y); + } + + // + // Decrement the centered menu item. This will now match the menu item + // with the focus. When the menu is repainted again, the newly selected + // menu item will be centered and highlighted. + // + psMenu->ui32CenterIndex = psMenu->ui32FocusIndex; + + // + // Initialize a context for the primary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + GrContextInit(&sContext, psMenuWidget->psDisplayA); + + // + // Render the menu into the off-screen buffer. This will be the same + // menu appearance as before, except the highlighted item has changed + // to the next menu item up. Now when a repaint occurs the menu + // will be redrawn with the newly highlighted menu item. + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Return indication that we handled the key event. + // + return(1); +} + +//***************************************************************************** +// +//! Performs the sliding menu operation, in response to the "right" button. +//! +//! \param psWidget is a pointer to the slide menu widget to move to the right. +//! +//! This function will respond to the "right" key/button event. The right +//! button is used to select the next menu level below the current menu item, +//! or a widget that is activated by the menu item. The effect is that the +//! menu itself slides off to the left, and the new menu or widget slides in +//! from the right. +//! +//! This function repeatedly draws the menu onto the display until the sliding +//! animation is finished and will not return to the caller until then. This +//! function is usually called from the thread context of +//! WidgetMessageQueueProcess(). +//! +//! \return Returns a non-zero value if the menu was moved or was not moved +//! because it is already at the last position. If a child widget is active +//! then this function does nothing and returns a 0. +// +//***************************************************************************** +static int32_t +SlideMenuRight(tWidget *psWidget) +{ + tSlideMenuWidget *psMenuWidget; + tSlideMenu *psMenu; + tSlideMenu *psChildMenu; + tContext sContext; + tWidget *psChildWidget; + uint32_t ui32X; + uint32_t ui32MenuWidth; + + // + // If this menu widget has a child widget, that means the child widget + // is in control of the display, and there is nothing to do here. + // + if(psWidget->psChild) + { + return(0); + } + + // + // Get handy pointers to the menu widget, and the current menu, and the + // child menu and widget if they exist. + // + psMenuWidget = (tSlideMenuWidget *)psWidget; + psMenu = psMenuWidget->psSlideMenu; + psChildMenu = psMenu->psSlideMenuItems[psMenu->ui32FocusIndex].psChildMenu; + psChildWidget = psMenu->psSlideMenuItems[psMenu->ui32FocusIndex].psChildWidget; + + // + // Initialize a context for the secondary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + GrContextInit(&sContext, psMenuWidget->psDisplayB); + + // + // Render the current menu into off-screen buffer B. This + // will be the same menu appearance as is already being shown. + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Now set up context for drawing into off-screen buffer A + // + GrContextInit(&sContext, psMenuWidget->psDisplayA); + + // + // Process child menu of this menu item + // + if(psChildMenu) + { + // + // Switch the active menu for this SlideMenuWidget to be the child + // menu + // + psMenuWidget->psSlideMenu = psChildMenu; + + // + // Draw the new (child) menu into off-screen buffer A + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + } + + // + // Process child widget of this menu item. This only happens if there + // is no child menu. + // + else if(psChildWidget) + { + // + // Call the widget activated callback function. This will notify + // the application that a child widget has been activated by the + // menu system. + // + if(psMenuWidget->pfnActive) + { + psMenuWidget->pfnActive(psChildWidget, + &psMenu->psSlideMenuItems[psMenu->ui32FocusIndex], + 1); + } + + // + // Link the new child widget into this SlideMenuWidget so + // it appears as a child to this widget. Normally the menu widget + // has no child widget. + // + psWidget->psChild = psChildWidget; + psChildWidget->psParent = psWidget; + + // + // Fill a rectangle with the new child widget background color. + // This is done in off-screen buffer A. When the menu slides off, + // it will be replaced by a blank background that will then be + // controlled by the new child widget. + // + GrContextForegroundSet( + &sContext, + psMenu->psSlideMenuItems[psMenu->ui32FocusIndex].ui32ChildWidgetColor); + GrRectFill(&sContext, &sContext.sClipRegion); + + // + // Request a repaint for the child widget so it can draw itself once + // the menu slide is done. + // + WidgetPaint(psChildWidget); + } + + // + // There is no child menu or child widget, so there is nothing to change + // on the display. + // + else + { + return(1); + } + + // + // Initialize a drawing context for the display where the widget is to be + // drawn. This is the physical display, not an off-screen buffer. + // + GrContextInit(&sContext, psWidget->psDisplay); + + // + // Initialize the clipping region on the physical display, based on the + // extents of this widget. + // + GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); + + // + // Get the width of the menu widget which is used in calculations below + // + ui32MenuWidth = psMenuWidget->psDisplayA->ui16Width; + + // + // The following loop draws the two off-screen buffers onto the physical + // display using a right-to-left-wipe. This will provide an appearance + // of sliding to the left. The new child menu, or child widget background + // will slide in from the right. The "old" menu is being held in + // off-screen buffer B and the new one is in buffer A. So when we are + // done, the correct image will be in buffer A. + // + for(ui32X = 0; ui32X <= ui32MenuWidth; ui32X += 8) + { + GrImageDraw(&sContext, psMenuWidget->psDisplayB->pvDisplayData, + psWidget->sPosition.i16XMin - ui32X, + psWidget->sPosition.i16YMin); + GrImageDraw(&sContext, psMenuWidget->psDisplayA->pvDisplayData, + psWidget->sPosition.i16XMin + ui32MenuWidth - ui32X, + psWidget->sPosition.i16YMin); + } + + // + // Return indication that we handled the key event. + // + return(1); +} + +//***************************************************************************** +// +//! Performs the sliding menu operation, in response to the "left" button. +//! +//! \param psWidget is a pointer to the slide menu widget to move to the left. +//! +//! This function will respond to the "left" key/button event. The left +//! button is used to ascend to the next menu up in the menu tree. The effect +//! is that the current menu, or active widget, slides off to the right, while +//! the parent menu slides in from the left. +//! +//! This function repeatedly draws the menu onto the display until the sliding +//! animation is finished and will not return to the caller until then. This +//! function is usually called from the thread context of +//! WidgetMessageQueueProcess(). +//! +//! \return Returns a non-zero value if the menu was moved or was not moved +//! because it is already at the last position. If a child widget is active +//! then this function does nothing and returns a 0. +// +//***************************************************************************** +static int32_t +SlideMenuLeft(tWidget *psWidget) +{ + tSlideMenuWidget *psMenuWidget; + tSlideMenu *psMenu; + tSlideMenu *psParentMenu; + tContext sContext; + uint32_t ui32X; + uint32_t ui32MenuWidth; + + // + // Get handy pointers to the menu widget and active menu, and the parent + // menu if there is one. + // + psMenuWidget = (tSlideMenuWidget *)psWidget; + psMenu = psMenuWidget->psSlideMenu; + psParentMenu = psMenu->psParent; + + // + // Initialize a context for the primary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + GrContextInit(&sContext, psMenuWidget->psDisplayB); + + // + // If this widget has a child, that means that the child widget is in + // control, and we are requested to go back to the previous menu item. + // Process the child widget. + // + if(psWidget->psChild) + { + // + // Call the widget de-activated callback function. This notifies the + // application that the widget is being deactivated. + // + if(psMenuWidget->pfnActive) + { + psMenuWidget->pfnActive(psWidget->psChild, + &psMenu->psSlideMenuItems[psMenu->ui32FocusIndex], + 0); + } + + // + // Unlink the child widget from the slide menu widget. The menu + // widget will now no longer have a child widget. + // + psWidget->psChild->psParent = 0; + psWidget->psChild = 0; + + // + // Fill a rectangle with the child widget background color. This will + // erase everything else that is shown on the widget but leave the + // background, which will make the change visually less jarring. + // This is done in off-screen buffer B, which is the buffer that is + // going to be slid off the screen. + // + GrContextForegroundSet( + &sContext, + psMenu->psSlideMenuItems[psMenu->ui32FocusIndex].ui32ChildWidgetColor); + GrRectFill(&sContext, &sContext.sClipRegion); + } + + // + // Otherwise there is not a child widget in control, so process the parent + // menu, if there is one. + // + else if(psParentMenu) + { + // + // Render the current menu into the off-screen buffer B. This will be + // the same menu appearance that is currently on the display. + // + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Now switch the widget to the parent menu + // + psMenuWidget->psSlideMenu = psParentMenu; + } + + // + // Otherwise, we are already at the top level menu and there is nothing + // else to do. + // + else + { + return(1); + } + + // + // Draw the new menu in the second offscreen buffer. This is the menu + // that will be on the display when the animation is over. + // + GrContextInit(&sContext, psMenuWidget->psDisplayA); + SlideMenuDraw(psMenuWidget, &sContext, 0); + + // + // Initialize a drawing context for the display where the widget is to be + // drawn. This is the physical display, not an off-screen buffer. + // + GrContextInit(&sContext, psWidget->psDisplay); + + // + // Initialize the clipping region on the physical display, based on the + // extents of this widget. + // + GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); + + // + // Get the width of the menu widget. + // + ui32MenuWidth = psMenuWidget->psDisplayA->ui16Width; + + // + // The following loop draws the two off-screen buffers onto the physical + // display using a left-to-right. This will provide an appearance + // of sliding to the right. The parent menu will slide in from the left. + // The "old" child menu is being held in off-screen buffer B and the new + // one is in buffer A. So when we are done, the correct image will be in + // buffer A. + // + for(ui32X = 0; ui32X <= ui32MenuWidth; ui32X += 8) + { + GrImageDraw(&sContext, psMenuWidget->psDisplayB->pvDisplayData, + psWidget->sPosition.i16XMin + ui32X, + psWidget->sPosition.i16YMin); + GrImageDraw(&sContext, psMenuWidget->psDisplayA->pvDisplayData, + psWidget->sPosition.i16XMin + ui32X - ui32MenuWidth, + psWidget->sPosition.i16YMin); + } + + // + // Return indication that we handled the key event. + // + return(1); +} + +//***************************************************************************** +// +//! Handles menu selection, in response to the "select" button. +//! +//! \param psWidget is a pointer to the slide menu widget to use for a +//! select operation. +//! +//! This function will allow for checking or unchecking multi-selectable +//! menu items. If the menu does not allow multiple selection, then it +//! treats it as a "right" button press. +//! +//! \return Returns a non-zero value if the key was handled. Returns 0 if the +//! key was not handled. +// +//***************************************************************************** +static int32_t +SlideMenuClick(tWidget *psWidget) +{ + tSlideMenuWidget *psMenuWidget; + tSlideMenu *psMenu; + + // + // If a child widget is in control then there is nothing to do. + // + if(psWidget->psChild) + { + return(0); + } + + // + // Get handy pointers to the menu widget and current menu. + // + psMenuWidget = (tSlideMenuWidget *)psWidget; + psMenu = psMenuWidget->psSlideMenu; + + // + // Check to see if this menu allows multiple selection. + // + if(psMenu->bMultiSelectable) + { + // + // Toggle the selection status of the currently highlighted menu + // item, and then repaint it. + // + psMenu->ui32SelectedFlags ^= 1 << psMenu->ui32FocusIndex; + SlideMenuPaint(psWidget); + + // + // We are done so return indication that we handled the key event. + // + return(1); + } + + // + // Otherwise, treat the select button the same as a right button. + // + return(SlideMenuRight(psWidget)); +} + +//***************************************************************************** +// +//! Process key/button event to decide how to move the sliding menu. +//! +//! \param psWidget is a pointer to the slide menu widget to process. +//! \param ui32Msg is the message containing the key event. +//! +//! This function is used to specifically handle key events destined for the +//! slide menu widget. It decides which menu movement function should be +//! called for each key event. +//! +//! \return Returns an indication if the key was handled. Non-zero if the +//! key event was handled or else 0. +// +//***************************************************************************** +static int32_t +SlideMenuMove(tWidget *psWidget, uint32_t ui32Msg) +{ + // + // Process the key event. + // + switch(ui32Msg) + { + // + // User presses select button. + // + case WIDGET_MSG_KEY_SELECT: + { + return(SlideMenuClick(psWidget)); + } + + // + // User presses up button. + // + case WIDGET_MSG_KEY_UP: + { + return(SlideMenuUp(psWidget)); + } + + // + // User presses down button. + // + case WIDGET_MSG_KEY_DOWN: + { + return(SlideMenuDown(psWidget)); + } + + // + // User presses left button. + // + case WIDGET_MSG_KEY_LEFT: + { + return(SlideMenuLeft(psWidget)); + } + + // + // User presses right button. + // + case WIDGET_MSG_KEY_RIGHT: + { + return(SlideMenuRight(psWidget)); + } + + // + // This is an unexpected event. Return an indication that the event + // was not handled. + // + default: + { + return(0); + } + } +} + +//***************************************************************************** +// +//! Handles messages for a slide menu widget. +//! +//! \param psWidget is a pointer to the slide menu widget. +//! \param ui32Msg is the message. +//! \param ui32Param1 is the first parameter to the message. +//! \param ui32Param2 is the second parameter to the message. +//! +//! This function receives messages intended for this slide menu widget and +//! processes them accordingly. The processing of the message varies based on +//! the message in question. +//! +//! Unrecognized messages are handled by calling WidgetDefaultMsgProc(). +//! +//! \return Returns a value appropriate to the supplied message. +// +//***************************************************************************** +int32_t +SlideMenuMsgProc(tWidget *psWidget, uint32_t ui32Msg, uint32_t ui32Param1, + uint32_t ui32Param2) +{ + // + // Check the arguments. + // + ASSERT(psWidget); + + // + // Determine which message is being sent. + // + switch(ui32Msg) + { + // + // The widget paint request has been sent. + // + case WIDGET_MSG_PAINT: + { + // + // Handle the widget paint request. + // + SlideMenuPaint(psWidget); + + // + // Return one to indicate that the message was successfully + // processed. + // + return(1); + } + + // + // A key event has been received. By convention, this widget will + // process the key events if ui32Param1 is set to this widget. + // Otherwise a different widget has the "focus" for key events. + // + case WIDGET_MSG_KEY_SELECT: + case WIDGET_MSG_KEY_UP: + case WIDGET_MSG_KEY_DOWN: + case WIDGET_MSG_KEY_LEFT: + case WIDGET_MSG_KEY_RIGHT: + { + // + // If this key event is for us, then process the event. + // + if((tWidget *)ui32Param1 == psWidget) + { + return(SlideMenuMove(psWidget, ui32Msg)); + } + } + + // + // An unknown request has been sent. This widget does not handle + // pointer events, so they get dumped here if they occur. + // + default: + { + // + // Let the default message handler process this message. + // + return(WidgetDefaultMsgProc(psWidget, ui32Msg, ui32Param1, + ui32Param2)); + } + } +} + +//***************************************************************************** +// +//! Initializes a slide menu widget. +//! +//! \param psWidget is a pointer to the slide menu widget to initialize. +//! \param psDisplay is a pointer to the display on which to draw the menu. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param psDisplayOffA is one of two off-screen displays used for rendering. +//! \param psDisplayOffB is one of two off-screen displays used for rendering. +//! \param ui32ItemHeight is the height of a menu item +//! \param ui32Foreground is the foreground color used for menu item boundaries +//! and text. +//! \param ui32Background is the background color of a menu item. +//! \param ui32Highlight is the color of a highlighted menu item. +//! \param psFont is a pointer to the font that should be used for text. +//! \param psMenu is the initial menu to display +//! +//! This function initializes the caller provided slide menu widget. +//! +//! \return None. +// +//***************************************************************************** +void +SlideMenuInit(tSlideMenuWidget *psWidget, const tDisplay *psDisplay, + int32_t i32X, int32_t i32Y, int32_t i32Width, int32_t i32Height, + tDisplay *psDisplayOffA, tDisplay *psDisplayOffB, + uint32_t ui32ItemHeight, uint32_t ui32Foreground, + uint32_t ui32Background, uint32_t ui32Highlight, + tFont *psFont, tSlideMenu *psMenu) +{ + uint32_t ui32Idx; + + // + // Check the arguments. + // + ASSERT(psWidget); + ASSERT(psDisplay); + ASSERT(psDisplayOffA); + ASSERT(psDisplayOffB); + ASSERT(psFont); + ASSERT(psMenu); + + // + // Clear out the widget structure. + // + for(ui32Idx = 0; ui32Idx < sizeof(tSlideMenuWidget); ui32Idx += 4) + { + ((uint32_t *)psWidget)[ui32Idx / 4] = 0; + } + + // + // Set the size of the widget structure. + // + psWidget->sBase.i32Size = sizeof(tSlideMenuWidget); + + // + // Mark this widget as fully disconnected. + // + psWidget->sBase.psParent = 0; + psWidget->sBase.psNext = 0; + psWidget->sBase.psChild = 0; + + // + // Save the display pointer. + // + psWidget->sBase.psDisplay = psDisplay; + + // + // Set the extents of the display area. + // + psWidget->sBase.sPosition.i16XMin = i32X; + psWidget->sBase.sPosition.i16YMin = i32Y; + psWidget->sBase.sPosition.i16XMax = i32X + i32Width - 1; + psWidget->sBase.sPosition.i16YMax = i32Y + i32Height - 1; + + // + // Initialize the widget fields + // + psWidget->psDisplayA = psDisplayOffA; + psWidget->psDisplayB = psDisplayOffB; + psWidget->ui32MenuItemHeight = ui32ItemHeight; + psWidget->ui32ColorForeground = ui32Foreground; + psWidget->ui32ColorBackground = ui32Background; + psWidget->ui32ColorHighlight = ui32Highlight; + psWidget->psFont = psFont; + psWidget->psSlideMenu = psMenu; + + // + // Use the slide menu message handler to process messages to this widget. + // + psWidget->sBase.pfnMsgProc = SlideMenuMsgProc; +} + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** diff --git a/boards/ek-lm4f232/drivers/slidemenuwidget.h b/boards/ek-lm4f232/drivers/slidemenuwidget.h new file mode 100644 index 0000000..c7a1647 --- /dev/null +++ b/boards/ek-lm4f232/drivers/slidemenuwidget.h @@ -0,0 +1,457 @@ +//***************************************************************************** +// +// slidemenuwidget.h - Prototypes for a sliding menu widget. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __SLIDEMENUWIDGET_H__ +#define __SLIDEMENUWIDGET_H__ + +//***************************************************************************** +// +//! \addtogroup slidemenuwidget_api +//! @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +//! The structure that describes a menu item in the menu tree. +// +//***************************************************************************** +typedef struct _SlideMenuItem +{ + // + //! A pointer to text to be rendered within the node. + // + char *pcText; + + // + //! A child menu that is activated by this menu item, if any. Can be NULL. + // + struct _SlideMenu *psChildMenu; + + // + //! A child widget that is activated by this menu item, if any. Can be + //! NULL. If both child menu and child widget are specified, the child + //! menu will be used. + // + tWidget *psChildWidget; + + // + //! A color that is used when a child widget is activated. This is the + //! color that is used as a background when the menu slides off to make + //! the screen available for the child widget. By choosing this color to + //! match the background that is used in the child widget, the sliding + //! animation and widget painting appears smoother. + // + uint32_t ui32ChildWidgetColor; +} +tSlideMenuItem; + +//***************************************************************************** +// +//! The structure that describes a menu. +// +//***************************************************************************** +typedef struct _SlideMenu +{ + // + //! The parent menu of this menu. + // + struct _SlideMenu *psParent; + + // + //! The total number of items in this menu. + // + uint32_t ui32Items; + + // + //! A pointer to the array of menu item structures. + // + tSlideMenuItem *psSlideMenuItems; + + // + //! The menu item index of the item shown on the center of the screen. + //! Normally this is the same as the menu item that has the focus, but + //! can be different during the time when the menu is "sliding". When this + //! is 0, the first menu item is shown in the center of the screen and the + //! successive items are shown below it. When non-zero, then this menu + //! item is shown in the center, with preceding menu items shown above + //! and successive items shown below. + // + uint32_t ui32CenterIndex; + + // + //! The menu item index that has the focus. + // + uint32_t ui32FocusIndex; + + // + //! A flag to indicate if more than one menu item is selectable. + // + bool bMultiSelectable; + + // + //! A set of bit flags to indicate which menu items are selected. + // + uint32_t ui32SelectedFlags; +} tSlideMenu; + +//***************************************************************************** +// +//! The structure that describes a slide menu widget. +// +//***************************************************************************** +typedef struct +{ + // + //! The generic widget information. + // + tWidget sBase; + + // + //! A pointer to an off-screen display that is used for rendering the + //! menus prior to showing on the widget's area of the screen. There + //! are two off-screen displays. Each should be the size of the widget + //! area. The palette should include any colors that are used by this + //! widget. + // + tDisplay *psDisplayA; + + // + //! A pointer to a second off-screen display. + // + tDisplay *psDisplayB; + + // + //! The height, in pixels, of a single menu item (a cell). + // + uint32_t ui32MenuItemHeight; + + // + //! The color used for drawing menu item cell boundaries and text. + // + uint32_t ui32ColorForeground; + + // + //! The background color of menu item cells. + // + uint32_t ui32ColorBackground; + + // + //! The color of a highlighted menu item. + // + uint32_t ui32ColorHighlight; + + // + //! The font to use for menu text. + // + const tFont *psFont; + + // + //! The current menu to display. + // + tSlideMenu *psSlideMenu; + + // + // A function to call when a child widget becomes active or inactive + // + void (*pfnActive)(tWidget *psWidget, tSlideMenuItem *psMenuItem, + bool bActivated); +} +tSlideMenuWidget; + +//***************************************************************************** +// +//! Declares an initialized slide menu widget data structure. +//! +//! \param pParent is a pointer to the parent widget. +//! \param pNext is a pointer to the sibling widget. +//! \param pChild is a pointer to the first child widget. +//! \param pDisplay is a pointer to the off-screen display on which to draw. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param psDisplayA is one of two off-screen displays for rendering menus. +//! \param psDisplayB is one of two off-screen displays for rendering menus. +//! \param ui32MenuItemHeight is the height of a menu item. +//! \param ui32Foreground is the foreground color for menu item boundaries and +//! text. +//! \param ui32Background is the background color of the menu items. +//! \param ui32Highlight is the color of a highlighted menu item. +//! \param psFont is the font to use for the menu text. +//! \param psMenu is the initial menu to display. +//! \param pfnWidgetActive is a pointer to a function that will be called when +//! a child widget is activated or deactivated. +//! +//! This macro provides an initialized slide menu widget data structure, which +//! can be used to construct the widget tree at compile time in global variables +//! (as opposed to run-time via function calls). This must be assigned to a +//! variable, such as: +//! +//! \verbatim +//! tSlideMenuWidget g_i16SlideMenu = SlideMenuStruct(...); +//! \endverbatim +//! +//! Or, in an array of variables: +//! +//! \verbatim +//! tSlideMenuWidget g_pi16SlideMenu[] = +//! { +//! SlideMenuStruct(...), +//! SlideMenuStruct(...) +//! }; +//! \endverbatim +//! +//! \return Nothing; this is not a function. +// +//***************************************************************************** +#define SlideMenuStruct(pParent, pNext, pChild, pDisplay, \ + i32X, i32Y, i32Width, i32Height, \ + psDisplayA, psDisplayB, \ + ui32MenuItemHeight, ui32Foreground, ui32Background, \ + ui32Highlight, psFont, psMenu, pfnWidgetActive) \ + { \ + { \ + sizeof(tSlideMenuWidget), \ + (tWidget *)(pParent), \ + (tWidget *)(pNext), \ + (tWidget *)(pChild), \ + pDisplay, \ + { \ + i32X, \ + i32Y, \ + (i32X) + (i32Width) - 1, \ + (i32Y) + (i32Height) - 1 \ + }, \ + SlideMenuMsgProc \ + }, \ + psDisplayA, \ + psDisplayB, \ + ui32MenuItemHeight, \ + ui32Foreground, \ + ui32Background, \ + ui32Highlight, \ + psFont, \ + psMenu, \ + pfnWidgetActive \ + } + +//***************************************************************************** +// +//! Declares an initialized variable containing a slide menu widget data +//! structure. +//! +//! \param i16Name is the name of the variable to be declared. +//! \param pParent is a pointer to the parent widget. +//! \param pNext is a pointer to the sibling widget. +//! \param pChild is a pointer to the first child widget. +//! \param pDisplay is a pointer to the off-screen display on which to draw. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param psDisplayA is one of two off-screen displays for rendering menus. +//! \param psDisplayB is one of two off-screen displays for rendering menus. +//! \param ui32MenuItemHeight is the height of a menu item. +//! \param ui32Foreground is the foreground color for menu item boundaries and +//! text. +//! \param ui32Background is the background color of the menu items. +//! \param ui32Highlight is the color of a highlighted menu item. +//! \param psFont is the font to use for the menu text. +//! \param psMenu is the initial menu to display. +//! \param pfnWidgetActive is a pointer to a function that will be called when +//! a child widget is activated or deactivated. +//! +//! This macro declares a variable containing an initialized slide menu widget +//! data structure, which can be used to construct the widget tree at compile +//! time in global variables (as opposed to run-time via function calls). +//! +//! \return Nothing; this is not a function. +// +//***************************************************************************** +#define SlideMenu(i16Name, pParent, pNext, pChild, pDisplay, \ + i32X, i32Y, i32Width, i32Height, \ + psDisplayA, psDisplayB, \ + ui32MenuItemHeight, ui32Foreground, ui32Background, \ + ui32Highlight, psFont, psMenu, pfnWidgetActive) \ + tSlideMenuWidget i16Name = \ + SlideMenuStruct(pParent, pNext, pChild, pDisplay, \ + i32X, i32Y, i32Width, i32Height, \ + psDisplayA, psDisplayB, \ + ui32MenuItemHeight, ui32Foreground, ui32Background,\ + ui32Highlight, psFont, psMenu, pfnWidgetActive) + +//***************************************************************************** +// +//! Sets the active menu of the slide menu widget. +//! +//! \param psSlideMenuWidget is a pointer to the slide menu widget to modify. +//! \param psMenu is the new slide menu to make active. +//! +//! This function sets the active menu for the widget. +//! +//! \return None. +// +//***************************************************************************** +#define SlideMenuMenuSet(psSlideMenuWidget, psMenu) \ + do \ + { \ + (psSlideMenuWidget)->psSlideMenu = (psMenu); \ + } while(0) + +//***************************************************************************** +// +//! Sets the active callback function for a slide menu widget. +//! +//! \param psSlideMenuWidget is a pointer to the slide menu widget to modify. +//! \param pfnActivated is a function pointer to the function that should +//! be called when the menu system activates or deactivates a child widget. +//! +//! This function sets the child widget active callback function. +//! +//! \return None. +// +//***************************************************************************** +#define SlideMenuActiveCallbackSet(psSlideMenuWidget, pfnActivated) \ + do \ + { \ + (psSlideMenuWidget)->pfnActive = (pfnActivated); \ + } while(0) + +//***************************************************************************** +// +//! Gets the index of the menu item that has the focus. +//! +//! \param psSlideMenu is a pointer to the menu to query for item index. +//! +//! This function returns the index of the menu item that has the focus for +//! the specified menu. +//! +//! \return Index of the menu item that has the focus. +// +//***************************************************************************** +#define SlideMenuFocusItemGet(psSlideMenu) \ + ((psSlideMenu)->ui32FocusIndex) + +//***************************************************************************** +// +//! Gets the selected items mask for a menu. +//! +//! \param psSlideMenu is a pointer to the menu to query for selected items. +//! +//! This function returns a value that is a bit mask of any menu items that +//! are selected in the current menu. This is meant to work when a menu is +//! configured to be selectable. Then multiple menu items can be selected and +//! the selection mask indicates which are selected. +//! +//! \return Selection bit mask of selected menu items. +// +//***************************************************************************** +#define SlideMenuSelectedGet(psSlideMenu) \ + ((psSlideMenu)->ui32SelectedFlags) + +//***************************************************************************** +// +//! Sets the focus item index for a menu. +//! +//! \param psSlideMenu is a pointer to the menu to set the focus item. +//! \param ui32Focus is the index of the menu item that should have the focus. +//! +//! This function is used to specify which menu item should have the focus. +//! +//! \return None. +// +//***************************************************************************** +#define SlideMenuFocusItemSet(psSlideMenu, ui32Focus) \ + do \ + { \ + (psSlideMenu)->ui32FocusIndex = (ui32Focus); \ + (psSlideMenu)->ui32CenterIndex = (ui32Focus); \ + } while(0) + +//***************************************************************************** +// +//! Sets the selected items bit mask for a menu. +//! +//! \param psSlideMenu is a pointer to the menu to set the selection mask. +//! \param ui32Selected is a bit mask indicating which menu items should be +//! marked as selected. +//! +//! This function is used to specify which menu items are pre-selected. +//! +//! \return None. +// +//***************************************************************************** +#define SlideMenuSelectedSet(psSlideMenu, ui32Selected) \ + do \ + { \ + (psSlideMenu)->ui32SelectedFlags = (ui32Selected); \ + } while(0) + +//***************************************************************************** +// +// Prototypes for the slide menu widget APIs. +// +//***************************************************************************** +extern int32_t SlideMenuMsgProc(tWidget *psWidget, uint32_t ui32Msg, + uint32_t ui32Param1, uint32_t ui32Param2); +void SlideMenuDraw(tSlideMenuWidget *psMenuWidget, tContext *pContext, + int32_t i32OffsetY); +extern void SlideMenuInit(tSlideMenuWidget *psWidget, const tDisplay *pDisplay, + int32_t i32X, int32_t i32Y, int32_t i32Width, int32_t i32Height, + tDisplay *pDisplayOffA, tDisplay *pDisplayOffB, + uint32_t ui32ItemHeight, + uint32_t ui32Foreground, + uint32_t ui32Background, + uint32_t ui32Highlight, + tFont *psFont, tSlideMenu *psMenu); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** + +#endif // __SLIDEMENUWIDGET_H__ diff --git a/boards/ek-lm4f232/drivers/stripchartwidget.c b/boards/ek-lm4f232/drivers/stripchartwidget.c new file mode 100644 index 0000000..60d9d37 --- /dev/null +++ b/boards/ek-lm4f232/drivers/stripchartwidget.c @@ -0,0 +1,672 @@ +//***************************************************************************** +// +// stripchartwidget.c - A simple strip chart widget. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "driverlib/debug.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "stripchartwidget.h" + +//***************************************************************************** +// +//! \addtogroup stripchartwidget_api +//! @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// This is a custom widget for drawing a simple strip chart. The strip +// chart can be configured with an X/Y grid, and data series can be added +// to and displayed on the strip chart. The strip chart can be "advanced" +// so that the grid lines will move on the display. Before advancing +// the chart, the application must update the series data in the buffers. +// The strip chart will only display whatever is in the series buffers, the +// application must scroll the data in the series data buffers. By adjusting +// the data in the series data buffers, advancing the strip chart, and +// repainting, the strip chart can be made to scroll the data across the +// display. +// +//***************************************************************************** + +//***************************************************************************** +// +//! Draws the strip chart into a drawing context, off-screen buffer. +//! +//! \param psChartWidget points at the StripsChartWidget being processed. +//! \param psContext points to the context where all drawing should be done. +//! +//! This function renders a strip chart into a drawing context. +//! It assumes that the drawing context is an off-screen buffer, and that +//! the entire buffer belongs to this widget. +//! +//! \return None. +// +//***************************************************************************** +void +StripChartDraw(tStripChartWidget *psChartWidget, tContext *psContext) +{ + tStripChartAxis *psAxisY; + int32_t i32Y; + int32_t i32Ygrid; + int32_t i32X; + int32_t i32GridRange; + int32_t i32DispRange; + int32_t i32GridMin; + int32_t i32DispMax; + tStripChartSeries *psSeries; + + // + // Check the parameters + // + ASSERT(psChartWidget); + ASSERT(psContext); + ASSERT(psChartWidget->psAxisY); + + // + // Get handy pointer to Y axis + // + psAxisY = psChartWidget->psAxisY; + + // + // Find the range of Y axis in Y axis units + // + i32GridRange = psAxisY->i32Max - psAxisY->i32Min; + + // + // Find the range of the Y axis in display units (pixels) + // + i32DispRange = (psContext->sClipRegion.i16YMax - + psContext->sClipRegion.i16YMin); + + // + // Find the minimum Y units value to be shown, and the maximum of the + // clipping region. + // + i32GridMin = psAxisY->i32Min; + i32DispMax = psContext->sClipRegion.i16YMax; + + // + // Set the fg color for the rectangle fill to match what we want as the + // chart background. + // + GrContextForegroundSet(psContext, psChartWidget->ui32BackgroundColor); + GrRectFill(psContext, &psContext->sClipRegion); + + // + // Draw vertical grid lines + // + GrContextForegroundSet(psContext, psChartWidget->ui32GridColor); + for(i32X = psChartWidget->i32GridX; i32X < psContext->sClipRegion.i16XMax; + i32X += psChartWidget->psAxisX->i32GridInterval) + { + GrLineDrawV(psContext, psContext->sClipRegion.i16XMax - i32X, + psContext->sClipRegion.i16YMin, + psContext->sClipRegion.i16YMax); + } + + // + // Draw horizontal grid lines + // + for(i32Ygrid = psAxisY->i32Min; i32Ygrid < psAxisY->i32Max; + i32Ygrid += psAxisY->i32GridInterval) + { + i32Y = ((i32Ygrid - i32GridMin) * i32DispRange) / i32GridRange; + i32Y = i32DispMax - i32Y; + GrLineDrawH(psContext, psContext->sClipRegion.i16XMin, + psContext->sClipRegion.i16XMax, i32Y); + } + + // + // Compute location of Y=0 line, and draw it + // + i32Y = ((-i32GridMin) * i32DispRange) / i32GridRange; + i32Y = i32DispMax - i32Y; + GrLineDrawH(psContext, psContext->sClipRegion.i16XMin, + psContext->sClipRegion.i16XMax, i32Y); + + // + // Iterate through each series to draw it + // + psSeries = psChartWidget->psSeries; + while(psSeries) + { + int idx = 0; + + // + // Find the starting X position on the display for this series. + // If the series has less data points than can fit on the display + // then starting X can be somewhere in the middle of the screen. + // + i32X = 1 + psContext->sClipRegion.i16XMax - psSeries->ui16NumItems; + + // + // If the starting X is off the left side of the screen, then the + // staring index (idx) for reading data needs to be adjusted to the + // first value in the series that will be visible on the screen + // + if(i32X < psContext->sClipRegion.i16XMin) + { + idx = psContext->sClipRegion.i16XMin - i32X; + i32X = psContext->sClipRegion.i16XMin; + } + + // + // Set the drawing color for this series + // + GrContextForegroundSet(psContext, psSeries->ui32Color); + + // + // Scan through all possible X values, find the Y value, and draw the + // pixel. + // + for(; i32X <= psContext->sClipRegion.i16XMax; i32X++) + { + // + // Find the Y value at each position in the data series. Take into + // account the data size and the stride + // + if(psSeries->ui8DataTypeSize == 1) + { + i32Y = + ((int8_t *)psSeries->pvData)[idx * psSeries->ui8Stride]; + } + else if(psSeries->ui8DataTypeSize == 2) + { + i32Y = + ((int16_t *)psSeries->pvData)[idx * psSeries->ui8Stride]; + } + else if(psSeries->ui8DataTypeSize == 4) + { + i32Y = + ((int32_t *)psSeries->pvData)[idx * psSeries->ui8Stride]; + } + else + { + // + // If there is an invalid data size, then just force Y value + // to be off the display + // + i32Y = i32DispMax + 1; + break; + } + + // + // Advance to the next position in the data series. + // + idx++; + + // + // Now scale the Y value according to the axis scaling + // + i32Y = ((i32Y - i32GridMin) * i32DispRange) / i32GridRange; + i32Y = i32DispMax - i32Y; + + // + // Draw the pixel on the display + // + GrPixelDraw(psContext, i32X, i32Y); + } + + // + // Advance to the next series until there are no more. + // + psSeries = psSeries->psNextSeries; + } + + // + // Draw a frame around the entire chart. + // + GrContextForegroundSet(psContext, psChartWidget->ui32Y0Color); + GrRectDraw(psContext, &psContext->sClipRegion); + + // + // Draw titles + // + GrContextForegroundSet(psContext, psChartWidget->ui32TextColor); + GrContextFontSet(psContext, psChartWidget->psFont); + + // + // Draw the chart title, if there is one + // + if(psChartWidget->pcTitle) + { + GrStringDrawCentered(psContext, psChartWidget->pcTitle, -1, + psContext->sClipRegion.i16XMax / 2, + GrFontHeightGet(psChartWidget->psFont), 0); + } + + // + // Draw the Y axis max label, if there is one + // + if(psChartWidget->psAxisY->pcMaxLabel) + { + GrStringDraw(psContext, psChartWidget->psAxisY->pcMaxLabel, -1, + psContext->sClipRegion.i16XMin + + GrFontMaxWidthGet(psChartWidget->psFont) / 2, + GrFontHeightGet(psChartWidget->psFont) / 2, 0); + } + + // + // Draw the Y axis min label, if there is one + // + if(psChartWidget->psAxisY->pcMinLabel) + { + GrStringDraw(psContext, psChartWidget->psAxisY->pcMinLabel, -1, + psContext->sClipRegion.i16XMin + + GrFontMaxWidthGet(psChartWidget->psFont) / 2, + psContext->sClipRegion.i16YMax - + (GrFontHeightGet(psChartWidget->psFont) + + (GrFontHeightGet(psChartWidget->psFont) / 2)), + 0); + } + + // + // Draw a label for the name of the Y axis, if there is one + // + if(psChartWidget->psAxisY->pcName) + { + GrStringDraw(psContext, psChartWidget->psAxisY->pcName, -1, + psContext->sClipRegion.i16XMin + 1, + (psContext->sClipRegion.i16YMax / 2) - + (GrFontHeightGet(psChartWidget->psFont) / 2), + 1); + } +} + +//***************************************************************************** +// +//! Paints the strip chart on the display. +//! +//! \param psWidget is a pointer to the strip chart widget to be drawn. +//! +//! This function draws the contents of a strip chart on the display. This is +//! called in response to a \b WIDGET_MSG_PAINT message. +//! +//! \return None. +// +//***************************************************************************** +static void +StripChartPaint(tWidget *psWidget) +{ + tStripChartWidget *psChartWidget; + tContext sContext; + + // + // Check the arguments. + // + ASSERT(psWidget); + ASSERT(psWidget->psDisplay); + + // + // Convert the generic widget pointer into a strip chart widget pointer. + // + psChartWidget = (tStripChartWidget *)psWidget; + + // + // Initialize a context for the primary off-screen drawing buffer. + // Clip region is set to entire display by default, which is what we want. + // + ASSERT(psChartWidget->psOffscreenDisplay); + GrContextInit(&sContext, psChartWidget->psOffscreenDisplay); + + // + // Render the strip chart into the off-screen buffer + // + StripChartDraw(psChartWidget, &sContext); + + // + // Initialize a drawing context for the display where the widget is to be + // drawn. This is the physical display, not an off-screen buffer. + // + GrContextInit(&sContext, psWidget->psDisplay); + + // + // Initialize the clipping region on the physical display, based on the + // extents of this widget. + // + GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); + + // + // Now copy the rendered strip chart into the physical display + // + GrImageDraw(&sContext, psChartWidget->psOffscreenDisplay->pvDisplayData, + psWidget->sPosition.i16XMin, psWidget->sPosition.i16YMin); +} + +//***************************************************************************** +// +//! Advances the strip chart X grid by a certain number of pixels. +//! +//! \param psChartWidget is a pointer to the strip chart widget to be advanced. +//! \param i32Count is the number of positions to advance the grid. +//! +//! This function advances the X grid of the strip chart by the specified +//! number of positions. By using this function to advance the grid in +//! combination with updating the data in the series data buffers, the strip +//! chart can be made to appear to scroll across the display. +//! +//! \return None. +// +//***************************************************************************** +void +StripChartAdvance(tStripChartWidget *psChartWidget, int32_t i32Count) +{ + // + // Adjust the starting point of the X-grid + // + psChartWidget->i32GridX += i32Count; + psChartWidget->i32GridX %= psChartWidget->psAxisX->i32GridInterval; +} + +//***************************************************************************** +// +//! Adds a data series to the strip chart. +//! +//! \param psWidget is a pointer to the strip chart widget to be modified. +//! \param psNewSeries is a strip chart data series to be added to the strip +//! chart. +//! +//! This function will add a data series to the strip chart. This function +//! just links the series into the strip chart. It is up to the application +//! to make sure that the data series is initialized correctly. +//! +//! \return None. +// +//***************************************************************************** +void +StripChartSeriesAdd(tStripChartWidget *psWidget, + tStripChartSeries *psNewSeries) +{ + // + // If there is already at least one series in this chart, then link + // in to the existing chain. + // + if(psWidget->psSeries) + { + tStripChartSeries *psSeries = psWidget->psSeries; + while(psSeries->psNextSeries) + { + psSeries = psSeries->psNextSeries; + } + psSeries->psNextSeries = psNewSeries; + } + + // + // Otherwise, there is not already a series in this chart, so set this + // new series as the first series for the chart. + // + else + { + psWidget->psSeries = psNewSeries; + } + psNewSeries->psNextSeries = 0; +} + +//***************************************************************************** +// +//! Removes a data series from the strip chart. +//! +//! \param psWidget is a pointer to the strip chart widget to be modified. +//! \param psOldSeries is a strip chart data series that is to be removed +//! from the strip chart. +//! +//! This function will remove an existing data series from a strip chart. It +//! will search the list of data series for the specified series, and if +//! found it will be unlinked from the chain of data series for this strip +//! chart. +//! +//! \return None. +// +//***************************************************************************** +void +StripChartSeriesRemove(tStripChartWidget *psWidget, + tStripChartSeries *psOldSeries) +{ + // + // If the series to be removed is the first one, then find the next + // series in the chain and set it to be first. + // + if(psWidget->psSeries == psOldSeries) + { + psWidget->psSeries = psOldSeries->psNextSeries; + } + + // + // Otherwise, scan through the chain to find the old series + // + else + { + tStripChartSeries *psSeries = psWidget->psSeries; + while(psSeries->psNextSeries) + { + // + // If the old series is found, unlink it from the chain + // + if(psSeries->psNextSeries == psOldSeries) + { + psSeries->psNextSeries = psOldSeries->psNextSeries; + break; + } + else + { + psSeries = psSeries->psNextSeries; + } + } + } + + // + // Finally, set the "next" pointer of the old series to null so that + // there will not be any confusing chain fragments if this series is + // reused. + // + psOldSeries->psNextSeries = 0; +} + +//***************************************************************************** +// +//! Handles messages for a strip chart widget. +//! +//! \param psWidget is a pointer to the strip chart widget. +//! \param ui32Msg is the message. +//! \param ui32Param1 is the first parameter to the message. +//! \param ui32Param2 is the second parameter to the message. +//! +//! This function receives messages intended for this strip chart widget and +//! processes them accordingly. The processing of the message varies based on +//! the message in question. +//! +//! Unrecognized messages are handled by calling WidgetDefaultMsgProc(). +//! +//! \return Returns a value appropriate to the supplied message. +// +//***************************************************************************** +int32_t +StripChartMsgProc(tWidget *psWidget, uint32_t ui32Msg, uint32_t ui32Param1, + uint32_t ui32Param2) +{ + // + // Check the arguments. + // + ASSERT(psWidget); + + // + // Determine which message is being sent. + // + switch(ui32Msg) + { + // + // The widget paint request has been sent. + // + case WIDGET_MSG_PAINT: + { + // + // Handle the widget paint request. + // + StripChartPaint(psWidget); + + // + // Return one to indicate that the message was successfully + // processed. + // + return(1); + } + + // + // Deliberately ignore all button press messages. They may be handled + // by another widget. + // + case WIDGET_MSG_KEY_SELECT: + case WIDGET_MSG_KEY_UP: + case WIDGET_MSG_KEY_DOWN: + case WIDGET_MSG_KEY_LEFT: + case WIDGET_MSG_KEY_RIGHT: + { + return(0); + } + + // + // An unknown request has been sent. + // + default: + { + // + // Let the default message handler process this message. + // + return(WidgetDefaultMsgProc(psWidget, ui32Msg, ui32Param1, + ui32Param2)); + } + } +} + +//***************************************************************************** +// +//! Initializes a strip chart widget. +//! +//! \param psWidget is a pointer to the strip chart widget to initialize. +//! \param psDisplay is a pointer to the display on which to draw the chart. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param pcTitle is the label text for the strip chart +//! \param psFont is the font to use for drawing text on the chart. +//! \param ui32BackgroundColor is the colr of the background for the chart. +//! \param ui32TextColor is the color used for drawing text. +//! \param ui32Y0Color is the color used for drawing the Y=0 line and the frame +//! around the chart. +//! \param ui32GridColor is the color of the X/Y grid +//! \param psAxisX is a pointer to the X-axis object +//! \param psAxisY is a pointer to the Y-axis object +//! \param psOffscreenDisplay is a pointer to an offscreen display that will +//! be used for rendering the strip chart prior to drawing it on the +//! physical display. +//! +//! This function initializes the caller provided strip chart widget. +//! +//! \return None. +// +//***************************************************************************** +void +StripChartInit(tStripChartWidget *psWidget, const tDisplay *psDisplay, + int32_t i32X, int32_t i32Y, int32_t i32Width, int32_t i32Height, + char * pcTitle, tFont *psFont, + uint32_t ui32BackgroundColor, + uint32_t ui32TextColor, + uint32_t ui32Y0Color, + uint32_t ui32GridColor, + tStripChartAxis *psAxisX, tStripChartAxis *psAxisY, + tDisplay *psOffscreenDisplay) +{ + uint32_t ui32Idx; + + // + // Check the arguments. + // + ASSERT(psWidget); + ASSERT(psDisplay); + ASSERT(psAxisX); + ASSERT(psAxisY); + ASSERT(psOffscreenDisplay); + + // + // Clear out the widget structure. + // + for(ui32Idx = 0; ui32Idx < sizeof(tStripChartWidget); ui32Idx += 4) + { + ((uint32_t *)psWidget)[ui32Idx / 4] = 0; + } + + // + // Set the size of the widget structure. + // + psWidget->sBase.i32Size = sizeof(tStripChartWidget); + + // + // Mark this widget as fully disconnected. + // + psWidget->sBase.psParent = 0; + psWidget->sBase.psNext = 0; + psWidget->sBase.psChild = 0; + + // + // Save the display pointer. + // + psWidget->sBase.psDisplay = psDisplay; + + // + // Set the extents of the display area. + // + psWidget->sBase.sPosition.i16XMin = i32X; + psWidget->sBase.sPosition.i16YMin = i32Y; + psWidget->sBase.sPosition.i16XMax = i32X + i32Width - 1; + psWidget->sBase.sPosition.i16YMax = i32Y + i32Height - 1; + + // + // Initialize the widget fields + // + psWidget->pcTitle = pcTitle; + psWidget->psFont = psFont; + psWidget->ui32BackgroundColor = ui32BackgroundColor; + psWidget->ui32TextColor = ui32TextColor; + psWidget->ui32Y0Color = ui32Y0Color; + psWidget->ui32GridColor = ui32GridColor; + psWidget->psAxisX = psAxisX; + psWidget->psAxisY = psAxisY; + psWidget->psOffscreenDisplay = psOffscreenDisplay; + + // + // Use the strip chart message handler to process messages to this widget. + // + psWidget->sBase.pfnMsgProc = StripChartMsgProc; +} + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** + diff --git a/boards/ek-lm4f232/drivers/stripchartwidget.h b/boards/ek-lm4f232/drivers/stripchartwidget.h new file mode 100644 index 0000000..2c64f6a --- /dev/null +++ b/boards/ek-lm4f232/drivers/stripchartwidget.h @@ -0,0 +1,392 @@ +//***************************************************************************** +// +// stripchartwidget.h - Prototypes for a strip chart widget. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __STRIPCHARTWIDGET_H__ +#define __STRIPCHARTWIDGET_H__ + +//***************************************************************************** +// +//! \addtogroup stripchartwidget_api +//! @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +//! A structure that represents a data series to be shown on the strip chart. +// +//***************************************************************************** +typedef struct _StripChartSeries +{ + // + //! A pointer to the next series in the chart. + // + struct _StripChartSeries *psNextSeries; + + // + //! A pointer to the brief name of the data set + // + char *pcName; + + // + //! The color of the data series. + // + uint32_t ui32Color; + + // + //! The number of bytes of the data type (1, 2, or 4) + // + uint8_t ui8DataTypeSize; + + // + //! The stride of the data. This can be used when this data set is + //! part of a larger set of samples that appear in a large array + //! interleaved at a regular interval. Use a value of 1 if the data set + //! is not interleaved. + // + uint8_t ui8Stride; + + // + //! The number of items in the data set + // + uint16_t ui16NumItems; + + // + //! A pointer to the first data item. + // + void *pvData; +} +tStripChartSeries; + +//***************************************************************************** +// +//! A structure that represents an axis of the strip chart. +// +//***************************************************************************** +typedef struct _StripChartAxis +{ + // + //! A brief name for the axis. Leave null for no name to be shown. + // + char *pcName; + + // + //! Label for the minimum extent of the axis. Leave null for no label. + // + char *pcMinLabel; + + // + //! Label for the max extent of the axis. Leave null for no label. + // + char *pcMaxLabel; + + // + //! The minimum units value for the axis. + // + int32_t i32Min; + + // + //! The maximum units value for the axis + // + int32_t i32Max; + + // + //! The grid interval for the axis. Use 0 for no grid. + // + int32_t i32GridInterval; +} tStripChartAxis; + +//***************************************************************************** +// +//! A structure that represents a strip chart widget. +// +//***************************************************************************** +typedef struct _StripChartWidget +{ + // + //! The generic widget information. + // + tWidget sBase; + + // + //! The title for the strip chart. Leave null for no title. + // + char *pcTitle; + + // + //! The font to use for drawing text on the chart. + // + const tFont *psFont; + + // + //! The background color of the chart. + // + uint32_t ui32BackgroundColor; + + // + //! The color for text that is drawn on the chart (titles, etc). + // + uint32_t ui32TextColor; + + // + //! The color of the Y-axis 0-crossing line. + // + uint32_t ui32Y0Color; + + // + //! The color of the grid lines. + // + uint32_t ui32GridColor; + + // + //! The X axis + // + tStripChartAxis *psAxisX; + + // + //! The Y axis + // + tStripChartAxis *psAxisY; + + // + //! A pointer to the first data series for the strip chart. + // + tStripChartSeries *psSeries; + + // + //! A pointer to an off-screen display to be used for rendering the chart. + // + const tDisplay *psOffscreenDisplay; + + // + //! The current X-grid alignment. This value changes in order to give the + //! appearance of the grid moving as the strip chart advances. + // + int32_t i32GridX; +} tStripChartWidget; + +//***************************************************************************** +// +//! Declares an initialized strip chart widget data structure. +//! +//! \param psParent is a pointer to the parent widget. +//! \param psNext is a pointer to the sibling widget. +//! \param psChild is a pointer to the first child widget. +//! \param psDisplay is a pointer to the off-screen display on which to draw. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param pcTitle is a string for the chart title, NULL for no title. +//! \param psFont is the font used for rendering text on the chart. +//! \param ui32BackgroundColor is the background color for the chart. +//! \param ui32TextColor is the color of text (titles, labels, etc.) +//! \param ui32Y0Color is the color of the Y-axis gridline at Y=0 +//! \param ui32GridColor is the color of grid lines. +//! \param psAxisX is a pointer to the axis structure for the X-axis. +//! \param psAxisY is a pointer to the axis structure for the Y-axis. +//! \param psOffscreenDisplay is a buffer for rendering the chart before +//! showing on the physical display. The dimensions of the off-screen display +//! should match the drawing area of psDisplay. +//! +//! This macro provides an initialized strip chart widget data structure, which +//! can be used to construct the widget tree at compile time in global +//! variables (as opposed to run-time via function calls). This must be +//! assigned to a variable, such as: +//! +//! \verbatim +//! tStripChartWidget g_sStripChart = StripChartStruct(...); +//! \endverbatim +//! +//! Or, in an array of variables: +//! +//! \verbatim +//! tStripChartWidget g_psStripChart[] = +//! { +//! StripChartStruct(...), +//! StripChartStruct(...) +//! }; +//! \endverbatim +//! +//! \return Nothing; this is not a function. +// +//***************************************************************************** +#define StripChartStruct(psParent, psNext, psChild, psDisplay, \ + i32X, i32Y, i32Width, i32Height, \ + pcTitle, psFont, ui32BackgroundColor, ui32TextColor, \ + ui32Y0Color, ui32GridColor, psAxisX, psAxisY, \ + psOffscreenDisplay) \ + { \ + { \ + sizeof(tStripChartWidget), \ + (tWidget *)(psParent), \ + (tWidget *)(psNext), \ + (tWidget *)(psChild), \ + psDisplay, \ + { \ + i32X, \ + i32Y, \ + (i32X) + (i32Width) - 1, \ + (i32Y) + (i32Height) - 1 \ + }, \ + StripChartMsgProc \ + }, \ + pcTitle, psFont, ui32BackgroundColor, ui32TextColor, ui32Y0Color, \ + ui32GridColor, psAxisX, psAxisY, 0, psOffscreenDisplay, 0 \ + } + +//***************************************************************************** +// +//! Declares an initialized variable containing a strip chart widget data +//! structure. +//! +//! \param sName is the name of the variable to be declared. +//! \param psParent is a pointer to the parent widget. +//! \param psNext is a pointer to the sibling widget. +//! \param psChild is a pointer to the first child widget. +//! \param psDisplay is a pointer to the off-screen display on which to draw. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param pcTitle is a string for the chart title, NULL for no title. +//! \param psFont is the font used for rendering text on the chart. +//! \param ui32BackgroundColor is the background color for the chart. +//! \param ui32TextColor is the color of text (titles, labels, etc.) +//! \param ui32Y0Color is the color of the Y-axis gridline at Y=0 +//! \param ui32GridColor is the color of grid lines. +//! \param psAxisX is a pointer to the axis structure for the X-axis. +//! \param psAxisY is a pointer to the axis structure for the Y-axis. +//! \param psOffscreenDisplay is a buffer for rendering the chart before +//! showing on the physical display. The dimensions of the off-screen display +//! should match the drawing area of psDisplay. +//! +//! This macro declares a variable containing an initialized strip chart widget +//! data structure, which can be used to construct the widget tree at compile +//! time in global variables (as opposed to run-time via function calls). +//! +//! \return Nothing; this is not a function. +// +//***************************************************************************** +#define StripChart(sName, psParent, psNext, psChild, psDisplay, \ + i32X, i32Y, i32Width, i32Height, \ + pcTitle, psFont, ui32BackgroundColor, ui32TextColor, \ + ui32Y0Color, ui32GridColor, psAxisX, psAxisY, \ + psOffscreenDisplay) \ + tStripChartWidget sName = \ + StripChartStruct(psParent, psNext, psChild, psDisplay, \ + i32X, i32Y, i32Width, i32Height, \ + pcTitle, psFont, ui32BackgroundColor, \ + ui32TextColor, ui32Y0Color, ui32GridColor, \ + psAxisX, psAxisY, psOffscreenDisplay) + +//***************************************************************************** +// +//! Sets the X-axis of the strip chart. +//! +//! \param psStripChartWidget is a pointer to the strip chart widget to modify. +//! \param psAxis is the new X-axis structure for the strip chart. +//! +//! This function sets the X-axis for the widget. +//! +//! \return None. +// +//***************************************************************************** +#define StripChartXAxisSet(psStripChartWidget, psAxis) \ + do \ + { \ + (psStripChartWidget)->psAxisX = psAxis; \ + } while(0) + +//***************************************************************************** +// +//! Sets the Y-axis of the strip chart. +//! +//! \param psStripChartWidget is a pointer to the strip chart widget to modify. +//! \param psAxis is the new Y-axis structure for the strip chart. +//! +//! This function sets the Y-axis for the widget. +//! +//! \return None. +// +//***************************************************************************** +#define StripChartYAxisSet(psStripChartWidget, psAxis) \ + do \ + { \ + (psStripChartWidget)->psAxisY = psAxis; \ + } while(0) + +//***************************************************************************** +// +// Prototypes for the strip chart widget APIs. +// +//***************************************************************************** +extern int32_t StripChartMsgProc(tWidget *psWidget, uint32_t ui32Msg, + uint32_t ui32Param1, uint32_t ui32Param2); +extern void StripChartInit(tStripChartWidget *psWidget, + const tDisplay *psDisplay, + int32_t i32X, int32_t i32Y, + int32_t i32Width, int32_t i32Height, + char * pcTitle, tFont *psFont, + uint32_t ui32BackgroundColor, + uint32_t ui32TextColor, + uint32_t ui32Y0Color, + uint32_t ui32GridColor, + tStripChartAxis *psAxisX, tStripChartAxis *psAxisY, + tDisplay *psOffscreenDisplay); +extern void StripChartSeriesAdd(tStripChartWidget *psWidget, + tStripChartSeries *psSeries); +extern void StripChartSeriesRemove(tStripChartWidget *psWidget, + tStripChartSeries *psSeries); +extern void StripChartAdvance(tStripChartWidget *psChartWidget, + int32_t i32Count); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** + +#endif // __STRIPCHARTWIDGET_H__ diff --git a/boards/ek-lm4f232/drivers/usb_sound.c b/boards/ek-lm4f232/drivers/usb_sound.c new file mode 100644 index 0000000..332f556 --- /dev/null +++ b/boards/ek-lm4f232/drivers/usb_sound.c @@ -0,0 +1,804 @@ +//***************************************************************************** +// +// usb_sound.c - USB host audio handling functions. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "inc/hw_memmap.h" +#include "drivers/usb_sound.h" +#include "driverlib/gpio.h" +#include "driverlib/sysctl.h" +#include "driverlib/udma.h" +#include "driverlib/usb.h" +#include "usblib/usblib.h" +#include "usblib/usbmsc.h" +#include "usblib/host/usbhost.h" +#include "usblib/host/usbhaudio.h" + +//***************************************************************************** +// +// The size of the host controller's memory pool in bytes. +// +//***************************************************************************** +#define HCD_MEMORY_SIZE 768 + +//***************************************************************************** +// +// The memory pool to provide to the Host controller driver. +// +//***************************************************************************** +uint8_t g_pHCDPool[HCD_MEMORY_SIZE]; + +//***************************************************************************** +// +// The instance data for the USB host audio driver. +// +//***************************************************************************** +tUSBHostAudioInstance *g_psAudioInstance = 0; + +//***************************************************************************** +// +// Declare the USB Events driver interface. +// +//***************************************************************************** +DECLARE_EVENT_DRIVER(g_sUSBEventDriver, 0, 0, USBHCDEvents); + +//***************************************************************************** +// +// This structure holds the state information for the USB audio device. +// +//***************************************************************************** +static struct +{ + // + // Save the application provided callback function. + // + tUSBBufferCallback pfnCallbackOut; + + // + // Save the application provided callback function. + // + tUSBBufferCallback pfnCallbackIn; + + // + // The event callback for the application. + // + tEventCallback pfnCallbackEvent; + + // + // Volume control multipliers calculated from the information received + // from the audio device. + // + uint32_t pui32Steps[3]; + + // + // The currently pending audio device events. + // + uint32_t ui32EventFlags; + + // + // The current state for the audio device. + // + volatile enum + { + // + // No device is present. + // + STATE_NO_DEVICE, + + // + // Audio device is ready. + // + STATE_DEVICE_READY, + + // + // An unsupported device has been attached. + // + STATE_UNKNOWN_DEVICE, + + // + // A power fault has occurred. + // + STATE_POWER_FAULT + } eState; + +} g_sAudioState; + +//***************************************************************************** +// +// These defines are used with the ui32EventFlags in the g_sAudioState structure. +// +//***************************************************************************** +#define EVENT_OPEN 0x00000001 +#define EVENT_CLOSE 0x00000002 + +//***************************************************************************** +// +// The global that holds all of the host drivers in use in the application. +// In this case, only the host audio class is loaded. +// +//***************************************************************************** +static tUSBHostClassDriver const * const g_ppHostClassDrivers[] = +{ + &g_sUSBHostAudioClassDriver + ,&g_sUSBEventDriver +}; + +//***************************************************************************** +// +// This global holds the number of class drivers in the g_ppHostClassDrivers +// list. +// +//***************************************************************************** +static const uint32_t g_ui32NumHostClassDrivers = + sizeof(g_ppHostClassDrivers) / sizeof(tUSBHostClassDriver *); + +//***************************************************************************** +// +// The control table used by the uDMA controller. This table must be aligned +// to a 1024 byte boundary. In this application uDMA is only used for USB, +// so only the first 6 channels are needed. +// +//***************************************************************************** +#if defined(ewarm) +#pragma data_alignment=1024 +tDMAControlTable g_sDMAControlTable[64]; +#elif defined(ccs) +#pragma DATA_ALIGN(g_sDMAControlTable, 1024) +tDMAControlTable g_sDMAControlTable[64]; +#else +tDMAControlTable g_sDMAControlTable[64] __attribute__ ((aligned(1024))); +#endif + +//***************************************************************************** +// +// This function was the callback function registered with the USB host audio +// class driver. The only two events that are handled at this point are the +// USBH_AUDIO_EVENT_OPEN and USBH_AUDIO_EVENT_CLOSE which indicate that a new +// audio device has been found or that an existing audio device has been +// disconnected. +// +//***************************************************************************** +static void +AudioCallback(tUSBHostAudioInstance *psAudioInstance, + uint32_t ui32Event, + uint32_t ui32MsgParam, + void *pvBuffer) +{ + switch(ui32Event) + { + // + // New USB audio device has been enabled. + // + case USBH_AUDIO_EVENT_OPEN: + { + // + // Set the EVENT_OPEN flag and let the main routine handle it. + // + HWREGBITW(&g_sAudioState.ui32EventFlags, EVENT_OPEN) = 1; + + break; + } + + // + // USB audio device has been removed. + // + case USBH_AUDIO_EVENT_CLOSE: + { + // + // Set the EVENT_CLOSE flag and let the main routine handle it. + // + HWREGBITW(&g_sAudioState.ui32EventFlags, EVENT_CLOSE) = 1; + + break; + } + default: + { + } + } +} + +//***************************************************************************** +// +// Initializes the sound output. +// +// \param ui32Flags is unused as this point but is included for future +// functionality. +// \param pfnCallback is the event callback function for audio devices. +// +// This function prepares the sound driver to enumerate an audio device and +// prepares to play audio once a valid audio device is detected. The +// \e pfnCallback function can be used to receive callbacks when there are +// changes related to the audio device. The ui32Event parameter to the callback +// will be one of the SOUND_EVENT_* values. +// +// \return None +// +//***************************************************************************** +void +USBSoundInit(uint32_t ui32Flags, tEventCallback pfnCallback) +{ + // + // Enable the peripherals used by this example. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Set the USB power pins to be controlled by the USB controller. + // + GPIOPinTypeUSBDigital(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7); + + // + // Enable the uDMA controller and set up the control table base. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); + uDMAEnable(); + uDMAControlBaseSet(g_sDMAControlTable); + + // + // Initialize the USB stack mode to OTG. + // + USBStackModeSet(0, eUSBModeOTG, 0); + + // + // Register the host class drivers. + // + USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); + + // + // Open an instance of the audio class driver. + // + g_psAudioInstance = USBHostAudioOpen(0, AudioCallback); + + // + // Initialize the power configuration. This sets the power enable signal + // to be active high and does not enable the power fault. + // + USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); + + // + // Initialize the USB controller for OTG operation with a 2ms polling + // rate. + // + USBOTGModeInit(0, 2000, g_pHCDPool, HCD_MEMORY_SIZE); + + // + // Save the event callback function. + // + g_sAudioState.pfnCallbackEvent = pfnCallback; +} + +//***************************************************************************** +// +// Sets the volume of the audio device. +// +// \param ui32Percent is the volume percentage, which must be between 0% +// (silence) and 100% (full volume), inclusive. +// +// This function sets the volume of the sound output to a value between +// silence (0%) and full volume (100%). +// +// \return None. +// +//***************************************************************************** +void +USBSoundVolumeSet(uint32_t ui32Percent) +{ + uint32_t ui32Value; + + // + // Ignore volume changes if there is no device present. + // + if(g_sAudioState.eState == STATE_DEVICE_READY) + { + // + // Scale the voltage percentage to the decibel range provided by the + // USB audio device. + // + ui32Value = (g_sAudioState.pui32Steps[1] * ui32Percent) / 100; + USBHostAudioVolumeSet(g_psAudioInstance, 0, 1, ui32Value); + + ui32Value = (g_sAudioState.pui32Steps[2] * ui32Percent) / 100; + USBHostAudioVolumeSet(g_psAudioInstance, 0, 2, ui32Value); + } +} + +//***************************************************************************** +// +// Returns the current volume level. +// +// \param ui32Channel is the 0 based channel number to query. +// +// This function returns the current volume, specified as a percentage between +// 0% (silence) and 100% (full volume), inclusive. The \e ui32Channel value +// starts with 0 which is the master audio volume control interface. The +// remaining \e ui32Channel values provide access to various other audio +// channels, with 1 and 2 being left and right audio channels. +// +// \return Returns the current volume. +// +//***************************************************************************** +uint32_t +USBSoundVolumeGet(uint32_t ui32Channel) +{ + uint32_t ui32Volume; + + // + // Initialize the return value in case there is no USB device present. + // + ui32Volume = 0xffffffff; + + // + // Ignore volume request if there is no device present. + // + if(g_sAudioState.eState == STATE_DEVICE_READY) + { + ui32Volume = USBHostAudioVolumeGet(g_psAudioInstance, 0, ui32Channel); + } + + return(ui32Volume); +} + +//***************************************************************************** +// +// This will set the current output audio format of the USB audio device. +// +// \param ui32SampleRate is the sample rate. +// \param ui32BitsPerSample is the number of bits per sample. +// \param ui32Channels is the number of channels. +// +// This sets the current audio format for the USB device that is currently +// connected. If there is no USB device connected or the format is not +// supported then the function will return a non-zero value. The function +// will return zero if the USB audio device was successfully configured to the +// requested audio format. +// +// \return Returns zero if the format was successfully set or returns an +// non-zero value if the format was not able to be set. +// +//***************************************************************************** +uint32_t +USBSoundOutputFormatSet(uint32_t ui32SampleRate, + uint32_t ui32BitsPerSample, uint32_t ui32Channels) +{ + // + // Just return if there is no device at this time. + // + if(g_sAudioState.eState != STATE_DEVICE_READY) + { + return(1); + } + + // + // Call the USB Host Audio function to set the format. + // + return(USBHostAudioFormatSet(g_psAudioInstance, ui32SampleRate, + ui32BitsPerSample, ui32Channels, + USBH_AUDIO_FORMAT_OUT)); +} + +//***************************************************************************** +// +// This will set the current input audio format of the USB audio device +// +// \param ui32SampleRate is the sample rate. +// \param ui32BitsPerSample is the number of bits per sample. +// \param ui32Channels is the number of channels. +// +// This sets the current format for the USB device that is currently connect. +// If there is no USB device connected or the format is not supported then the +// function will return 0. The function will return 1 if the USB audio device +// was successfully configured to the requested format. +// +// \return Returns 1 if the format was successfully set or returns 0 if the +// format was not changed. +// +//***************************************************************************** +uint32_t +USBSoundInputFormatSet(uint32_t ui32SampleRate, + uint32_t ui32BitsPerSample, uint32_t ui32Channels) +{ + // + // Just return if there is no device at this time. + // + if(g_sAudioState.eState != STATE_DEVICE_READY) + { + return(0); + } + + return(USBHostAudioFormatSet(g_psAudioInstance, ui32SampleRate, + ui32BitsPerSample, ui32Channels, + USBH_AUDIO_FORMAT_IN)); +} + +//***************************************************************************** +// +// Returns the current sample rate. +// +// This function returns the sample rate that was set by a call to +// USBSoundSetFormat(). This is needed to retrieve the exact sample rate that is +// in use in case the requested rate could not be matched exactly. +// +// \return The current sample rate in samples/second. +// +//***************************************************************************** +uint32_t +USBSoundOutputFormatGet(uint32_t ui32SampleRate, uint32_t ui32Bits, + uint32_t ui32Channels) +{ + // + // Just return if there is no device at this time. + // + if(g_sAudioState.eState != STATE_DEVICE_READY) + { + return(0); + } + + return(USBHostAudioFormatGet(g_psAudioInstance, ui32SampleRate, ui32Bits, + ui32Channels, USBH_AUDIO_FORMAT_OUT)); +} + +//***************************************************************************** +// +// Returns the current sample rate. +// +// This function returns the sample rate that was set by a call to +// USBSoundSetFormat(). This is needed to retrieve the exact sample rate that is +// in use in case the requested rate could not be matched exactly. +// +// \return The current sample rate in samples/second. +// +//***************************************************************************** +uint32_t +USBSoundInputFormatGet(uint32_t ui32SampleRate, uint32_t ui32Bits, + uint32_t ui32Channels) +{ + // + // Just return if there is no device at this time. + // + if(g_sAudioState.eState != STATE_DEVICE_READY) + { + return(0); + } + + return(USBHostAudioFormatGet(g_psAudioInstance, ui32SampleRate, ui32Bits, + ui32Channels, USBH_AUDIO_FORMAT_IN)); +} + +//***************************************************************************** +// +// This is the generic callback from host stack. +// +// \param pvData is actually a pointer to a tEventInfo structure. +// +// This function will be called to inform the application when a USB event has +// occurred that is outside those related to the audio device. At this +// point this is used to detect unsupported devices being inserted and removed. +// It is also used to inform the application when a power fault has occurred. +// This function is required when the g_USBGenerii8EventDriver is included in +// the host controller driver array that is passed in to the +// USBHCDRegisterDrivers() function. +// +// \return None. +// +//***************************************************************************** +void +USBHCDEvents(void *pvData) +{ + tEventInfo *psEventInfo; + + // + // Cast this pointer to its actual type. + // + psEventInfo = (tEventInfo *)pvData; + + switch(psEventInfo->ui32Event) + { + // + // Unknown device detected. + // + case USB_EVENT_UNKNOWN_CONNECTED: + { + // + // An unknown device was detected. + // + g_sAudioState.eState = STATE_UNKNOWN_DEVICE; + + // + // Call the general event handler if present. + // + if(g_sAudioState.pfnCallbackEvent) + { + g_sAudioState.pfnCallbackEvent(SOUND_EVENT_UNKNOWN_DEV, 1); + } + + break; + } + + // + // Device unplugged. + // + case USB_EVENT_DISCONNECTED: + { + // + // Handle the case where an unknown device is disconnected. + // + if(g_sAudioState.eState == STATE_UNKNOWN_DEVICE) + { + g_sAudioState.eState = STATE_NO_DEVICE; + + // + // Call the general event handler if present. + // + if(g_sAudioState.pfnCallbackEvent) + { + g_sAudioState.pfnCallbackEvent(SOUND_EVENT_UNKNOWN_DEV, 0); + } + } + else + { + // + // Call the general event handler if present. + // + if(g_sAudioState.pfnCallbackEvent) + { + g_sAudioState.pfnCallbackEvent(SOUND_EVENT_DISCONNECT, 0); + } + } + + break; + } + + // + // A power fault has occurred. + // + case USB_EVENT_POWER_FAULT: + { + // + // No power means no device is present. + // + g_sAudioState.eState = STATE_POWER_FAULT; + + break; + } + default: + { + break; + } + } +} + +//***************************************************************************** +// +// This function passes along a buffer callback from the USB host audio driver +// so that the application can process or release the buffers. +// +//***************************************************************************** +void +USBHostAudioCallback(tUSBHostAudioInstance *psAudioInstance, + uint32_t ui32Event, uint32_t ui32Param, void *pvBuffer) +{ + // + // Only call the callback if it is actually present. + // + if(g_sAudioState.pfnCallbackOut) + { + g_sAudioState.pfnCallbackOut(pvBuffer, ui32Event); + } + + // + // Only call the callback if it is actually present. + // + if(g_sAudioState.pfnCallbackIn) + { + g_sAudioState.pfnCallbackIn(pvBuffer, ui32Event); + } +} + +//***************************************************************************** +// +// Starts output of a block of PCM audio samples. +// +// \param pvBuffer is a pointer to the audio data to play. +// \param ui32Size is the length of the data in bytes. +// \param pfnCallback is a function to call when this buffer has be played. +// +// This function starts the output of a block of PCM audio samples. +// +// \return This function returns a non-zero value if the buffer was accepted, +// and returns zero if the buffer was not accepted. +// +//***************************************************************************** +uint32_t +USBSoundBufferOut(const void *pvBuffer, uint32_t ui32Size, + tUSBBufferCallback pfnCallback) +{ + // + // If there is no device present or there is a pending buffer then just + // return with a failure. + // + if(g_sAudioState.eState != STATE_DEVICE_READY) + { + return(0); + } + + // + // Save this buffer callback. + // + g_sAudioState.pfnCallbackOut = pfnCallback; + + // + // Pass the buffer aint32_t to the USB host audio driver for playback. + // + return(USBHostAudioPlay(g_psAudioInstance, (void *)pvBuffer, ui32Size, + USBHostAudioCallback)); +} + +//***************************************************************************** +// +// Requests a new block of PCM audio samples from a USB audio device. +// +// \param pvBuffer is a pointer to a location to store the audio data. +// \param ui32Size is the size of the pvData buffer in bytes. +// \param pfnCallback is a function to call when this buffer has new data. +// +// This function request a new block of PCM audio samples from a USB audio +// device. +// +// \return This function returns a non-zero value if the buffer was accepted, +// and returns zero if the buffer was not accepted. +// +//***************************************************************************** +uint32_t +USBSoundBufferIn(const void *pvBuffer, uint32_t ui32Size, + tUSBBufferCallback pfnCallback) +{ + // + // If there is no device present or there is a pending buffer then just + // return with a failure. + // + if(g_sAudioState.eState != STATE_DEVICE_READY) + { + return(0); + } + + // + // Save this buffer callback. + // + g_sAudioState.pfnCallbackIn = pfnCallback; + + // + // Pass the buffer aint32_t to the USB host audio driver for input. + // + return(USBHostAudioRecord(g_psAudioInstance, (void *)pvBuffer, ui32Size, + USBHostAudioCallback)); +} + +//***************************************************************************** +// +// This function reads the audio volume settings for the USB audio device and +// saves them so that the volume can be scaled correctly. +// +//***************************************************************************** +static void +GetVolumeParameters(void) +{ + uint32_t ui32Max, ui32Min, ui32Res, ui32Channel; + + for(ui32Channel = 0; ui32Channel < 3; ui32Channel++) + { + ui32Max = USBHostAudioVolumeMaxGet(g_psAudioInstance, 0, ui32Channel); + ui32Min = USBHostAudioVolumeMinGet(g_psAudioInstance, 0, ui32Channel); + ui32Res = USBHostAudioVolumeResGet(g_psAudioInstance, 0, ui32Channel); + + g_sAudioState.pui32Steps[ui32Channel] = (ui32Max - ui32Min) / ui32Res; + } +} + +//***************************************************************************** +// +// The main routine for handling USB audio, this should be called periodically +// by the main program and pass in the amount of time in milliseconds that has +// elapsed since the last call. +// +//***************************************************************************** +void +USBMain(uint32_t ui32Ticks) +{ + // + // Tell the OTG library code how much time has passed in + // milliseconds since the last call. + // + USBOTGMain(ui32Ticks); + + switch(g_sAudioState.eState) + { + // + // This is the running state where buttons are checked and the + // screen is updated. + // + case STATE_DEVICE_READY: + { + if(HWREGBITW(&g_sAudioState.ui32EventFlags, EVENT_CLOSE)) + { + HWREGBITW(&g_sAudioState.ui32EventFlags, EVENT_CLOSE) = 0; + g_sAudioState.eState = STATE_NO_DEVICE; + + // + // Call the general event handler if present. + // + if(g_sAudioState.pfnCallbackEvent) + { + g_sAudioState.pfnCallbackEvent(SOUND_EVENT_DISCONNECT, 0); + } + } + break; + } + + // + // If there is no device then just wait for one. + // + case STATE_NO_DEVICE: + { + if(HWREGBITW(&g_sAudioState.ui32EventFlags, EVENT_OPEN)) + { + g_sAudioState.eState = STATE_DEVICE_READY; + + HWREGBITW(&g_sAudioState.ui32EventFlags, EVENT_OPEN) = 0; + + GetVolumeParameters(); + + // + // Call the general event handler if present. + // + if(g_sAudioState.pfnCallbackEvent) + { + g_sAudioState.pfnCallbackEvent(SOUND_EVENT_READY, 0); + } + } + break; + } + + // + // An unknown device was connected. + // + case STATE_UNKNOWN_DEVICE: + { + break; + } + + // + // Something has caused a power fault. + // + case STATE_POWER_FAULT: + { + break; + } + + default: + { + break; + } + } +} diff --git a/boards/ek-lm4f232/drivers/usb_sound.h b/boards/ek-lm4f232/drivers/usb_sound.h new file mode 100644 index 0000000..04bf459 --- /dev/null +++ b/boards/ek-lm4f232/drivers/usb_sound.h @@ -0,0 +1,81 @@ +//***************************************************************************** +// +// usb_sound.h - USB host audio handling header definitions. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef USB_SOUND_H_ +#define USB_SOUND_H_ + +//***************************************************************************** +// +// The following are defines for the ui32Event value that is returned with the +// tEventCallback function provided to the USBSoundInit() function. +// +//***************************************************************************** + +// +// A USB audio device has been connected. +// +#define SOUND_EVENT_READY 0x00000001 + +// +// A USB device has been disconnected. +// +#define SOUND_EVENT_DISCONNECT 0x00000002 + +// +// An unknown device has been connected. +// +#define SOUND_EVENT_UNKNOWN_DEV 0x00000003 + +typedef void (* tUSBBufferCallback)(void *pvBuffer, uint32_t ui32Event); +typedef void (* tEventCallback)(uint32_t ui32Event, uint32_t ui32Param); + +extern void USBMain(uint32_t ui32Ticks); + +extern void USBSoundInit(uint32_t ui32EnableReceive, + tEventCallback pfnCallback); +extern void USBSoundVolumeSet(uint32_t ui32Percent); +extern uint32_t USBSoundVolumeGet(uint32_t ui32Channel); + +extern uint32_t USBSoundOutputFormatGet(uint32_t ui32SampleRate, + uint32_t ui32Bits, + uint32_t ui32Channels); +extern uint32_t USBSoundOutputFormatSet(uint32_t ui32SampleRate, + uint32_t ui32Bits, + uint32_t ui32Channels); +extern uint32_t USBSoundInputFormatGet(uint32_t ui32SampleRate, + uint32_t ui32BitsPerSample, + uint32_t ui32Channels); +extern uint32_t USBSoundInputFormatSet(uint32_t ui32SampleRate, + uint32_t ui32Bits, + uint32_t ui32Channels); + +extern uint32_t USBSoundBufferOut(const void *pvData, + uint32_t ui32Length, + tUSBBufferCallback pfnCallback); + +extern uint32_t USBSoundBufferIn(const void *pvData, + uint32_t ui32Length, + tUSBBufferCallback pfnCallback); + +#endif diff --git a/boards/ek-lm4f232/ek-lm4f232.eww b/boards/ek-lm4f232/ek-lm4f232.eww new file mode 100644 index 0000000..7b0fa7b --- /dev/null +++ b/boards/ek-lm4f232/ek-lm4f232.eww @@ -0,0 +1,226 @@ + + + + + $WS_DIR$\..\..\..\driverlib\driverlib.ewp + + + $WS_DIR$\..\..\..\grlib\grlib.ewp + + + $WS_DIR$\..\..\..\usblib\usblib.ewp + + + $WS_DIR$\bitband\bitband.ewp + + + $WS_DIR$\blinky\blinky.ewp + + + $WS_DIR$\boot_demo1\boot_demo1.ewp + + + $WS_DIR$\boot_demo2\boot_demo2.ewp + + + $WS_DIR$\boot_serial\boot_serial.ewp + + + $WS_DIR$\boot_usb\boot_usb.ewp + + + $WS_DIR$\hello\hello.ewp + + + $WS_DIR$\hibernate\hibernate.ewp + + + $WS_DIR$\interrupts\interrupts.ewp + + + $WS_DIR$\mpu_fault\mpu_fault.ewp + + + $WS_DIR$\qs-logger\qs-logger.ewp + + + $WS_DIR$\sd_card\sd_card.ewp + + + $WS_DIR$\sine_demo\sine_demo.ewp + + + $WS_DIR$\softuart_echo\softuart_echo.ewp + + + $WS_DIR$\timers\timers.ewp + + + $WS_DIR$\uart_echo\uart_echo.ewp + + + $WS_DIR$\udma_demo\udma_demo.ewp + + + $WS_DIR$\usb_dev_bulk\usb_dev_bulk.ewp + + + $WS_DIR$\usb_dev_keyboard\usb_dev_keyboard.ewp + + + $WS_DIR$\usb_dev_msc\usb_dev_msc.ewp + + + $WS_DIR$\usb_dev_serial\usb_dev_serial.ewp + + + $WS_DIR$\usb_host_audio\usb_host_audio.ewp + + + $WS_DIR$\usb_host_msc\usb_host_msc.ewp + + + $WS_DIR$\usb_host_keyboard\usb_host_keyboard.ewp + + + $WS_DIR$\usb_host_mouse\usb_host_mouse.ewp + + + $WS_DIR$\usb_stick_demo\usb_stick_demo.ewp + + + $WS_DIR$\usb_stick_update\usb_stick_update.ewp + + + $WS_DIR$\watchdog\watchdog.ewp + + + + All Examples + + driverlib + Debug + + + grlib + Debug + + + usblib + Debug + + + bitband + Debug + + + blinky + Debug + + + boot_demo1 + Debug + + + boot_demo2 + Debug + + + boot_serial + Debug + + + boot_usb + Debug + + + hello + Debug + + + hibernate + Debug + + + interrupts + Debug + + + mpu_fault + Debug + + + qs-logger + Debug + + + sd_card + Debug + + + sine_demo + Debug + + + softuart_echo + Debug + + + timers + Debug + + + uart_echo + Debug + + + udma_demo + Debug + + + usb_dev_bulk + Debug + + + usb_dev_keyboard + Debug + + + usb_dev_msc + Debug + + + usb_dev_serial + Debug + + + usb_host_audio + Debug + + + usb_host_msc + Debug + + + usb_host_keyboard + Debug + + + usb_host_mouse + Debug + + + usb_stick_demo + Debug + + + usb_stick_update + Debug + + + watchdog + Debug + + + + diff --git a/boards/ek-lm4f232/ek-lm4f232.uvmpw b/boards/ek-lm4f232/ek-lm4f232.uvmpw new file mode 100644 index 0000000..4fbf00f --- /dev/null +++ b/boards/ek-lm4f232/ek-lm4f232.uvmpw @@ -0,0 +1,165 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + ek-lm4f232 + + + ..\..\..\driverlib\driverlib.uvproj + 1 + + + + ..\..\..\grlib\grlib.uvproj + 1 + + + + ..\..\..\usblib\usblib.uvproj + 1 + + + + .\bitband\bitband.uvproj + 1 + + + + .\blinky\blinky.uvproj + 1 + + + + .\boot_demo1\boot_demo1.uvproj + 1 + + + + .\boot_demo2\boot_demo2.uvproj + 1 + + + + .\boot_serial\boot_serial.uvproj + 1 + + + + .\boot_usb\boot_usb.uvproj + 1 + + + + .\hello\hello.uvproj + 1 + + + + .\hibernate\hibernate.uvproj + 1 + + + + .\interrupts\interrupts.uvproj + 1 + + + + .\mpu_fault\mpu_fault.uvproj + 1 + + + + .\qs-logger\qs-logger.uvproj + 1 + + + + .\sd_card\sd_card.uvproj + 1 + + + + .\sine_demo\sine_demo.uvproj + 1 + + + + .\softuart_echo\softuart_echo.uvproj + 1 + + + + .\timers\timers.uvproj + 1 + + + + .\uart_echo\uart_echo.uvproj + 1 + + + + .\udma_demo\udma_demo.uvproj + 1 + + + + .\usb_dev_bulk\usb_dev_bulk.uvproj + 1 + + + + .\usb_dev_keyboard\usb_dev_keyboard.uvproj + 1 + + + + .\usb_dev_msc\usb_dev_msc.uvproj + 1 + + + + .\usb_dev_serial\usb_dev_serial.uvproj + 1 + + + + .\usb_host_audio\usb_host_audio.uvproj + 1 + + + + .\usb_host_msc\usb_host_msc.uvproj + 1 + + + + .\usb_host_keyboard\usb_host_keyboard.uvproj + 1 + + + + .\usb_host_mouse\usb_host_mouse.uvproj + 1 + + + + .\usb_stick_demo\usb_stick_demo.uvproj + 1 + + + + .\usb_stick_update\usb_stick_update.uvproj + 1 + + + + .\watchdog\watchdog.uvproj + 1 + + +
diff --git a/boards/ek-lm4f232/hello/Makefile b/boards/ek-lm4f232/hello/Makefile new file mode 100644 index 0000000..a8bd98b --- /dev/null +++ b/boards/ek-lm4f232/hello/Makefile @@ -0,0 +1,89 @@ +#****************************************************************************** +# +# Makefile - Rules for building the hello example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the hello example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/hello.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the hello example. +# +${COMPILER}/hello.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/hello.axf: ${COMPILER}/hello.o +${COMPILER}/hello.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/hello.axf: ${COMPILER}/uartstdio.o +${COMPILER}/hello.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/hello.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/hello.axf: hello.ld +SCATTERgcc_hello=hello.ld +ENTRY_hello=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/hello/ccs/.ccsimportspec b/boards/ek-lm4f232/hello/ccs/.ccsimportspec new file mode 100644 index 0000000..77b03f5 --- /dev/null +++ b/boards/ek-lm4f232/hello/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/hello/ccs/.ccsproject b/boards/ek-lm4f232/hello/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/hello/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/hello/ccs/.cproject b/boards/ek-lm4f232/hello/ccs/.cproject new file mode 100644 index 0000000..a0a9331 --- /dev/null +++ b/boards/ek-lm4f232/hello/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/hello/ccs/.project b/boards/ek-lm4f232/hello/ccs/.project new file mode 100644 index 0000000..155d942 --- /dev/null +++ b/boards/ek-lm4f232/hello/ccs/.project @@ -0,0 +1,60 @@ + + + hello + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + hello.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/hello/hello.c + + + hello_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/hello/hello_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/hello/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/hello/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/hello/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/hello/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/hello/ccs/Debug/hello.bin b/boards/ek-lm4f232/hello/ccs/Debug/hello.bin new file mode 100644 index 0000000..012beb3 Binary files /dev/null and b/boards/ek-lm4f232/hello/ccs/Debug/hello.bin differ diff --git a/boards/ek-lm4f232/hello/ccs/Debug/hello.out b/boards/ek-lm4f232/hello/ccs/Debug/hello.out new file mode 100644 index 0000000..0a43e53 Binary files /dev/null and b/boards/ek-lm4f232/hello/ccs/Debug/hello.out differ diff --git a/boards/ek-lm4f232/hello/ccs/macros.ini_initial b/boards/ek-lm4f232/hello/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/hello/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/hello/ccs/target_config.ccxml b/boards/ek-lm4f232/hello/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/hello/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/hello/ewarm/Exe/hello.bin b/boards/ek-lm4f232/hello/ewarm/Exe/hello.bin new file mode 100644 index 0000000..304947c Binary files /dev/null and b/boards/ek-lm4f232/hello/ewarm/Exe/hello.bin differ diff --git a/boards/ek-lm4f232/hello/ewarm/Exe/hello.out b/boards/ek-lm4f232/hello/ewarm/Exe/hello.out new file mode 100644 index 0000000..96392e7 Binary files /dev/null and b/boards/ek-lm4f232/hello/ewarm/Exe/hello.out differ diff --git a/boards/ek-lm4f232/hello/gcc/hello.axf b/boards/ek-lm4f232/hello/gcc/hello.axf new file mode 100644 index 0000000..0921cf4 Binary files /dev/null and b/boards/ek-lm4f232/hello/gcc/hello.axf differ diff --git a/boards/ek-lm4f232/hello/gcc/hello.bin b/boards/ek-lm4f232/hello/gcc/hello.bin new file mode 100644 index 0000000..02f0f9d Binary files /dev/null and b/boards/ek-lm4f232/hello/gcc/hello.bin differ diff --git a/boards/ek-lm4f232/hello/hello.c b/boards/ek-lm4f232/hello/hello.c new file mode 100644 index 0000000..f0709d5 --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.c @@ -0,0 +1,183 @@ +//***************************************************************************** +// +// hello.c - Simple hello world example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_memmap.h" +#include "driverlib/fpu.h" +#include "driverlib/sysctl.h" +#include "driverlib/rom.h" +#include "driverlib/pin_map.h" +#include "driverlib/uart.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" +#include "utils/uartstdio.h" +#include "driverlib/gpio.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Hello World (hello)

+//! +//! A very simple ``hello world'' example. It simply displays ``Hello World!'' +//! on the display and is a starting point for more complicated applications. +//! This example uses calls to the TivaWare Graphics Library graphics +//! primitives functions to update the display. For a similar example using +//! widgets, please see ``hello_widget''. +// +//***************************************************************************** + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Configure the UART and its pins. This must be called before UARTprintf(). +// +//***************************************************************************** +void +ConfigureUART(void) +{ + // + // Enable the GPIO Peripheral used by the UART. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Enable UART0 + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Configure GPIO Pins for UART mode. + // + ROM_GPIOPinConfigure(GPIO_PA0_U0RX); + ROM_GPIOPinConfigure(GPIO_PA1_U0TX); + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Use the internal 16MHz oscillator as the UART clock source. + // + UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); + + // + // Initialize the UART for console I/O. + // + UARTStdioConfig(0, 115200, 16000000); +} + +//***************************************************************************** +// +// Print "Hello World!" to the display. +// +//***************************************************************************** +int +main(void) +{ + tContext sContext; + tRectangle sRect; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | + SYSCTL_OSC_MAIN); + + // + // Initialize the UART. + // + ConfigureUART(); + + UARTprintf("Hello, world!\n"); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top 24 rows of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 23; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&sContext, ClrWhite); + GrRectDraw(&sContext, &sRect); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontCm12); + GrStringDrawCentered(&sContext, "hello", -1, + GrContextDpyWidthGet(&sContext) / 2, 10, 0); + + // + // Say hello using the Computer Modern 40 point font. + // + GrContextFontSet(&sContext, g_psFontCm12/*g_psFontFixed6x8*/); + GrStringDrawCentered(&sContext, "Hello World!", -1, + GrContextDpyWidthGet(&sContext) / 2, + ((GrContextDpyHeightGet(&sContext) - 24) / 2) + 24, + 0); + + // + // Flush any cached drawing operations. + // + GrFlush(&sContext); + + // + // We are finished. Hang around doing nothing. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hello/hello.ewd b/boards/ek-lm4f232/hello/hello.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/hello/hello.ewp b/boards/ek-lm4f232/hello/hello.ewp new file mode 100644 index 0000000..5c79ccf --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.ewp @@ -0,0 +1,795 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\hello.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + diff --git a/boards/ek-lm4f232/hello/hello.icf b/boards/ek-lm4f232/hello/hello.icf new file mode 100644 index 0000000..08e54a7 --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// hello.icf - Linker configuration file for hello. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/hello/hello.ld b/boards/ek-lm4f232/hello/hello.ld new file mode 100644 index 0000000..80b6a0f --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * hello.ld - Linker configuration file for hello. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/hello/hello.sct b/boards/ek-lm4f232/hello/hello.sct new file mode 100644 index 0000000..0a7c102 --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; hello.sct - Linker configuration file for hello. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/hello/hello.uvopt b/boards/ek-lm4f232/hello/hello.uvopt new file mode 100644 index 0000000..9c0c424 --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.uvopt @@ -0,0 +1,331 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + hello + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\hello.c + hello.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 7 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/hello/hello.uvproj b/boards/ek-lm4f232/hello/hello.uvproj new file mode 100644 index 0000000..70ef07e --- /dev/null +++ b/boards/ek-lm4f232/hello/hello.uvproj @@ -0,0 +1,439 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + hello + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + hello + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\hello.bin .\rvmdk\hello.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + hello.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + hello.c + 1 + .\hello.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/hello/hello_ccs.cmd b/boards/ek-lm4f232/hello/hello_ccs.cmd new file mode 100644 index 0000000..11fc3be --- /dev/null +++ b/boards/ek-lm4f232/hello/hello_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * hello_ccs.cmd - CCS linker configuration file for hello. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; diff --git a/boards/ek-lm4f232/hello/readme.txt b/boards/ek-lm4f232/hello/readme.txt new file mode 100644 index 0000000..51b90ab --- /dev/null +++ b/boards/ek-lm4f232/hello/readme.txt @@ -0,0 +1,27 @@ +Hello World + +A very simple ``hello world'' example. It simply displays ``Hello World!'' +on the display and is a starting point for more complicated applications. +This example uses calls to the TivaWare Graphics Library graphics +primitives functions to update the display. For a similar example using +widgets, please see ``hello_widget''. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/hello/rvmdk/hello.axf b/boards/ek-lm4f232/hello/rvmdk/hello.axf new file mode 100644 index 0000000..410e121 Binary files /dev/null and b/boards/ek-lm4f232/hello/rvmdk/hello.axf differ diff --git a/boards/ek-lm4f232/hello/rvmdk/hello.bin b/boards/ek-lm4f232/hello/rvmdk/hello.bin new file mode 100644 index 0000000..d9ea5ab Binary files /dev/null and b/boards/ek-lm4f232/hello/rvmdk/hello.bin differ diff --git a/boards/ek-lm4f232/hello/startup_ccs.c b/boards/ek-lm4f232/hello/startup_ccs.c new file mode 100644 index 0000000..f21c31c --- /dev/null +++ b/boards/ek-lm4f232/hello/startup_ccs.c @@ -0,0 +1,295 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hello/startup_ewarm.c b/boards/ek-lm4f232/hello/startup_ewarm.c new file mode 100644 index 0000000..68689bf --- /dev/null +++ b/boards/ek-lm4f232/hello/startup_ewarm.c @@ -0,0 +1,326 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hello/startup_gcc.c b/boards/ek-lm4f232/hello/startup_gcc.c new file mode 100644 index 0000000..2f64c5e --- /dev/null +++ b/boards/ek-lm4f232/hello/startup_gcc.c @@ -0,0 +1,342 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hello/startup_rvmdk.S b/boards/ek-lm4f232/hello/startup_rvmdk.S new file mode 100644 index 0000000..f256163 --- /dev/null +++ b/boards/ek-lm4f232/hello/startup_rvmdk.S @@ -0,0 +1,351 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/hibernate/Makefile b/boards/ek-lm4f232/hibernate/Makefile new file mode 100644 index 0000000..50b7139 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/Makefile @@ -0,0 +1,91 @@ +#****************************************************************************** +# +# Makefile - Rules for building the hibernation example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the hibernation example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/hibernate.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the hibernation example. +# +${COMPILER}/hibernate.axf: ${COMPILER}/buttons.o +${COMPILER}/hibernate.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/hibernate.axf: ${COMPILER}/hibernate.o +${COMPILER}/hibernate.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/hibernate.axf: ${COMPILER}/uartstdio.o +${COMPILER}/hibernate.axf: ${COMPILER}/ustdlib.o +${COMPILER}/hibernate.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/hibernate.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/hibernate.axf: hibernate.ld +SCATTERgcc_hibernate=hibernate.ld +ENTRY_hibernate=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/hibernate/ccs/.ccsimportspec b/boards/ek-lm4f232/hibernate/ccs/.ccsimportspec new file mode 100644 index 0000000..160e565 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/hibernate/ccs/.ccsproject b/boards/ek-lm4f232/hibernate/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/hibernate/ccs/.cproject b/boards/ek-lm4f232/hibernate/ccs/.cproject new file mode 100644 index 0000000..6a6d539 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/hibernate/ccs/.project b/boards/ek-lm4f232/hibernate/ccs/.project new file mode 100644 index 0000000..d1f410d --- /dev/null +++ b/boards/ek-lm4f232/hibernate/ccs/.project @@ -0,0 +1,70 @@ + + + hibernate + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + hibernate.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/hibernate/hibernate.c + + + hibernate_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/hibernate/hibernate_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/hibernate/startup_ccs.c + + + drivers/buttons.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/buttons.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/hibernate/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/hibernate/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.bin b/boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.bin new file mode 100644 index 0000000..bcaa829 Binary files /dev/null and b/boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.bin differ diff --git a/boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.out b/boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.out new file mode 100644 index 0000000..4421ce7 Binary files /dev/null and b/boards/ek-lm4f232/hibernate/ccs/Debug/hibernate.out differ diff --git a/boards/ek-lm4f232/hibernate/ccs/macros.ini_initial b/boards/ek-lm4f232/hibernate/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/hibernate/ccs/target_config.ccxml b/boards/ek-lm4f232/hibernate/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/hibernate/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.bin b/boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.bin new file mode 100644 index 0000000..cd07400 Binary files /dev/null and b/boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.bin differ diff --git a/boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.out b/boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.out new file mode 100644 index 0000000..22e3629 Binary files /dev/null and b/boards/ek-lm4f232/hibernate/ewarm/Exe/hibernate.out differ diff --git a/boards/ek-lm4f232/hibernate/gcc/hibernate.axf b/boards/ek-lm4f232/hibernate/gcc/hibernate.axf new file mode 100644 index 0000000..51128e9 Binary files /dev/null and b/boards/ek-lm4f232/hibernate/gcc/hibernate.axf differ diff --git a/boards/ek-lm4f232/hibernate/gcc/hibernate.bin b/boards/ek-lm4f232/hibernate/gcc/hibernate.bin new file mode 100644 index 0000000..88b442e Binary files /dev/null and b/boards/ek-lm4f232/hibernate/gcc/hibernate.bin differ diff --git a/boards/ek-lm4f232/hibernate/hibernate.c b/boards/ek-lm4f232/hibernate/hibernate.c new file mode 100644 index 0000000..396b0aa --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.c @@ -0,0 +1,545 @@ +//***************************************************************************** +// +// hibernate.c - Hibernation example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_memmap.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/hibernate.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/rom.h" +#include "driverlib/uart.h" +#include "grlib/grlib.h" +#include "utils/ustdlib.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/buttons.h" +#include "inc/hw_hibernate.h" +#include "driverlib/pin_map.h" +#include "utils/uartstdio.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Hibernate Example (hibernate)

+//! +//! An example to demonstrate the use of the Hibernation module. The user +//! can put the microcontroller in hibernation by pressing the select +//! button. The microcontroller will then wake on its own after 5 seconds, +//! or immediately if the user presses the select button again. The program +//! keeps a count of the number of times it has entered hibernation. The +//! value of the counter is stored in the battery backed memory of the +//! Hibernation module so that it can be retrieved when the microcontroller +//! wakes. +// +//***************************************************************************** + +//***************************************************************************** +// +// Macros to convert character based display rows and columns into the pixel +// based X and Y coordinates needed for display drawing functions. +// +//***************************************************************************** +#define Col(c) ((c) * 6) +#define Row(r) ((r) * 8) + +//***************************************************************************** +// +// A counter that counts the number of ticks of the SysTick interrupt. +// +//***************************************************************************** +volatile uint32_t g_ui32SysTickCount = 0; + +//***************************************************************************** +// +// A buffer to hold character strings that will be printed to the display. +// +//***************************************************************************** +static char g_pcBuf[40]; + +//***************************************************************************** +// +// Text that will be displayed if there is an error. +// +//***************************************************************************** +static char *g_pcErrorText[] = +{ + "The controller", + "did not enter", + "hibernate mode.", + "---------------------", + " PRESS BUTTON", + " TO RESTART", + 0 +}; + +//***************************************************************************** +// +// A flag to indicate the select button was pressed. +// +//***************************************************************************** +static volatile bool bSelectPressed = 0; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Delay a certain number of SysTick timer ticks. +// +//***************************************************************************** +void +SysTickWait(uint32_t ui32Ticks) +{ + ui32Ticks += g_ui32SysTickCount; + while(g_ui32SysTickCount <= ui32Ticks) + { + } +} + +//***************************************************************************** +// +// The SysTick handler. Increments a tick counter and debounces the push +// button. +// +//***************************************************************************** +void +SysTickHandler(void) +{ + uint8_t ui8Data, ui8Delta; + + // + // Increment the tick counter. + // + g_ui32SysTickCount++; + + // + // Get buttons status using button debouncer driver + // + ui8Data = ButtonsPoll(&ui8Delta, 0); + + // + // See if the select button was just pressed. + // + if(BUTTON_PRESSED(SELECT_BUTTON, ui8Data, ui8Delta)) + { + // + // Set a flag to indicate that the select button was just pressed. + // + bSelectPressed = 1; + } + + // + // Else, see if the select button was just released. + // + if(BUTTON_RELEASED(SELECT_BUTTON, ui8Data, ui8Delta)) + { + // + // Clear the button pressed flag. + // + bSelectPressed = 0; + } +} + +//***************************************************************************** +// +// Configure the UART and its pins. This must be called before UARTprintf(). +// +//***************************************************************************** +void +ConfigureUART(void) +{ + // + // Enable the GPIO Peripheral used by the UART. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Enable UART0 + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Configure GPIO Pins for UART mode. + // + ROM_GPIOPinConfigure(GPIO_PA0_U0RX); + ROM_GPIOPinConfigure(GPIO_PA1_U0TX); + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Use the internal 16MHz oscillator as the UART clock source. + // + UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); + + // + // Initialize the UART for console I/O. + // + UARTStdioConfig(0, 115200, 16000000); + // + UARTStdioConfig(0, 115200, 16000000); +} + +//***************************************************************************** +// +// Run the hibernate example. Use a loop to put the microcontroller into +// hibernate mode, and to wake up based on time. Also allow the user to cause +// it to hibernate and/or wake up based on button presses. +// +//***************************************************************************** +int +main(void) +{ + uint32_t ui32Idx; + uint32_t ui32Status = 0; + uint32_t ui32HibernateCount = 0; + tContext sContext; + tRectangle sRect; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the UART. + // + ConfigureUART(); + + // + // Initialize the OLED display + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top 24 rows of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "hibernate", -1, + GrContextDpyWidthGet(&sContext) / 2, 4, 0); + + // + // Initialize the buttons driver + // + ButtonsInit(); + + // + // Set up systick to generate interrupts at 100 Hz. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100); + ROM_SysTickIntEnable(); + ROM_SysTickEnable(); + + // + // Enable the Hibernation module. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE); + + // + // Print wake cause message on display. + // + GrStringDrawCentered(&sContext, "Wake due to:", -1, + GrContextDpyWidthGet(&sContext) / 2, Row(2) + 4, + true); + + // + // Check to see if Hibernation module is already active, which could mean + // that the processor is waking from a hibernation. + // + if(HibernateIsActive()) + { + // + // Read the status bits to see what caused the wake. + // + ui32Status = HibernateIntStatus(0); + HibernateIntClear(ui32Status); + + // + // Wake was due to the push button. + // + if(ui32Status & HIBERNATE_INT_PIN_WAKE) + { + GrStringDrawCentered(&sContext, "BUTTON", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(3) + 4, true); + } + + // + // Wake was due to RTC match + // + else if(ui32Status & HIBERNATE_INT_RTC_MATCH_0) + { + GrStringDrawCentered(&sContext, "TIMEOUT", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(3) + 4, true); + } + + // + // Wake is due to neither button nor RTC, so it must have been a hard + // reset. + // + else + { + GrStringDrawCentered(&sContext, "RESET", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(3) + 4, true); + } + + // + // If the wake is due to button or RTC, then read the first location + // from the battery backed memory, as the hibernation count. + // + if(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0)) + { + HibernateDataGet(&ui32HibernateCount, 1); + } + } + + // + // Enable the Hibernation module. This should always be called, even if + // the module was already enabled, because this function also initializes + // some timing parameters. + // + HibernateEnableExpClk(ROM_SysCtlClockGet()); + + // + // If the wake was not due to button or RTC match, then it was a reset. + // + if(!(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0))) + { + // + // Configure the module clock source. + // + HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE); + + // + // Finish the wake cause message. + // + GrStringDrawCentered(&sContext, "RESET", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(3) + 4, true); + + // + // Wait a couple of seconds in case we need to break in with the + // debugger. + // + SysTickWait(3 * 100); + + // + // Allow time for the crystal to power up. This line is separated from + // the above to make it clear this is still needed, even if the above + // delay is removed. + // + SysTickWait(15); + } + + // + // Print the count of times that hibernate has occurred. + // + usnprintf(g_pcBuf, sizeof(g_pcBuf), "Hib count=%4u", ui32HibernateCount); + GrStringDrawCentered(&sContext, g_pcBuf, -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(1) + 4, true); + + // + // Print messages on the screen about hibernation. + // + GrStringDrawCentered(&sContext, "Select to Hib", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(4) + 4, true); + GrStringDrawCentered(&sContext, "Wake in 5 s,", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(5) + 4, true); + GrStringDrawCentered(&sContext, "or press Select", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(6) + 4, true); + GrStringDrawCentered(&sContext, "for immed. wake.", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(7) + 4, true); + + // + // Clear the button pressed flag, in case it was held down at the + // beginning. + // + bSelectPressed = 0; + + // + // Wait for user to press the button. + // + while(!bSelectPressed) + { + // + // Wait a bit before looping again. + // + SysTickWait(10); + } + + // + // Tell user to release the button. + // + GrStringDrawCentered(&sContext, " ", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(4) + 4, true); + GrStringDrawCentered(&sContext, " ", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(5) + 4, true); + GrStringDrawCentered(&sContext, " ", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(6) + 4, true); + GrStringDrawCentered(&sContext, " ", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(7) + 4, true); + GrStringDrawCentered(&sContext, "Release the", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(5) + 4, true); + GrStringDrawCentered(&sContext, "button.", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(6) + 4, true); + GrStringDrawCentered(&sContext, " ", -1, + GrContextDpyWidthGet(&sContext) / 2, + Row(7) + 4, true); + + // + // Wait for user to release the button. + // + while(bSelectPressed) + { + } + + // + // If hibernation count is very large, it may be that there was already + // a value in the hibernate memory, so reset the count. + // + ui32HibernateCount = (ui32HibernateCount > 10000) ? 0 : ui32HibernateCount; + + // + // Increment the hibernation count, and store it in the battery backed + // memory. + // + ui32HibernateCount++; + HibernateDataSet(&ui32HibernateCount, 1); + + // + // Clear and enable the RTC and set the match registers to 5 seconds in the + // future. Set both to same, though they could be set differently, the + // first to match will cause a wake. + // + HibernateRTCSet(0); + HibernateRTCEnable(); + HibernateRTCMatchSet(0, 5); + + // + // Set wake condition on pin or RTC match. Board will wake when 5 seconds + // elapses, or when the button is pressed. + // + HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC); + + // + // Request hibernation. + // + HibernateRequest(); + + // + // Give it time to activate, it should never get past this wait. + // + SysTickWait(100); + + // + // Should not have got here, something is wrong. Print an error message to + // the user. + // + sRect.i16XMin = 0; + sRect.i16XMax = 95; + sRect.i16YMin = 0; + sRect.i16YMax = 63; + GrContextForegroundSet(&sContext, ClrBlack); + GrRectFill(&sContext, &sRect); + GrContextForegroundSet(&sContext, ClrWhite); + ui32Idx = 0; + while(g_pcErrorText[ui32Idx]) + { + GrStringDraw(&sContext, g_pcErrorText[ui32Idx], -1, Col(0), + Row(ui32Idx), true); + ui32Idx++; + } + + // + // Wait for the user to press the button, then restart the app. + // + bSelectPressed = 0; + while(!bSelectPressed) + { + } + + // + // Reset the processor. + // + ROM_SysCtlReset(); + + // + // Finished. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hibernate/hibernate.ewd b/boards/ek-lm4f232/hibernate/hibernate.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/hibernate/hibernate.ewp b/boards/ek-lm4f232/hibernate/hibernate.ewp new file mode 100644 index 0000000..01b58c9 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.ewp @@ -0,0 +1,801 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\buttons.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\hibernate.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/hibernate/hibernate.icf b/boards/ek-lm4f232/hibernate/hibernate.icf new file mode 100644 index 0000000..4d5e0a6 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// hibernate.icf - Linker configuration file for hibernate. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/hibernate/hibernate.ld b/boards/ek-lm4f232/hibernate/hibernate.ld new file mode 100644 index 0000000..0616e2f --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * hibernate.ld - Linker configuration file for hibernate. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/hibernate/hibernate.sct b/boards/ek-lm4f232/hibernate/hibernate.sct new file mode 100644 index 0000000..6c48662 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; hibernate.sct - Linker configuration file for hibernate. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/hibernate/hibernate.uvopt b/boards/ek-lm4f232/hibernate/hibernate.uvopt new file mode 100644 index 0000000..1674e39 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.uvopt @@ -0,0 +1,359 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + hibernate + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\buttons.c + buttons.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\hibernate.c + hibernate.c + + + 1 + 4 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 8 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 9 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/hibernate/hibernate.uvproj b/boards/ek-lm4f232/hibernate/hibernate.uvproj new file mode 100644 index 0000000..3bc630f --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate.uvproj @@ -0,0 +1,449 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + hibernate + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + hibernate + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\hibernate.bin .\rvmdk\hibernate.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + hibernate.sct + + + --entry Reset_Handler + + + + + + + + Source + + + buttons.c + 1 + ..\drivers\buttons.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + hibernate.c + 1 + .\hibernate.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/hibernate/hibernate_ccs.cmd b/boards/ek-lm4f232/hibernate/hibernate_ccs.cmd new file mode 100644 index 0000000..31c9968 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/hibernate_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * hibernate_ccs.cmd - CCS linker configuration file for hibernate. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; diff --git a/boards/ek-lm4f232/hibernate/readme.txt b/boards/ek-lm4f232/hibernate/readme.txt new file mode 100644 index 0000000..d40c5d7 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/readme.txt @@ -0,0 +1,30 @@ +Hibernate Example + +An example to demonstrate the use of the Hibernation module. The user +can put the microcontroller in hibernation by pressing the select +button. The microcontroller will then wake on its own after 5 seconds, +or immediately if the user presses the select button again. The program +keeps a count of the number of times it has entered hibernation. The +value of the counter is stored in the battery backed memory of the +Hibernation module so that it can be retrieved when the microcontroller +wakes. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/hibernate/rvmdk/hibernate.axf b/boards/ek-lm4f232/hibernate/rvmdk/hibernate.axf new file mode 100644 index 0000000..f12b691 Binary files /dev/null and b/boards/ek-lm4f232/hibernate/rvmdk/hibernate.axf differ diff --git a/boards/ek-lm4f232/hibernate/rvmdk/hibernate.bin b/boards/ek-lm4f232/hibernate/rvmdk/hibernate.bin new file mode 100644 index 0000000..debe05c Binary files /dev/null and b/boards/ek-lm4f232/hibernate/rvmdk/hibernate.bin differ diff --git a/boards/ek-lm4f232/hibernate/startup_ccs.c b/boards/ek-lm4f232/hibernate/startup_ccs.c new file mode 100644 index 0000000..a8afdf3 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/startup_ccs.c @@ -0,0 +1,302 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hibernate/startup_ewarm.c b/boards/ek-lm4f232/hibernate/startup_ewarm.c new file mode 100644 index 0000000..9ca8ec2 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/startup_ewarm.c @@ -0,0 +1,333 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hibernate/startup_gcc.c b/boards/ek-lm4f232/hibernate/startup_gcc.c new file mode 100644 index 0000000..d645b5c --- /dev/null +++ b/boards/ek-lm4f232/hibernate/startup_gcc.c @@ -0,0 +1,349 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/hibernate/startup_rvmdk.S b/boards/ek-lm4f232/hibernate/startup_rvmdk.S new file mode 100644 index 0000000..92e9792 --- /dev/null +++ b/boards/ek-lm4f232/hibernate/startup_rvmdk.S @@ -0,0 +1,358 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declaration for the interrupt handler used by the application. +; +;****************************************************************************** + EXTERN SysTickHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/interrupts/Makefile b/boards/ek-lm4f232/interrupts/Makefile new file mode 100644 index 0000000..309d7f6 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/Makefile @@ -0,0 +1,87 @@ +#****************************************************************************** +# +# Makefile - Rules for building the interrupts example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the interrupts example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/interrupts.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the interrupts example. +# +${COMPILER}/interrupts.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/interrupts.axf: ${COMPILER}/interrupts.o +${COMPILER}/interrupts.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/interrupts.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/interrupts.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/interrupts.axf: interrupts.ld +SCATTERgcc_interrupts=interrupts.ld +ENTRY_interrupts=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/interrupts/ccs/.ccsimportspec b/boards/ek-lm4f232/interrupts/ccs/.ccsimportspec new file mode 100644 index 0000000..9033256 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/interrupts/ccs/.ccsproject b/boards/ek-lm4f232/interrupts/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/interrupts/ccs/.cproject b/boards/ek-lm4f232/interrupts/ccs/.cproject new file mode 100644 index 0000000..0d7ec51 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/interrupts/ccs/.project b/boards/ek-lm4f232/interrupts/ccs/.project new file mode 100644 index 0000000..3b84e41 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/ccs/.project @@ -0,0 +1,55 @@ + + + interrupts + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + interrupts.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/interrupts/interrupts.c + + + interrupts_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/interrupts/interrupts_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/interrupts/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/interrupts/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/interrupts/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.bin b/boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.bin new file mode 100644 index 0000000..8dce1f5 Binary files /dev/null and b/boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.bin differ diff --git a/boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.out b/boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.out new file mode 100644 index 0000000..8e38403 Binary files /dev/null and b/boards/ek-lm4f232/interrupts/ccs/Debug/interrupts.out differ diff --git a/boards/ek-lm4f232/interrupts/ccs/macros.ini_initial b/boards/ek-lm4f232/interrupts/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/interrupts/ccs/target_config.ccxml b/boards/ek-lm4f232/interrupts/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/interrupts/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.bin b/boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.bin new file mode 100644 index 0000000..3ede8df Binary files /dev/null and b/boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.bin differ diff --git a/boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.out b/boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.out new file mode 100644 index 0000000..6805f74 Binary files /dev/null and b/boards/ek-lm4f232/interrupts/ewarm/Exe/interrupts.out differ diff --git a/boards/ek-lm4f232/interrupts/gcc/interrupts.axf b/boards/ek-lm4f232/interrupts/gcc/interrupts.axf new file mode 100644 index 0000000..d6b412a Binary files /dev/null and b/boards/ek-lm4f232/interrupts/gcc/interrupts.axf differ diff --git a/boards/ek-lm4f232/interrupts/gcc/interrupts.bin b/boards/ek-lm4f232/interrupts/gcc/interrupts.bin new file mode 100644 index 0000000..034d8f2 Binary files /dev/null and b/boards/ek-lm4f232/interrupts/gcc/interrupts.bin differ diff --git a/boards/ek-lm4f232/interrupts/interrupts.c b/boards/ek-lm4f232/interrupts/interrupts.c new file mode 100644 index 0000000..7c340f4 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.c @@ -0,0 +1,592 @@ +//***************************************************************************** +// +// interrupts.c - Interrupt preemption and tail-chaining example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/systick.h" +#include "driverlib/sysctl.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Interrupts (interrupts)

+//! +//! This example application demonstrates the interrupt preemption and +//! tail-chaining capabilities of Cortex-M4 microprocessor and NVIC. Nested +//! interrupts are synthesized when the interrupts have the same priority, +//! increasing priorities, and decreasing priorities. With increasing +//! priorities, preemption will occur; in the other two cases tail-chaining +//! will occur. The currently pending interrupts and the currently executing +//! interrupt will be displayed on the display; GPIO pins D0, D1 and D2 will +//! be asserted upon interrupt handler entry and de-asserted before interrupt +//! handler exit so that the off-to-on time can be observed with a scope or +//! logic analyzer to see the speed of tail-chaining (for the two cases where +//! tail-chaining is occurring). +// +//***************************************************************************** + +//***************************************************************************** +// +// The count of interrupts received. This is incremented as each interrupt +// handler runs, and its value saved into interrupt handler specific values to +// determine the order in which the interrupt handlers were executed. +// +//***************************************************************************** +volatile uint32_t g_ui32Index; + +//***************************************************************************** +// +// The value of g_ui32Index when the INT_GPIOA interrupt was processed. +// +//***************************************************************************** +volatile uint32_t g_ui32GPIOa; + +//***************************************************************************** +// +// The value of g_ui32Index when the INT_GPIOB interrupt was processed. +// +//***************************************************************************** +volatile uint32_t g_ui32GPIOb; + +//***************************************************************************** +// +// The value of g_ui32Index when the INT_GPIOC interrupt was processed. +// +//***************************************************************************** +volatile uint32_t g_ui32GPIOc; + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Delay for the specified number of seconds. Depending upon the current +// SysTick value, the delay will be between N-1 and N seconds (i.e. N-1 full +// seconds are guaranteed, along with the remainder of the current second). +// +//***************************************************************************** +void +Delay(uint32_t ui32Seconds) +{ + // + // Loop while there are more seconds to wait. + // + while(ui32Seconds--) + { + // + // Wait until the SysTick value is less than 1000. + // + while(ROM_SysTickValueGet() > 1000) + { + } + + // + // Wait until the SysTick value is greater than 1000. + // + while(ROM_SysTickValueGet() < 1000) + { + } + } +} + +//***************************************************************************** +// +// Display the interrupt state on the CSTN. The currently active and pending +// interrupts are displayed. +// +//***************************************************************************** +void +DisplayIntStatus(void) +{ + uint32_t ui32Temp; + char pcBuffer[6]; + + // + // Display the currently active interrupts. + // + ui32Temp = HWREG(NVIC_ACTIVE0); + pcBuffer[0] = ' '; + pcBuffer[1] = (ui32Temp & 1) ? '1' : ' '; + pcBuffer[2] = (ui32Temp & 2) ? '2' : ' '; + pcBuffer[3] = (ui32Temp & 4) ? '3' : ' '; + pcBuffer[4] = ' '; + pcBuffer[5] = '\0'; + GrStringDraw(&g_sContext, pcBuffer, -1, 48, 32, 1); + + // + // Display the currently pending interrupts. + // + ui32Temp = HWREG(NVIC_PEND0); + pcBuffer[1] = (ui32Temp & 1) ? '1' : ' '; + pcBuffer[2] = (ui32Temp & 2) ? '2' : ' '; + pcBuffer[3] = (ui32Temp & 4) ? '3' : ' '; + GrStringDraw(&g_sContext, pcBuffer, -1, 48, 44, 1); + + // + // Flush the display. + // + GrFlush(&g_sContext); +} + +//***************************************************************************** +// +// This is the handler for INT_GPIOA. It simply saves the interrupt sequence +// number. +// +//***************************************************************************** +void +IntGPIOa(void) +{ + // + // Set PB3 high to indicate entry to this interrupt handler. + // + ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); + + // + // Put the current interrupt state on the display. + // + DisplayIntStatus(); + + // + // Wait two seconds. + // + Delay(2); + + // + // Save and increment the interrupt sequence number. + // + g_ui32GPIOa = g_ui32Index++; + + // + // Set PB3 low to indicate exit from this interrupt handler. + // + ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, 0); +} + +//***************************************************************************** +// +// This is the handler for INT_GPIOB. It triggers INT_GPIOA and saves the +// interrupt sequence number. +// +//***************************************************************************** +void +IntGPIOb(void) +{ + // + // Set PF2 high to indicate entry to this interrupt handler. + // + ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, GPIO_PIN_1); + + // + // Put the current interrupt state on the display. + // + DisplayIntStatus(); + + // + // Trigger the INT_GPIOA interrupt. + // + HWREG(NVIC_SW_TRIG) = INT_GPIOA - 16; + + // + // Put the current interrupt state on the display. + // + DisplayIntStatus(); + + // + // Wait two seconds. + // + Delay(2); + + // + // Save and increment the interrupt sequence number. + // + g_ui32GPIOb = g_ui32Index++; + + // + // Set PDF2 low to indicate exit from this interrupt handler. + // + ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, 0); +} + +//***************************************************************************** +// +// This is the handler for INT_GPIOC. It triggers INT_GPIOB and saves the +// interrupt sequence number. +// +//***************************************************************************** +void +IntGPIOc(void) +{ + // + // Set PF3 high to indicate entry to this interrupt handler. + // + ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_PIN_2); + + // + // Put the current interrupt state on the display. + // + DisplayIntStatus(); + + // + // Trigger the INT_GPIOB interrupt. + // + HWREG(NVIC_SW_TRIG) = INT_GPIOB - 16; + + // + // Put the current interrupt state on the display. + // + DisplayIntStatus(); + + // + // Wait two seconds. + // + Delay(2); + + // + // Save and increment the interrupt sequence number. + // + g_ui32GPIOc = g_ui32Index++; + + // + // Set PF3 low to indicate exit from this interrupt handler. + // + ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, 0); +} + +//***************************************************************************** +// +// This is the main example program. It checks to see that the interrupts are +// processed in the correct order when they have identical priorities, +// increasing priorities, and decreasing priorities. This exercises interrupt +// preemption and tail chaining. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + uint_fast8_t ui8Error; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Enable the peripherals used by this example. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context and find the middle X coordinate. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "interrupts", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + + // + // Put the status header text on the display. + // + GrStringDraw(&g_sContext, "Active:", -1, 6, 32, 0); + GrStringDraw(&g_sContext, "Pending:", -1, 0, 44, 0); + + // + // Configure the PB0-PB2 to be outputs to indicate entry/exit of one + // of the interrupt handlers. + // + ROM_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | + GPIO_PIN_3); + ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2, 0); + + // + // Set up and enable the SysTick timer. It will be used as a reference + // for delay loops in the interrupt handlers. The SysTick timer period + // will be set up for one second. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet()); + ROM_SysTickEnable(); + + // + // Reset the error indicator. + // + ui8Error = 0; + + // + // Enable interrupts to the processor. + // + ROM_IntMasterEnable(); + + // + // Enable the interrupts. + // + ROM_IntEnable(INT_GPIOA); + ROM_IntEnable(INT_GPIOB); + ROM_IntEnable(INT_GPIOC); + + // + // Indicate that the equal interrupt priority test is beginning. + // + GrStringDrawCentered(&g_sContext, "Equal Pri", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 20, 1); + + // + // Set the interrupt priorities so they are all equal. + // + ROM_IntPrioritySet(INT_GPIOA, 0x00); + ROM_IntPrioritySet(INT_GPIOB, 0x00); + ROM_IntPrioritySet(INT_GPIOC, 0x00); + + // + // Reset the interrupt flags. + // + g_ui32GPIOa = 0; + g_ui32GPIOb = 0; + g_ui32GPIOc = 0; + g_ui32Index = 1; + + // + // Trigger the interrupt for GPIO C. + // + HWREG(NVIC_SW_TRIG) = INT_GPIOC - 16; + + // + // Put the current interrupt state on the LCD. + // + DisplayIntStatus(); + + // + // Verify that the interrupts were processed in the correct order. + // + if((g_ui32GPIOa != 3) || (g_ui32GPIOb != 2) || (g_ui32GPIOc != 1)) + { + ui8Error |= 1; + } + + // + // Wait two seconds. + // + Delay(2); + + // + // Indicate that the decreasing interrupt priority test is beginning. + // + GrStringDrawCentered(&g_sContext, " Decreasing Pri ", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 20, 1); + + // + // Set the interrupt priorities so that they are decreasing (i.e. C > B > + // A). + // + ROM_IntPrioritySet(INT_GPIOA, 0x80); + ROM_IntPrioritySet(INT_GPIOB, 0x40); + ROM_IntPrioritySet(INT_GPIOC, 0x00); + + // + // Reset the interrupt flags. + // + g_ui32GPIOa = 0; + g_ui32GPIOb = 0; + g_ui32GPIOc = 0; + g_ui32Index = 1; + + // + // Trigger the interrupt for GPIO C. + // + HWREG(NVIC_SW_TRIG) = INT_GPIOC - 16; + + // + // Put the current interrupt state on the CSTN. + // + DisplayIntStatus(); + + // + // Verify that the interrupts were processed in the correct order. + // + if((g_ui32GPIOa != 3) || (g_ui32GPIOb != 2) || (g_ui32GPIOc != 1)) + { + ui8Error |= 2; + } + + // + // Wait two seconds. + // + Delay(2); + + // + // Indicate that the increasing interrupt priority test is beginning. + // + GrStringDrawCentered(&g_sContext, " Increasing Pri ", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 20, 1); + + // + // Set the interrupt priorities so that they are increasing (i.e. C < B < + // A). + // + ROM_IntPrioritySet(INT_GPIOA, 0x00); + ROM_IntPrioritySet(INT_GPIOB, 0x40); + ROM_IntPrioritySet(INT_GPIOC, 0x80); + + // + // Reset the interrupt flags. + // + g_ui32GPIOa = 0; + g_ui32GPIOb = 0; + g_ui32GPIOc = 0; + g_ui32Index = 1; + + // + // Trigger the interrupt for GPIO C. + // + HWREG(NVIC_SW_TRIG) = INT_GPIOC - 16; + + // + // Put the current interrupt state on the CSTN. + // + DisplayIntStatus(); + + // + // Verify that the interrupts were processed in the correct order. + // + if((g_ui32GPIOa != 1) || (g_ui32GPIOb != 2) || (g_ui32GPIOc != 3)) + { + ui8Error |= 4; + } + + // + // Wait two seconds. + // + Delay(2); + + // + // Disable the interrupts. + // + ROM_IntDisable(INT_GPIOA); + ROM_IntDisable(INT_GPIOB); + ROM_IntDisable(INT_GPIOC); + + // + // Disable interrupts to the processor. + // + ROM_IntMasterDisable(); + + // + // Print out results if error occurred. + // + if(ui8Error) + { + GrStringDraw(&g_sContext, "Equal: P ", -1, 0, 32, 1); + GrStringDraw(&g_sContext, " Inc: P ", -1, 0, 44, 1); + GrStringDraw(&g_sContext, " Dec: P ", -1, 0, 56, 1); + if(ui8Error & 1) + { + GrStringDraw(&g_sContext, "F ", -1, 42, 32, 1); + } + if(ui8Error & 2) + { + GrStringDraw(&g_sContext, "F ", -1, 42, 44, 1); + } + if(ui8Error & 4) + { + GrStringDraw(&g_sContext, "F ", -1, 42, 56, 1); + } + } + else + { + GrStringDrawCentered(&g_sContext, " Success! ", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 20, 1); + } + + // + // Flush the display. + // + GrFlush(&g_sContext); + + // + // Loop forever. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/interrupts/interrupts.ewd b/boards/ek-lm4f232/interrupts/interrupts.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/interrupts/interrupts.ewp b/boards/ek-lm4f232/interrupts/interrupts.ewp new file mode 100644 index 0000000..249a1a6 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.ewp @@ -0,0 +1,792 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\interrupts.c + + + $PROJ_DIR$\startup_ewarm.c + + + diff --git a/boards/ek-lm4f232/interrupts/interrupts.icf b/boards/ek-lm4f232/interrupts/interrupts.icf new file mode 100644 index 0000000..e2f1200 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// interrupts.icf - Linker configuration file for interrupts. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/interrupts/interrupts.ld b/boards/ek-lm4f232/interrupts/interrupts.ld new file mode 100644 index 0000000..5ce7cad --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * interrupts.ld - Linker configuration file for interrupts. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/interrupts/interrupts.sct b/boards/ek-lm4f232/interrupts/interrupts.sct new file mode 100644 index 0000000..4950f23 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; interrupts.sct - Linker configuration file for interrupts. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/interrupts/interrupts.uvopt b/boards/ek-lm4f232/interrupts/interrupts.uvopt new file mode 100644 index 0000000..9742887 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.uvopt @@ -0,0 +1,317 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + interrupts + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\interrupts.c + interrupts.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + + + Libraries + 1 + 0 + 0 + + 2 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 6 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/interrupts/interrupts.uvproj b/boards/ek-lm4f232/interrupts/interrupts.uvproj new file mode 100644 index 0000000..c645e5b --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts.uvproj @@ -0,0 +1,434 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + interrupts + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + interrupts + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\interrupts.bin .\rvmdk\interrupts.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + interrupts.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + interrupts.c + 1 + .\interrupts.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/interrupts/interrupts_ccs.cmd b/boards/ek-lm4f232/interrupts/interrupts_ccs.cmd new file mode 100644 index 0000000..1cb0583 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/interrupts_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * interrupts_ccs.cmd - CCS linker configuration file for interrupts. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/interrupts/readme.txt b/boards/ek-lm4f232/interrupts/readme.txt new file mode 100644 index 0000000..98658da --- /dev/null +++ b/boards/ek-lm4f232/interrupts/readme.txt @@ -0,0 +1,33 @@ +Interrupts + +This example application demonstrates the interrupt preemption and +tail-chaining capabilities of Cortex-M4 microprocessor and NVIC. Nested +interrupts are synthesized when the interrupts have the same priority, +increasing priorities, and decreasing priorities. With increasing +priorities, preemption will occur; in the other two cases tail-chaining +will occur. The currently pending interrupts and the currently executing +interrupt will be displayed on the display; GPIO pins D0, D1 and D2 will +be asserted upon interrupt handler entry and de-asserted before interrupt +handler exit so that the off-to-on time can be observed with a scope or +logic analyzer to see the speed of tail-chaining (for the two cases where +tail-chaining is occurring). + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/interrupts/rvmdk/interrupts.axf b/boards/ek-lm4f232/interrupts/rvmdk/interrupts.axf new file mode 100644 index 0000000..8c8789b Binary files /dev/null and b/boards/ek-lm4f232/interrupts/rvmdk/interrupts.axf differ diff --git a/boards/ek-lm4f232/interrupts/rvmdk/interrupts.bin b/boards/ek-lm4f232/interrupts/rvmdk/interrupts.bin new file mode 100644 index 0000000..72077ec Binary files /dev/null and b/boards/ek-lm4f232/interrupts/rvmdk/interrupts.bin differ diff --git a/boards/ek-lm4f232/interrupts/startup_ccs.c b/boards/ek-lm4f232/interrupts/startup_ccs.c new file mode 100644 index 0000000..284673a --- /dev/null +++ b/boards/ek-lm4f232/interrupts/startup_ccs.c @@ -0,0 +1,304 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void IntGPIOa(void); +extern void IntGPIOb(void); +extern void IntGPIOc(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntGPIOa, // GPIO Port A + IntGPIOb, // GPIO Port B + IntGPIOc, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/interrupts/startup_ewarm.c b/boards/ek-lm4f232/interrupts/startup_ewarm.c new file mode 100644 index 0000000..88d0875 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/startup_ewarm.c @@ -0,0 +1,335 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void IntGPIOa(void); +extern void IntGPIOb(void); +extern void IntGPIOc(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntGPIOa, // GPIO Port A + IntGPIOb, // GPIO Port B + IntGPIOc, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/interrupts/startup_gcc.c b/boards/ek-lm4f232/interrupts/startup_gcc.c new file mode 100644 index 0000000..7e22222 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/startup_gcc.c @@ -0,0 +1,351 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void IntGPIOa(void); +extern void IntGPIOb(void); +extern void IntGPIOc(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntGPIOa, // GPIO Port A + IntGPIOb, // GPIO Port B + IntGPIOc, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/interrupts/startup_rvmdk.S b/boards/ek-lm4f232/interrupts/startup_rvmdk.S new file mode 100644 index 0000000..77598e3 --- /dev/null +++ b/boards/ek-lm4f232/interrupts/startup_rvmdk.S @@ -0,0 +1,360 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN IntGPIOa + EXTERN IntGPIOb + EXTERN IntGPIOc + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntGPIOa ; GPIO Port A + DCD IntGPIOb ; GPIO Port B + DCD IntGPIOc ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/mpu_fault/Makefile b/boards/ek-lm4f232/mpu_fault/Makefile new file mode 100644 index 0000000..e759592 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/Makefile @@ -0,0 +1,87 @@ +#****************************************************************************** +# +# Makefile - Rules for building the MPU example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the MPU example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/mpu_fault.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the MPU example. +# +${COMPILER}/mpu_fault.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/mpu_fault.axf: ${COMPILER}/mpu_fault.o +${COMPILER}/mpu_fault.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/mpu_fault.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/mpu_fault.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/mpu_fault.axf: mpu_fault.ld +SCATTERgcc_mpu_fault=mpu_fault.ld +ENTRY_mpu_fault=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/mpu_fault/ccs/.ccsimportspec b/boards/ek-lm4f232/mpu_fault/ccs/.ccsimportspec new file mode 100644 index 0000000..2bef69c --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/mpu_fault/ccs/.ccsproject b/boards/ek-lm4f232/mpu_fault/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/mpu_fault/ccs/.cproject b/boards/ek-lm4f232/mpu_fault/ccs/.cproject new file mode 100644 index 0000000..75abdc9 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/mpu_fault/ccs/.project b/boards/ek-lm4f232/mpu_fault/ccs/.project new file mode 100644 index 0000000..a189b55 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/ccs/.project @@ -0,0 +1,55 @@ + + + mpu_fault + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + mpu_fault.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/mpu_fault/mpu_fault.c + + + mpu_fault_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/mpu_fault/mpu_fault_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/mpu_fault/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/mpu_fault/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/mpu_fault/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.bin b/boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.bin new file mode 100644 index 0000000..0e2182e Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.bin differ diff --git a/boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.out b/boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.out new file mode 100644 index 0000000..490b355 Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/ccs/Debug/mpu_fault.out differ diff --git a/boards/ek-lm4f232/mpu_fault/ccs/macros.ini_initial b/boards/ek-lm4f232/mpu_fault/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/mpu_fault/ccs/target_config.ccxml b/boards/ek-lm4f232/mpu_fault/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.bin b/boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.bin new file mode 100644 index 0000000..30c867e Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.bin differ diff --git a/boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.out b/boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.out new file mode 100644 index 0000000..688af96 Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/ewarm/Exe/mpu_fault.out differ diff --git a/boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.axf b/boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.axf new file mode 100644 index 0000000..31fed82 Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.axf differ diff --git a/boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.bin b/boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.bin new file mode 100644 index 0000000..4104af0 Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/gcc/mpu_fault.bin differ diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.c b/boards/ek-lm4f232/mpu_fault/mpu_fault.c new file mode 100644 index 0000000..88e2f24 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.c @@ -0,0 +1,413 @@ +//***************************************************************************** +// +// mpu_fault.c - MPU example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/interrupt.h" +#include "driverlib/mpu.h" +#include "driverlib/sysctl.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

MPU (mpu_fault)

+//! +//! This example application demonstrates the use of the MPU to protect a +//! region of memory from access, and to generate a memory management fault +//! when there is an access violation. +// +//***************************************************************************** + +//***************************************************************************** +// +// Variables to hold the state of the fault status when the fault occurs and +// the faulting address. +// +//***************************************************************************** +static volatile uint32_t g_ui32MMAR; +static volatile uint32_t g_ui32FaultStatus; + +//***************************************************************************** +// +// A counter to track the number of times the fault handler has been entered. +// +//***************************************************************************** +static volatile uint32_t g_ui32MPUFaultCount; + +//***************************************************************************** +// +// A location for storing data read from various addresses. Volatile forces +// the compiler to use it and not optimize the access away. +// +//***************************************************************************** +static volatile uint32_t g_ui32Value; + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// The exception handler for memory management faults, which are caused by MPU +// access violations. This handler will verify the cause of the fault and +// clear the NVIC fault status register. +// +//***************************************************************************** +void +MPUFaultHandler(void) +{ + // + // Preserve the value of the MMAR (the address causing the fault). + // Preserve the fault status register value, then clear it. + // + g_ui32MMAR = HWREG(NVIC_MM_ADDR); + g_ui32FaultStatus = HWREG(NVIC_FAULT_STAT); + HWREG(NVIC_FAULT_STAT) = g_ui32FaultStatus; + + // + // Increment a counter to indicate the fault occurred. + // + g_ui32MPUFaultCount++; + + // + // Disable the MPU so that this handler can return and cause no more + // faults. The actual instruction that faulted will be re-executed. + // + ROM_MPUDisable(); +} + +//***************************************************************************** +// +// This example demonstrates how to configure MPU regions for different levels +// of memory protection. The following memory map is set up: +// +// 0000.0000 - 0000.1C00 - rgn 0: executable read-only, flash +// 0000.1C00 - 0000.2000 - rgn 0: no access, flash (disabled sub-region 7) +// 2000.0000 - 2000.4000 - rgn 1: read-write, RAM +// 2000.4000 - 2000.6000 - rgn 2: read-only, RAM (disabled sub-rgn 4 of rgn 1) +// 2000.6000 - 2000.7FFF - rgn 1: read-write, RAM +// 4000.0000 - 4001.0000 - rgn 3: read-write, peripherals +// 4001.0000 - 4002.0000 - rgn 3: no access (disabled sub-region 1) +// 4002.0000 - 4006.0000 - rgn 3: read-write, peripherals +// 4006.0000 - 4008.0000 - rgn 3: no access (disabled sub-region 6, 7) +// E000.E000 - E000.F000 - rgn 4: read-write, NVIC +// 0100.0000 - 0100.FFFF - rgn 5: executable read-only, ROM +// +// The example code will attempt to perform the following operations and check +// the faulting behavior: +// +// - write to flash (should fault) +// - read from the disabled area of flash (should fault) +// - read from the read-only area of RAM (should not fault) +// - write to the read-only section of RAM (should fault) +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + unsigned int bFail = 0; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context and find the middle X coordinate. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "mpu-fault", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + + // + // Configure an executable, read-only MPU region for flash. It is a 16 KB + // region with the last 2 KB disabled to result in a 14 KB executable + // region. This region is needed so that the program can execute from + // flash. + // + ROM_MPURegionSet(0, FLASH_BASE, + MPU_RGN_SIZE_16K | MPU_RGN_PERM_EXEC | + MPU_RGN_PERM_PRV_RO_USR_RO | MPU_SUB_RGN_DISABLE_7 | + MPU_RGN_ENABLE); + + // + // Configure a read-write MPU region for RAM. It is a 32 KB region. There + // is a 4 KB sub-region in the middle that is disabled in order to open up + // a hole in which different permissions can be applied. + // + ROM_MPURegionSet(1, SRAM_BASE, + MPU_RGN_SIZE_32K | MPU_RGN_PERM_NOEXEC | + MPU_RGN_PERM_PRV_RW_USR_RW | MPU_SUB_RGN_DISABLE_4 | + MPU_RGN_ENABLE); + + // + // Configure a read-only MPU region for the 4 KB of RAM that is disabled in + // the previous region. This region is used for demonstrating read-only + // permissions. + // + ROM_MPURegionSet(2, SRAM_BASE + 0x4000, + MPU_RGN_SIZE_2K | MPU_RGN_PERM_NOEXEC | + MPU_RGN_PERM_PRV_RO_USR_RO | MPU_RGN_ENABLE); + + // + // Configure a read-write MPU region for peripherals. The region is 512 KB + // total size, with several sub-regions disabled to prevent access to areas + // where there are no peripherals. This region is needed because the + // program needs access to some peripherals. + // + ROM_MPURegionSet(3, 0x40000000, + MPU_RGN_SIZE_512K | MPU_RGN_PERM_NOEXEC | + MPU_RGN_PERM_PRV_RW_USR_RW | MPU_SUB_RGN_DISABLE_1 | + MPU_SUB_RGN_DISABLE_6 | MPU_SUB_RGN_DISABLE_7 | + MPU_RGN_ENABLE); + + // + // Configure a read-write MPU region for access to the NVIC. The region is + // 4 KB in size. This region is needed because NVIC registers are needed + // in order to control the MPU. + // + ROM_MPURegionSet(4, NVIC_BASE, + MPU_RGN_SIZE_4K | MPU_RGN_PERM_NOEXEC | + MPU_RGN_PERM_PRV_RW_USR_RW | MPU_RGN_ENABLE); + + // + // Configure an executable, read-only MPU region for ROM. It is a 64 KB + // region. This region is needed so that ROM library calls work. + // + ROM_MPURegionSet(5, (uint32_t)ROM_APITABLE & 0xFFFF0000, + MPU_RGN_SIZE_64K | MPU_RGN_PERM_EXEC | + MPU_RGN_PERM_PRV_RO_USR_RO | MPU_RGN_ENABLE); + + // + // Need to clear the NVIC fault status register to make sure there is no + // status hanging around from a previous program. + // + g_ui32FaultStatus = HWREG(NVIC_FAULT_STAT); + HWREG(NVIC_FAULT_STAT) = g_ui32FaultStatus; + + // + // Enable the MPU fault. + // + ROM_IntEnable(FAULT_MPU); + + // + // Enable the MPU. This will begin to enforce the memory protection + // regions. The MPU is configured so that when in the hard fault or NMI + // exceptions, a default map will be used. Neither of these should occur + // in this example program. + // + ROM_MPUEnable(MPU_CONFIG_HARDFLT_NMI); + + // + // Attempt to write to the flash. This should cause a protection fault due + // to the fact that this region is read-only. + // + GrStringDraw(&g_sContext, "Flash write", -1, 0, 12, 0); + g_ui32MPUFaultCount = 0; + HWREG(0x100) = 0x12345678; + + // + // Verify that the fault occurred, at the expected address. + // + if((g_ui32MPUFaultCount == 1) && (g_ui32FaultStatus == 0x82) && + (g_ui32MMAR == 0x100)) + { + GrStringDraw(&g_sContext, " OK", -1, 72, 12, 0); + } + else + { + bFail = 1; + GrStringDraw(&g_sContext, "NOK", -1, 72, 12, 0); + } + + // + // The MPU was disabled when the previous fault occurred, so it needs to be + // re-enabled. + // + ROM_MPUEnable(MPU_CONFIG_HARDFLT_NMI); + + // + // Attempt to read from the disabled section of flash, the upper 2 KB of + // the 16 KB region. + // + GrStringDraw(&g_sContext, "Flash read", -1, 0, 22, 0); + g_ui32MPUFaultCount = 0; + g_ui32Value = HWREG(0x3820); + + // + // Verify that the fault occurred, at the expected address. + // + if((g_ui32MPUFaultCount == 1) && (g_ui32FaultStatus == 0x82) && + (g_ui32MMAR == 0x3820)) + { + GrStringDraw(&g_sContext, " OK", -1, 72, 22, 0); + } + else + { + bFail = 1; + GrStringDraw(&g_sContext, "NOK", -1, 72, 22, 0); + } + + // + // The MPU was disabled when the previous fault occurred, so it needs to be + // re-enabled. + // + ROM_MPUEnable(MPU_CONFIG_HARDFLT_NMI); + + // + // Attempt to read from the read-only area of RAM, the middle 4 KB of the + // 32 KB region. + // + GrStringDraw(&g_sContext, "RAM read", -1, 0, 32, 0); + g_ui32MPUFaultCount = 0; + g_ui32Value = HWREG(0x20004440); + + // + // Verify that the RAM read did not cause a fault. + // + if(g_ui32MPUFaultCount == 0) + { + GrStringDraw(&g_sContext, " OK", -1, 72, 32, 0); + } + else + { + bFail = 1; + GrStringDraw(&g_sContext, "NOK", -1, 72, 32, 0); + } + + // + // The MPU should not have been disabled since the last access was not + // supposed to cause a fault. But if it did cause a fault, then the MPU + // will be disabled, so re-enable it here anyway, just in case. + // + ROM_MPUEnable(MPU_CONFIG_HARDFLT_NMI); + + // + // Attempt to write to the read-only area of RAM, the middle 4 KB of the + // 32 KB region. + // + GrStringDraw(&g_sContext, "RAM write", -1, 0, 42, 0); + g_ui32MPUFaultCount = 0; + HWREG(0x20004460) = 0xabcdef00; + + // + // Verify that the RAM write caused a fault. + // + if((g_ui32MPUFaultCount == 1) && (g_ui32FaultStatus == 0x82) && + (g_ui32MMAR == 0x20004460)) + { + GrStringDraw(&g_sContext, " OK", -1, 72, 42, 0); + } + else + { + bFail = 1; + GrStringDraw(&g_sContext, "NOK", -1, 72, 42, 0); + } + + // + // Display the results of the example program. + // + if(bFail) + { + GrStringDrawCentered(&g_sContext, "Failure!", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 56, 0); + } + else + { + GrStringDrawCentered(&g_sContext, "Success!", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 56, 0); + } + + // + // Disable the MPU, so there are no lingering side effects if another + // program is run. + // + ROM_MPUDisable(); + + // + // Loop forever. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.ewd b/boards/ek-lm4f232/mpu_fault/mpu_fault.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.ewp b/boards/ek-lm4f232/mpu_fault/mpu_fault.ewp new file mode 100644 index 0000000..4b4c9cf --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.ewp @@ -0,0 +1,792 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\mpu_fault.c + + + $PROJ_DIR$\startup_ewarm.c + + + diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.icf b/boards/ek-lm4f232/mpu_fault/mpu_fault.icf new file mode 100644 index 0000000..b0677f6 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// mpu_fault.icf - Linker configuration file for mpu_fault. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.ld b/boards/ek-lm4f232/mpu_fault/mpu_fault.ld new file mode 100644 index 0000000..43449ef --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * mpu_fault.ld - Linker configuration file for mpu_fault. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.sct b/boards/ek-lm4f232/mpu_fault/mpu_fault.sct new file mode 100644 index 0000000..cbf4f70 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; mpu_fault.sct - Linker configuration file for mpu_fault. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.uvopt b/boards/ek-lm4f232/mpu_fault/mpu_fault.uvopt new file mode 100644 index 0000000..dd39fad --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.uvopt @@ -0,0 +1,317 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + mpu_fault + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\mpu_fault.c + mpu_fault.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + + + Libraries + 1 + 0 + 0 + + 2 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 6 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault.uvproj b/boards/ek-lm4f232/mpu_fault/mpu_fault.uvproj new file mode 100644 index 0000000..a9570e2 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault.uvproj @@ -0,0 +1,434 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + mpu_fault + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + mpu_fault + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\mpu_fault.bin .\rvmdk\mpu_fault.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + mpu_fault.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + mpu_fault.c + 1 + .\mpu_fault.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/mpu_fault/mpu_fault_ccs.cmd b/boards/ek-lm4f232/mpu_fault/mpu_fault_ccs.cmd new file mode 100644 index 0000000..c5939c3 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/mpu_fault_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * mpu_fault_ccs.cmd - CCS linker configuration file for mpu_fault. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; diff --git a/boards/ek-lm4f232/mpu_fault/readme.txt b/boards/ek-lm4f232/mpu_fault/readme.txt new file mode 100644 index 0000000..b8c0a0b --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/readme.txt @@ -0,0 +1,25 @@ +MPU + +This example application demonstrates the use of the MPU to protect a +region of memory from access, and to generate a memory management fault +when there is an access violation. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.axf b/boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.axf new file mode 100644 index 0000000..b3ad37a Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.axf differ diff --git a/boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.bin b/boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.bin new file mode 100644 index 0000000..cad0bc6 Binary files /dev/null and b/boards/ek-lm4f232/mpu_fault/rvmdk/mpu_fault.bin differ diff --git a/boards/ek-lm4f232/mpu_fault/startup_ccs.c b/boards/ek-lm4f232/mpu_fault/startup_ccs.c new file mode 100644 index 0000000..9c4fb48 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/startup_ccs.c @@ -0,0 +1,302 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void MPUFaultHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + MPUFaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/mpu_fault/startup_ewarm.c b/boards/ek-lm4f232/mpu_fault/startup_ewarm.c new file mode 100644 index 0000000..ba2e3c4 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/startup_ewarm.c @@ -0,0 +1,333 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void MPUFaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + MPUFaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/mpu_fault/startup_gcc.c b/boards/ek-lm4f232/mpu_fault/startup_gcc.c new file mode 100644 index 0000000..1eb8c18 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/startup_gcc.c @@ -0,0 +1,349 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void MPUFaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + MPUFaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/mpu_fault/startup_rvmdk.S b/boards/ek-lm4f232/mpu_fault/startup_rvmdk.S new file mode 100644 index 0000000..4d13ad2 --- /dev/null +++ b/boards/ek-lm4f232/mpu_fault/startup_rvmdk.S @@ -0,0 +1,358 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declaration for the interrupt handler used by the application. +; +;****************************************************************************** + EXTERN MPUFaultHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD MPUFaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/qs-logger/Makefile b/boards/ek-lm4f232/qs-logger/Makefile new file mode 100644 index 0000000..5d3f5d9 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/Makefile @@ -0,0 +1,108 @@ +#****************************************************************************** +# +# Makefile - Rules for building the Data logger quickstart example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../third_party/fatfs/port +VPATH+=../../../../third_party/fatfs/src +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. +IPATH+=../../../../third_party + +# +# The default rule, which causes the Data logger quickstart example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/qs-logger.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the Data logger quickstart example. +# +${COMPILER}/qs-logger.axf: ${COMPILER}/acquire.o +${COMPILER}/qs-logger.axf: ${COMPILER}/buttons.o +${COMPILER}/qs-logger.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/qs-logger.axf: ${COMPILER}/clocksetwidget.o +${COMPILER}/qs-logger.axf: ${COMPILER}/fat_usbmsc.o +${COMPILER}/qs-logger.axf: ${COMPILER}/ff.o +${COMPILER}/qs-logger.axf: ${COMPILER}/flashstore.o +${COMPILER}/qs-logger.axf: ${COMPILER}/images.o +${COMPILER}/qs-logger.axf: ${COMPILER}/menus.o +${COMPILER}/qs-logger.axf: ${COMPILER}/qs-logger.o +${COMPILER}/qs-logger.axf: ${COMPILER}/slidemenuwidget.o +${COMPILER}/qs-logger.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/qs-logger.axf: ${COMPILER}/stripchartmanager.o +${COMPILER}/qs-logger.axf: ${COMPILER}/stripchartwidget.o +${COMPILER}/qs-logger.axf: ${COMPILER}/uartstdio.o +${COMPILER}/qs-logger.axf: ${COMPILER}/usb_serial_structs.o +${COMPILER}/qs-logger.axf: ${COMPILER}/usbserial.o +${COMPILER}/qs-logger.axf: ${COMPILER}/usbstick.o +${COMPILER}/qs-logger.axf: ${COMPILER}/ustdlib.o +${COMPILER}/qs-logger.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/qs-logger.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/qs-logger.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/qs-logger.axf: qs-logger.ld +SCATTERgcc_qs-logger=qs-logger.ld +ENTRY_qs-logger=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/qs-logger/acquire.c b/boards/ek-lm4f232/qs-logger/acquire.c new file mode 100644 index 0000000..52b530f --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/acquire.c @@ -0,0 +1,965 @@ +//***************************************************************************** +// +// acquire.c - Data acquisition module for data logger application. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include +#include "driverlib/debug.h" +#include "driverlib/adc.h" +#include "driverlib/gpio.h" +#include "driverlib/hibernate.h" +#include "driverlib/interrupt.h" +#include "driverlib/rom_map.h" +#include "driverlib/sysctl.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "grlib/canvas.h" +#include "inc/hw_types.h" +#include "inc/hw_memmap.h" +#include "inc/hw_ints.h" +#include "inc/hw_gpio.h" +#include "utils/ustdlib.h" +#include "drivers/slidemenuwidget.h" +#include "drivers/stripchartwidget.h" +#include "stripchartmanager.h" +#include "clocksetwidget.h" +#include "qs-logger.h" +#include "usbstick.h" +#include "usbserial.h" +#include "flashstore.h" +#include "menus.h" +#include "acquire.h" + +//***************************************************************************** +// +// This is the data acquisition module. It performs acquisition of data from +// selected channels, starting and stopping data logging, storing acquired +// data, and running the strip chart display. +// +//***************************************************************************** + +//***************************************************************************** +// +// The following defines which ADC channel control should be used for each +// kind of data item. Basically it maps how the ADC channels are connected +// on the board. This is a hardware configuration. +// +//***************************************************************************** +#define CHAN_USER0 ADC_CTL_CH0 +#define CHAN_USER1 ADC_CTL_CH1 +#define CHAN_USER2 ADC_CTL_CH2 +#define CHAN_USER3 ADC_CTL_CH3 +#define CHAN_ACCELX ADC_CTL_CH8 +#define CHAN_ACCELY ADC_CTL_CH9 +#define CHAN_ACCELZ ADC_CTL_CH21 +#define CHAN_EXTTEMP ADC_CTL_CH20 +#define CHAN_CURRENT ADC_CTL_CH23 +#define CHAN_INTTEMP ADC_CTL_TS + +//***************************************************************************** +// +// The following maps the order that items are acquired and stored by the +// ADC sequencers. Note that 16 samples are specified, using 2 of the +// 8 sample sequencers. The current is sampled multiple times deliberately +// because that value tends to bounce around. It is sampled multiple +// times and will be averaged. +// +//***************************************************************************** +uint32_t g_pui32ADCSeq[] = +{ + CHAN_USER0, CHAN_USER1, CHAN_USER2, CHAN_USER3, CHAN_ACCELX, CHAN_ACCELY, + CHAN_ACCELZ, CHAN_EXTTEMP, CHAN_INTTEMP, CHAN_CURRENT, CHAN_CURRENT, + CHAN_CURRENT, CHAN_CURRENT, CHAN_CURRENT, CHAN_CURRENT, CHAN_CURRENT, +}; +#define NUM_ADC_CHANNELS (sizeof(g_pui32ADCSeq) / \ + sizeof(g_pui32ADCSeq[0])) +#define NUM_CURRENT_SAMPLES 7 + +//***************************************************************************** +// +// A buffer to hold one set of ADC data that is acquired per sample time. +// +//***************************************************************************** +static uint32_t g_pui32ADCData[NUM_ADC_CHANNELS]; + +//***************************************************************************** +// +// The following variables hold the current time stamp, the next match time +// for sampling, and the period of time between samples. All are stored in +// a 32.15 second.subsecond format. +// +//***************************************************************************** +static volatile uint32_t g_pui32TimeStamp[2]; +static volatile uint32_t g_pui32NextMatch[2]; +static uint32_t g_pui32MatchPeriod[2]; + +//***************************************************************************** +// +// The number of data items that are selected for acquisition. +// +//***************************************************************************** +static uint32_t g_ui32NumItems; + +//***************************************************************************** +// +// A counter for the ADC interrupt handler. It is used to track when new +// ADC data is acquired. +// +//***************************************************************************** +static volatile uint32_t g_ui32ADCCount; +static uint32_t g_ui32LastADCCount = 0; + +//***************************************************************************** +// +// A counter for the RTC interrupt handler. +// +//***************************************************************************** +static volatile uint32_t g_pui32RTCInts; + +//***************************************************************************** +// +// A flag to indicate that a keep alive packet is needed (when logging to host +// PC). +// +//***************************************************************************** +static volatile bool g_bNeedKeepAlive = false; + +//***************************************************************************** +// +// Storage for a single record of acquired data. This needs to be large +// enough to hold the time stamp and item mask (defined in the structure +// above) and as many possible data items that can be collected. Force the +// buffer to be a multiple of 32-bits. +// +//***************************************************************************** +#define RECORD_SIZE (sizeof(tLogRecord) + (NUM_LOG_ITEMS * 2)) +static union +{ + uint32_t g_pui32RecordBuf[(RECORD_SIZE + 3) / sizeof(uint32_t)]; + tLogRecord sRecord; +} +g_sRecordBuf; + +//***************************************************************************** +// +// Holds a pointer to the current configuration state, that is determined by +// the user's menu selections. +// +//***************************************************************************** +static tConfigState *g_psConfigState; + +//***************************************************************************** +// +// This function is called when in VIEW mode. The acquired data is written +// as text strings which will appear on the eval board display. +// +//***************************************************************************** +static void +UpdateViewerData(const tLogRecord *psRecord) +{ + static char pcViewerBuf[24]; + uint32_t ui32Idx, pui32RTC; + struct tm sTime; + + // + // Loop through the analog channels and update the text display strings. + // + for(ui32Idx = LOG_ITEM_USER0; ui32Idx <= LOG_ITEM_USER3; ui32Idx++) + { + usnprintf(pcViewerBuf, sizeof(pcViewerBuf), " CH%u: %u.%03u V ", + ui32Idx - LOG_ITEM_USER0, psRecord->pi16Items[ui32Idx] / 1000, + psRecord->pi16Items[ui32Idx] % 1000); + MenuUpdateText(ui32Idx, pcViewerBuf); + } + + // + // Loop through the accel channels and update the text display strings. + // + for(ui32Idx = LOG_ITEM_ACCELX; ui32Idx <= LOG_ITEM_ACCELZ; ui32Idx++) + { + int16_t i16Accel = psRecord->pi16Items[ui32Idx]; + i16Accel *= (i16Accel < 0) ? -1 : 1; + usnprintf(pcViewerBuf, sizeof(pcViewerBuf), " %c: %c%d.%02u g ", + (ui32Idx - LOG_ITEM_ACCELX) + 'X', + psRecord->pi16Items[ui32Idx] < 0 ? '-' : '+', + i16Accel / 100, i16Accel % 100); + MenuUpdateText(ui32Idx, pcViewerBuf); + } + + // + // Update the display string for internal temperature. + // + usnprintf(pcViewerBuf, sizeof(pcViewerBuf), " INT: %d.%01u C ", + psRecord->pi16Items[LOG_ITEM_INTTEMP] / 10, + psRecord->pi16Items[LOG_ITEM_INTTEMP] % 10); + MenuUpdateText(LOG_ITEM_INTTEMP, pcViewerBuf); + + // + // Update the display string for external temperature. + // + usnprintf(pcViewerBuf, sizeof(pcViewerBuf), " EXT: %d.%01u C ", + psRecord->pi16Items[LOG_ITEM_EXTTEMP] / 10, + psRecord->pi16Items[LOG_ITEM_EXTTEMP] % 10); + MenuUpdateText(LOG_ITEM_EXTTEMP, pcViewerBuf); + + // + // Update the display string for processor current. + // + usnprintf(pcViewerBuf, sizeof(pcViewerBuf), " %u.%01u mA ", + psRecord->pi16Items[LOG_ITEM_CURRENT] / 10, + psRecord->pi16Items[LOG_ITEM_CURRENT] % 10); + MenuUpdateText(LOG_ITEM_CURRENT, pcViewerBuf); + + // + // Update the display strings for time and data. + // + pui32RTC = HibernateRTCGet(); + ulocaltime(pui32RTC, &sTime); + usnprintf(pcViewerBuf, sizeof(pcViewerBuf), "%4u/%02u/%02u", + sTime.tm_year+1900, sTime.tm_mon + 1, sTime.tm_mday); + MenuUpdateText(TEXT_ITEM_DATE, pcViewerBuf); + usnprintf(pcViewerBuf, sizeof(pcViewerBuf), "%02u:%02u:%02u", + sTime.tm_hour, sTime.tm_min, sTime.tm_sec); + MenuUpdateText(TEXT_ITEM_TIME, pcViewerBuf); +} + +//***************************************************************************** +// +// This function is called from the AcquireRun() function and should be in +// context of the main thread. It pulls data items from the ADC data buffer, +// converts units as needed, and stores the results in a log record that is +// pointed at by the function parameter. +// +//***************************************************************************** +static void +ProcessDataItems(tLogRecord *psRecord) +{ + int32_t i32Accel, i32TempC; + uint32_t ui32SelectedMask, ui32Millivolts, ui32Current; + uint_fast8_t ui8Idx, ui8ItemIdx; + + + // + // Initialize locals. + // + ui8ItemIdx = 0; + ui32SelectedMask = g_psConfigState->ui16SelectedMask; + ui32Current = 0; + + // + // Save the time stamp that was saved when the ADC data was acquired. + // Also save into the record the bit mask of the selected data items. + // + psRecord->ui32Seconds = g_pui32TimeStamp[0]; + psRecord->ui16Subseconds = (uint16_t)g_pui32TimeStamp[1]; + psRecord->ui16ItemMask = (uint16_t)ui32SelectedMask; + + // + // Process the user analog input channels. These will be converted and + // stored as millivolts. + // + for(ui8Idx = LOG_ITEM_USER0; ui8Idx <= LOG_ITEM_USER3; ui8Idx++) + { + // + // Check to see if this item should be logged + // + if((1 << ui8Idx) & ui32SelectedMask) + { + ui32Millivolts = (g_pui32ADCData[ui8Idx] * 4100) / 819; + psRecord->pi16Items[ui8ItemIdx++] = (int16_t)ui32Millivolts; + } + } + + // + // Process the accelerometers. These will be processed and stored in + // units of 1/100 g. + // + for(ui8Idx = LOG_ITEM_ACCELX; ui8Idx <= LOG_ITEM_ACCELZ; ui8Idx++) + { + // + // Check to see if this item should be logged + // + if((1 << ui8Idx) & ui32SelectedMask) + { + i32Accel = (((int32_t)g_pui32ADCData[ui8Idx] - 2047L) * 1000L) / + 4095L; + psRecord->pi16Items[ui8ItemIdx++] = (int16_t)i32Accel; + } + } + + // + // Process the external temperature. The temperature is stored in units + // of 1/10 C. + // + if((1 << LOG_ITEM_EXTTEMP) & ui32SelectedMask) + { + i32TempC = (1866300 - ((200000 * g_pui32ADCData[LOG_ITEM_EXTTEMP]) / + 273)) / 1169; + psRecord->pi16Items[ui8ItemIdx++] = (int16_t)i32TempC; + } + + // + // Process the internal temperature. The temperature is stored in units + // of 1/10 C. + // + if((1 << LOG_ITEM_INTTEMP) & ui32SelectedMask) + { + i32TempC = 1475 - ((2250 * g_pui32ADCData[LOG_ITEM_INTTEMP]) / 4095); + psRecord->pi16Items[ui8ItemIdx++] = (int16_t)i32TempC; + } + + // + // Process the current. The current is stored in units of 100 uA, + // (or 1/10000 A). Multiple current samples were taken in order + // to average and smooth the data. + // + if((1 << LOG_ITEM_CURRENT) & ui32SelectedMask) + { + // + // Average all the current samples that are available in the ADC + // buffer. + // + for(ui8Idx = LOG_ITEM_CURRENT; + ui8Idx < (LOG_ITEM_CURRENT + NUM_CURRENT_SAMPLES); ui8Idx++) + { + ui32Current += g_pui32ADCData[ui8Idx]; + } + ui32Current /= NUM_CURRENT_SAMPLES; + + // + // Convert the averaged current into units + // + ui32Current = (ui32Current * 200) / 273; + psRecord->pi16Items[ui8ItemIdx++] = (int16_t)ui32Current; + } +} + +//***************************************************************************** +// +// This is the handler for the ADC interrupt. Even though more than one +// sequencer is used, they are configured so that this one runs last. +// Therefore when this ADC sequencer interrupt occurs, we know all of the ADC +// data has been acquired. +// +//***************************************************************************** +void +ADC0SS0Handler(void) +{ + // + // Clear the interrupts for all ADC sequencers that are used. + // + MAP_ADCIntClear(ADC0_BASE, 0); + MAP_ADCIntClear(ADC1_BASE, 0); + + // + // Retrieve the data from all ADC sequencers + // + MAP_ADCSequenceDataGet(ADC0_BASE, 0, &g_pui32ADCData[0]); + MAP_ADCSequenceDataGet(ADC1_BASE, 0, &g_pui32ADCData[8]); + + // + // Set the time stamp, assume it is what was set for the last match + // value. This will be close to the actual time that the samples were + // acquired, within a few microseconds. + // + g_pui32TimeStamp[0] = g_pui32NextMatch[0]; + g_pui32TimeStamp[1] = g_pui32NextMatch[1]; + + // + // Increment the ADC interrupt count + // + g_ui32ADCCount++; +} + +//***************************************************************************** +// +// This is the handler for the RTC interrupt from the hibernate peripheral. +// It occurs on RTC match. This handler will initiate an ADC acquisition, +// which will run all of the ADC sequencers. Then it computes the next +// match value and sets it in the RTC. +// +//***************************************************************************** +void +RTCHandler(void) +{ + uint32_t ui32Status, ui32Seconds; + + // + // Increment RTC interrupt counter + // + g_pui32RTCInts++; + + // + // Clear the RTC interrupts (this can be slow for hib module) + // + ui32Status = HibernateIntStatus(1); + HibernateIntClear(ui32Status); + + // + // Read and save the current value of the seconds counter. + // + ui32Seconds = HibernateRTCGet(); + + // + // If we are sleep logging, then there will be no remembered value for + // the next match value, which is also used as the time stamp when + // data is collected. In this case we will just use the current + // RTC seconds. This is safe because if sleep-logging is used, it + // is only with periods of whole seconds, 1 second or longer. + // + if(g_psConfigState->ui32SleepLogging) + { + g_pui32NextMatch[0] = ui32Seconds; + g_pui32NextMatch[1] = 0; + } + + // + // If we are logging data to PC and using a period greater than one + // second, then use special handling. For PC logging, if no data is + // collected, then we must send a keep-alive packet once per second. + // + if((g_psConfigState->ui8Storage == CONFIG_STORAGE_HOSTPC) && + (g_pui32MatchPeriod[0] > 1)) + { + // + // If the current seconds count is less than the match value, that + // means we got the interrupt due to one-second keep alive for the + // host PC. + // + if(ui32Seconds < g_pui32NextMatch[0]) + { + // + // Set the next match for one second ahead (next keep-alive) + // + HibernateRTCMatchSet(0, ui32Seconds + 1); + + // + // Set flag to indicate that a keep alive packet is needed + // + g_bNeedKeepAlive = true; + + // + // Nothing else to do except wait for next keep alive or match + // + return; + } + + // + // Else, this is a real match so proceed to below to do a normal + // acquisition. + // + } + + // + // Kick off the next ADC acquisition. When these are done they will + // cause an ADC interrupt. + // + MAP_ADCProcessorTrigger(ADC1_BASE, 0); + MAP_ADCProcessorTrigger(ADC0_BASE, 0); + + // + // Set the next RTC match. Add the match period to the previous match + // value. We are making an assumption here that there is enough time from + // when the match interrupt occurred, to this point in the code, that we + // are still setting the match time in the future. If the period is too + // long, then we could miss a match and never get another RTC interrupt. + // + g_pui32NextMatch[0] += g_pui32MatchPeriod[0]; + g_pui32NextMatch[1] += g_pui32MatchPeriod[1]; + if(g_pui32NextMatch[1] > 32767) + { + // + // Handle subseconds rollover + // + g_pui32NextMatch[1] &= 32767; + g_pui32NextMatch[0]++; + } + + // + // If logging to host PC at greater than 1 second period, then set the + // next RTC wakeup for 1 second from now. This will cause a keep alive + // packet to be sent to the PC + // + if((g_psConfigState->ui8Storage == CONFIG_STORAGE_HOSTPC) && + (g_pui32MatchPeriod[0] > 1)) + { + HibernateRTCMatchSet(0, ui32Seconds + 1); + } + else + { + // + // Otherwise this is a normal match and the next match should also be a + // normal match, so set the next wakeup to the calculated match time. + // + HibernateRTCMatchSet(0, g_pui32NextMatch[0]); + HibernateRTCSSMatchSet(0, g_pui32NextMatch[1]); + } + + // + // Toggle the LED on the board so the user can see that the acquisition + // is running. + // + MAP_GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, + ~MAP_GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_2)); + + // + // Now exit the int handler. The ADC will trigger an interrupt when + // it is finished, and the RTC is set up for the next match. + // +} + +//***************************************************************************** +// +// This function is called from the application main loop to keep the +// acquisition running. It checks to see if there is any new ADC data, and +// if so it processes the new ADC data. +// +// The function returns non-zero if data was acquired, 0 if no data was +// acquired. +// +//***************************************************************************** +int32_t +AcquireRun(void) +{ + tLogRecord *psRecord = &g_sRecordBuf.sRecord; + + // + // Make sure we are properly configured to run + // + if(!g_psConfigState) + { + return(0); + } + + // + // Check to see if new ADC data is available + // + if(g_ui32ADCCount != g_ui32LastADCCount) + { + g_ui32LastADCCount = g_ui32ADCCount; + + // + // Process the ADC data and store it in the record buffer. + // + ProcessDataItems(psRecord); + + // + // Add the newly processed data to the strip chart. Do not add to + // strip start if sleep-logging. + // + if((g_psConfigState->ui8Storage != CONFIG_STORAGE_VIEWER) && + !g_psConfigState->ui32SleepLogging) + { + StripChartMgrAddItems(psRecord->pi16Items); + } + + // + // If USB stick is used, write the record to the USB stick + // + if(g_psConfigState->ui8Storage == CONFIG_STORAGE_USB) + { + USBStickWriteRecord(psRecord); + } + + // + // If host PC is used, write data to USB serial port + // + if(g_psConfigState->ui8Storage == CONFIG_STORAGE_HOSTPC) + { + USBSerialWriteRecord(psRecord); + } + + // + // If flash storage is used, write data to the flash + // + if(g_psConfigState->ui8Storage == CONFIG_STORAGE_FLASH) + { + FlashStoreWriteRecord(psRecord); + + // + // If we are sleep logging, then save the storage address for + // use in the next cycle. + // + if(g_psConfigState->ui32SleepLogging) + { + g_psConfigState->ui32FlashStore = FlashStoreGetAddr(); + } + } + else if(g_psConfigState->ui8Storage == CONFIG_STORAGE_VIEWER) + { + // + // If in viewer mode, then update the viewer text strings. + // + UpdateViewerData(psRecord); + } + + // + // Return indication to caller that data was processed. + // + return(1); + } + else if((g_psConfigState->ui8Storage == CONFIG_STORAGE_HOSTPC) && + (g_bNeedKeepAlive == true)) + { + // + // Else there is no new data to process, but check to see if we are + // logging to PC and a keep alive packet is needed. + // + // Clear keep-alive needed flag + // + g_bNeedKeepAlive = false; + + // + // Make a keep alive packet by creating a record with timestamp of 0. + // + psRecord->ui32Seconds = 0; + psRecord->ui16Subseconds = 0; + psRecord->ui16ItemMask = 0; + + // + // Transmit the dummy record to host PC. + // + USBSerialWriteRecord(psRecord); + } + + // + // Return indication that data was not processed. + // + return(0); +} + +//***************************************************************************** +// +// This function is called to start an acquisition running. It determines +// which channels are to be logged, enables the ADC sequencers, and computes +// the first RTC match value. This will start the acquisition running. +// +//***************************************************************************** +void +AcquireStart(tConfigState *psConfig) +{ + uint32_t ui32Idx, pui32RTC[2], ui32SelectedMask; + + // + // Check the parameters + // + ASSERT(psConfig); + if(!psConfig) + { + return; + } + + // + // Update the config state pointer, save the selected item mask + // + g_psConfigState = psConfig; + ui32SelectedMask = psConfig->ui16SelectedMask; + + // + // Get the logging period from the logger configuration. Split the + // period into seconds and subseconds pieces and save for later use in + // generating RTC match values. + // + g_pui32MatchPeriod[0] = psConfig->ui32Period >> 8; + g_pui32MatchPeriod[1] = (psConfig->ui32Period & 0xFF) << 8; + + // + // Determine how many channels are to be logged + // + ui32Idx = ui32SelectedMask; + g_ui32NumItems = 0; + while(ui32Idx) + { + if(ui32Idx & 1) + { + g_ui32NumItems++; + } + ui32Idx >>= 1; + } + + // + // Initialize the strip chart manager for a new run. Don't bother with + // the strip chart if we are using viewer mode, or sleep-logging. + // + if((psConfig->ui8Storage != CONFIG_STORAGE_VIEWER) && + !psConfig->ui32SleepLogging) + { + StripChartMgrInit(); + StripChartMgrConfigure(ui32SelectedMask); + } + + // + // Configure USB for memory stick if USB storage is chosen + // + if(psConfig->ui8Storage == CONFIG_STORAGE_USB) + { + USBStickOpenLogFile(0); + } + else if(psConfig->ui8Storage == CONFIG_STORAGE_FLASH) + { + + // + // Flash storage is to be used, prepare the flash storage module. + // If already sleep-logging, then pass in the saved flash address + // so it does not need to be searched. + // + if(psConfig->ui32SleepLogging) + { + FlashStoreOpenLogFile(psConfig->ui32FlashStore); + } + else + { + // + // Otherwise not sleep logging, so just initialize the flash store, + // this will cause it to search for the starting storage address. + // + FlashStoreOpenLogFile(0); + } + } + + // + // Enable the ADC sequencers + // + MAP_ADCSequenceEnable(ADC0_BASE, 0); + MAP_ADCSequenceEnable(ADC1_BASE, 0); + + // + // Flush the ADC sequencers to be sure there is no lingering data. + // + MAP_ADCSequenceDataGet(ADC0_BASE, 0, g_pui32ADCData); + MAP_ADCSequenceDataGet(ADC1_BASE, 0, g_pui32ADCData); + + // + // Enable ADC interrupts + // + MAP_ADCIntClear(ADC0_BASE, 0); + MAP_ADCIntClear(ADC1_BASE, 0); + MAP_ADCIntEnable(ADC0_BASE, 0); + MAP_IntEnable(INT_ADC0SS0); + + // + // If we are not already sleep-logging, then initialize the RTC match. + // If we are sleep logging then this does not need to be set up. + // + if(!psConfig->ui32SleepLogging) + { + // + // Get the current RTC value + // + do + { + pui32RTC[0] = HibernateRTCGet(); + pui32RTC[1] = HibernateRTCSSGet(); + } + while(pui32RTC[0] != HibernateRTCGet()); + + // + // Set an initial next match value. Start with the subseconds always + // 0 so the first match value will always be an even multiple of the + // subsecond match. Add 2 seconds to the current RTC just to be clear + // of an imminent rollover. This means that the first match will occur + // between 1 and 2 seconds from now. + // + g_pui32NextMatch[0] = pui32RTC[0] + 2; + g_pui32NextMatch[1] = 0; + + // + // Now set the match value + // + HibernateRTCMatchSet(0, g_pui32NextMatch[0]); + HibernateRTCSSMatchSet(0, g_pui32NextMatch[1]); + } + + // + // If we are configured to sleep, but not sleeping yet, then enter sleep + // logging mode if allowed. + // + if(psConfig->bSleep && !psConfig->ui32SleepLogging) + { + // + // Allow sleep logging if storing to flash at a period of 1 second + // or greater. + // + if((psConfig->ui8Storage == CONFIG_STORAGE_FLASH) && + (psConfig->ui32Period >= 0x100)) + { + psConfig->ui32SleepLogging = 1; + } + } + + // + // Enable the RTC interrupts from the hibernate module + // + HibernateIntClear(HibernateIntStatus(0)); + HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0 | HIBERNATE_INT_PIN_WAKE); + MAP_IntEnable(INT_HIBERNATE); + + // + // Logging data should now start running + // +} + +//***************************************************************************** +// +// This function is called to stop an acquisition running. It disables the +// ADC sequencers and the RTC match interrupt. +// +//***************************************************************************** +void +AcquireStop(void) +{ + // + // Disable RTC interrupts + // + MAP_IntDisable(INT_HIBERNATE); + + // + // Disable ADC interrupts + // + MAP_IntDisable(INT_ADC0SS0); + MAP_IntDisable(INT_ADC1SS0); + + // + // Disable ADC sequencers + // + MAP_ADCSequenceDisable(ADC0_BASE, 0); + MAP_ADCSequenceDisable(ADC1_BASE, 0); + + // + // If USB stick is being used, then close the file so it will flush + // the buffers to the USB stick. + // + if(g_psConfigState->ui8Storage == CONFIG_STORAGE_USB) + { + USBStickCloseFile(); + } + + // + // Disable the configuration pointer, which acts as a flag to indicate + // if we are properly configured for data acquisition. + // + g_psConfigState = 0; +} + +//***************************************************************************** +// +// This function initializes the ADC hardware in preparation for data +// acquisition. +// +//***************************************************************************** +void +AcquireInit(void) +{ + uint32_t ui32Chan, ui32Base, ui32Seq, ui32ChCtl; + + + // + // Enable the ADC peripherals and the associated GPIO port + // + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1); + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP); + + // + // Enabled LED GPIO + // + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + MAP_GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2); + + // + // Configure the pins to be used as analog inputs. + // + MAP_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | + GPIO_PIN_7 | GPIO_PIN_3); + MAP_GPIOPinTypeADC(GPIO_PORTP_BASE, GPIO_PIN_0); + + // + // Select the external reference for greatest accuracy. + // + MAP_ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V); + MAP_ADCReferenceSet(ADC1_BASE, ADC_REF_EXT_3V); + + // + // Apply workaround for erratum 6.1, in order to use the + // external reference. + // + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + HWREG(GPIO_PORTB_BASE + GPIO_O_AMSEL) |= GPIO_PIN_6; + + // + // Initialize both ADC peripherals using sequencer 0 and processor trigger. + // + MAP_ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); + MAP_ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); + + // + // Enter loop to configure all of the ADC sequencer steps needed to + // acquire the data for the data logger. Multiple ADC and sequencers + // will be used in order to acquire all the channels. + // + for(ui32Chan = 0; ui32Chan < NUM_ADC_CHANNELS; ui32Chan++) + { + // + // If this is the first ADC then set the base for ADC0 + // + if(ui32Chan < 8) + { + ui32Base = ADC0_BASE; + ui32Seq = 0; + } + else if(ui32Chan < 16) + { + // + // Second ADC, set the base for ADC1 + // + ui32Base = ADC1_BASE; + ui32Seq = 0; + } + + // + // Get the channel control for each channel. Test to see if it is the + // last channel for the sequencer, and if so then also set the + // interrupt and "end" flags. + // + ui32ChCtl = g_pui32ADCSeq[ui32Chan]; + if((ui32Chan == 7) || (ui32Chan == 15) || + (ui32Chan == (NUM_ADC_CHANNELS - 1))) + { + ui32ChCtl |= ADC_CTL_IE | ADC_CTL_END; + } + + // + // Configure the sequence step + // + MAP_ADCSequenceStepConfigure(ui32Base, ui32Seq, ui32Chan % 8, + ui32ChCtl); + } + + // + // Erase the configuration in case there was a prior configuration. + // + g_psConfigState = 0; +} diff --git a/boards/ek-lm4f232/qs-logger/acquire.h b/boards/ek-lm4f232/qs-logger/acquire.h new file mode 100644 index 0000000..7a96936 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/acquire.h @@ -0,0 +1,57 @@ +//***************************************************************************** +// +// acquire.h - Prototypes and definitions for data acquisition module. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** +#ifndef __ACQUIRE_H__ +#define __ACQUIRE_H__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Module function prototypes. +// +//***************************************************************************** +extern void AcquireInit(void); +extern void AcquireStart(tConfigState *psConfig); +extern void AcquireStop(void); +extern int32_t AcquireRun(void); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif diff --git a/boards/ek-lm4f232/qs-logger/ccs/.ccsimportspec b/boards/ek-lm4f232/qs-logger/ccs/.ccsimportspec new file mode 100644 index 0000000..4afea22 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/ccs/.ccsimportspec @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/qs-logger/ccs/.ccsproject b/boards/ek-lm4f232/qs-logger/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/qs-logger/ccs/.cproject b/boards/ek-lm4f232/qs-logger/ccs/.cproject new file mode 100644 index 0000000..c94b602 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/ccs/.cproject @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/qs-logger/ccs/.project b/boards/ek-lm4f232/qs-logger/ccs/.project new file mode 100644 index 0000000..9fe61a4 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/ccs/.project @@ -0,0 +1,135 @@ + + + qs-logger + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + acquire.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/acquire.c + + + clocksetwidget.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/clocksetwidget.c + + + flashstore.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/flashstore.c + + + images.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/images.c + + + menus.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/menus.c + + + qs-logger.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/qs-logger.c + + + qs-logger_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/qs-logger_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/startup_ccs.c + + + stripchartmanager.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/stripchartmanager.c + + + usb_serial_structs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/usb_serial_structs.c + + + usbserial.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/usbserial.c + + + usbstick.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/qs-logger/usbstick.c + + + drivers/buttons.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/buttons.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + drivers/slidemenuwidget.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/slidemenuwidget.c + + + drivers/stripchartwidget.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/stripchartwidget.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + third_party/fatfs/port/fat_usbmsc.c + 1 + SW_ROOT/third_party/fatfs/port/fat_usbmsc.c + + + third_party/fatfs/src/ff.c + 1 + SW_ROOT/third_party/fatfs/src/ff.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/qs-logger/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/qs-logger/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.bin b/boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.bin new file mode 100644 index 0000000..1b33316 Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.bin differ diff --git a/boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.out b/boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.out new file mode 100644 index 0000000..51e150b Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/ccs/Debug/qs-logger.out differ diff --git a/boards/ek-lm4f232/qs-logger/ccs/macros.ini_initial b/boards/ek-lm4f232/qs-logger/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/qs-logger/ccs/target_config.ccxml b/boards/ek-lm4f232/qs-logger/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/qs-logger/clocksetwidget.c b/boards/ek-lm4f232/qs-logger/clocksetwidget.c new file mode 100644 index 0000000..449ee55 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/clocksetwidget.c @@ -0,0 +1,1031 @@ +//***************************************************************************** +// +// clocksetwidget.c - A widget for setting clock date/time. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "utils/uartstdio.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "utils/ustdlib.h" +#include "clocksetwidget.h" + +//***************************************************************************** +// +//! \addtogroup clocksetwidget_api +//! @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// This is a custom widget for setting the date/time of a clock. The widget +// will display the year, month, day, hour and minute on the display. The +// user can highlight the fields with the left/right keys, and can change the +// value of each with the up/down keys. When finished the user highlights +// the OK field on the screen and presses the select button. +// +//***************************************************************************** + +//***************************************************************************** +// +// Define indices for each of the fields used for date and time. +// +//***************************************************************************** +#define FIELD_YEAR 0 +#define FIELD_MONTH 1 +#define FIELD_DAY 2 +#define FIELD_HOUR 3 +#define FIELD_MINUTE 4 +#define FIELD_OK 5 +#define FIELD_CANCEL 6 +#define FIELD_LAST 6 +#define NUM_FIELDS 7 + +//***************************************************************************** +// +//! Paints the clock set widget on the display. +//! +//! \param psWidget is a pointer to the clock setting widget to be drawn. +//! +//! This function draws the date and time fields of the clock setting widget +//! onto the display. One of the fields can be highlighted. This is +//! called in response to a \b WIDGET_MSG_PAINT message. +//! +//! \return None. +// +//***************************************************************************** +static void +ClockSetPaint(tWidget *psWidget) +{ + tClockSetWidget *psClockWidget; + tContext sContext; + tRectangle sRect, sRectSel; + struct tm *psTime; + char pcBuf[8]; + int32_t i32X, i32Y, i32Width, i32Height; + uint32_t ui32Idx, ui32FontHeight, ui32FontWidth, ui32SelWidth; + + // + // Check the arguments. + // + ASSERT(psWidget); + ASSERT(psWidget->psDisplay); + + // + // Convert the generic widget pointer into a clock set widget pointer. + // + psClockWidget = (tClockSetWidget *)psWidget; + ASSERT(psClockWidget->psTime); + + // + // Get pointer to the time structure + // + psTime = psClockWidget->psTime; + + // + // Initialize a drawing context. + // + GrContextInit(&sContext, psWidget->psDisplay); + + // + // Initialize the clipping region based on the extents of this widget. + // + GrContextClipRegionSet(&sContext, &(psWidget->sPosition)); + + // + // Set the font for the context, and get font height and width - they + // are used a lot later. + // + GrContextFontSet(&sContext, psClockWidget->psFont); + ui32FontHeight = GrFontHeightGet(psClockWidget->psFont); + ui32FontWidth = GrFontMaxWidthGet(psClockWidget->psFont); + + // + // Fill the widget with the background color. + // + GrContextForegroundSet(&sContext, psClockWidget->ui32BackgroundColor); + GrRectFill(&sContext, &sContext.sClipRegion); + + // + // Draw a border around the widget + // + GrContextForegroundSet(&sContext, psClockWidget->ui32ForegroundColor); + GrContextBackgroundSet(&sContext, psClockWidget->ui32BackgroundColor); + GrRectDraw(&sContext, &sContext.sClipRegion); + + // + // Compute a rectangle for the screen title. Put it at the top of + // the widget display, and sized to be the height of the font, plus + // a few pixels of space. + // + sRect.i16XMin = sContext.sClipRegion.i16XMin; + sRect.i16XMax = sContext.sClipRegion.i16XMax; + sRect.i16YMin = sContext.sClipRegion.i16YMin; + sRect.i16YMax = ui32FontHeight * 2; + GrRectDraw(&sContext, &sRect); + + // + // Print a title for the widget + // + GrContextFontSet(&sContext, psClockWidget->psFont); + GrStringDrawCentered(&sContext, "CLOCK SET", -1, + (1 + sRect.i16XMax - sRect.i16XMin) / 2, + (1 + sRect.i16YMax - sRect.i16YMin) / 2, 1); + + // + // Reset the rectangle to cover the non-title area of the display + // + sRect.i16YMin = sRect.i16YMax + 1; + sRect.i16YMax = sContext.sClipRegion.i16YMax; + + // + // Compute the width and height of the area remaining for showing the + // clock fields. + // + i32Width = 1 + (sRect.i16XMax - sRect.i16XMin); + i32Height = 1 + (sRect.i16YMax - sRect.i16YMin); + + // + // Compute the X and Y starting point for the row that will show the + // date. + // + i32X = sRect.i16XMin + (i32Width - (ui32FontWidth * 10)) / 2; + i32Y = sRect.i16YMin + ((i32Height * 1) / 6) - (ui32FontHeight / 2); + + // + // Draw the date field separators on the date row. + // + GrStringDraw(&sContext, "/", -1, i32X + (ui32FontWidth * 4), i32Y, 0); + GrStringDraw(&sContext, "/", -1, i32X + (ui32FontWidth * 7), i32Y, 0); + + // + // Compute the X and Y starting point for the row that will show the + // time. + // + i32X = sRect.i16XMin + (i32Width - (ui32FontWidth * 5)) / 2; + i32Y = sRect.i16YMin + ((i32Height * 3) / 6) - (ui32FontHeight / 2); + + // + // Draw the time field separators on the time row. + // + GrStringDraw(&sContext, ":", -1, i32X + (ui32FontWidth * 2), i32Y, 0); + + // + // Process each of the fields to be shown on the widget + // + for(ui32Idx = 0; ui32Idx < NUM_FIELDS; ui32Idx++) + { + // + // Compute the X and Y for the text for each field, and print the + // text into a buffer. + // + switch(ui32Idx) + { + // + // Year + // + case FIELD_YEAR: + { + usnprintf(pcBuf, sizeof(pcBuf), "%4u", psTime->tm_year+1900); + i32X = sRect.i16XMin + (i32Width - (ui32FontWidth * 10)) / 2; + i32Y = sRect.i16YMin + ((i32Height * 1) / 6) - + (ui32FontHeight / 2); + ui32SelWidth = 4; + break; + } + + // + // Month + // + case FIELD_MONTH: + { + usnprintf(pcBuf, sizeof(pcBuf), "%02u", psTime->tm_mon + 1); + i32X += ui32FontWidth * 5; + ui32SelWidth = 2; + break; + } + + // + // Day + // + case FIELD_DAY: + { + usnprintf(pcBuf, sizeof(pcBuf), "%02u", psTime->tm_mday); + i32X += ui32FontWidth * 3; + ui32SelWidth = 2; + break; + } + + // + // Hour + // + case FIELD_HOUR: + { + usnprintf(pcBuf, sizeof(pcBuf), "%02u", psTime->tm_hour); + i32X = sRect.i16XMin + (i32Width - (ui32FontWidth * 5)) / 2; + i32Y = sRect.i16YMin + ((i32Height * 3) / 6) - + (ui32FontHeight / 2); + ui32SelWidth = 2; + break; + } + + // + // Minute + // + case FIELD_MINUTE: + { + usnprintf(pcBuf, sizeof(pcBuf), "%02u", psTime->tm_min); + i32X += ui32FontWidth * 3; + ui32SelWidth = 2; + break; + } + + // + // OK + // + case FIELD_OK: + { + usnprintf(pcBuf, sizeof(pcBuf), "OK"); + i32X = (i32Width - (ui32FontWidth * 9)) / 2; + i32X += sRect.i16XMin; + i32Y = ((i32Height * 5) / 6) - (ui32FontHeight / 2); + i32Y += sRect.i16YMin; + ui32SelWidth = 2; + break; + } + + // + // CANCEL (default case is purely to keep the compiler from + // issuing a warning that ui32SelWidth may be used ininitialized). + // + case FIELD_CANCEL: + default: + { + usnprintf(pcBuf, sizeof(pcBuf), "CANCEL"); + i32X += ui32FontWidth * 3; + ui32SelWidth = 6; + break; + } + } + + + // + // If the current field index is the highlighted field, then this + // text field will be drawn with highlighting. + // + if(ui32Idx == psClockWidget->ui32Highlight) + { + // + // Compute a rectangle for the highlight area. + // + sRectSel.i16XMin = i32X; + sRectSel.i16XMax = (ui32SelWidth * ui32FontWidth) + i32X; + sRectSel.i16YMin = i32Y - 2; + sRectSel.i16YMax = ui32FontHeight + i32Y + 2; + + // + // Set the foreground color to the text color, and then fill the + // highlight rectangle. The text field will be highlighted by + // inverting the normal colors. + // Then draw the highlighting rectangle. + // + GrContextForegroundSet(&sContext, + psClockWidget->ui32ForegroundColor); + GrRectFill(&sContext, &sRectSel); + + // + // Change the foreground color to the normal background color. + // This will be used for drawing the text for the highlighted + // field, which has the colors inverted (FG <--> BG) + // + GrContextForegroundSet(&sContext, + psClockWidget->ui32BackgroundColor); + } + else + { + // + // This text field is not highlighted so just set the normal + // foreground color. + // + GrContextForegroundSet(&sContext, + psClockWidget->ui32ForegroundColor); + } + + // + // Print the text from the buffer to the display at the computed + // location. + // + GrStringDraw(&sContext, pcBuf, -1, i32X, i32Y, 0); + } +} + +//***************************************************************************** +// +//! Determine the number of days in a month. +//! +//! \param tm_mon is the month number to use for determining the number of +//! days. The month begins with 0 meaning January and 11 meaning December. +//! +//! This function returns the highest day number for the specified month. +//! It does not account for leap year, so February always returns 28 days. +//! +//! \return Returns the highest day number for the month. +// +//***************************************************************************** +static uint8_t +MaxDayOfMonth(uint8_t tm_mon) +{ + // + // Process the month + // + switch(tm_mon) + { + // + // February returns 28 days + // + case 1: + { + return(28); + } + + // + // April, June, September and November return 30 + // + case 3: + case 5: + case 8: + case 10: + { + return(30); + } + + // + // Remaining months have 31 days. + // + default: + { + return(31); + } + } +} + +//***************************************************************************** +// +//! Handle the UP button event. +//! +//! \param psWidget is a pointer to the clock setting widget on which to +//! operate. +//! +//! This function handles the event when the user has pressed the up button. +//! It will increment the currently highlighted date/time field if it is not +//! already at the maximum value. If the month or day of the month is being +//! changed then it enforces the maximum number of days for the month. +//! +//! \return Returns non-zero if the button event was handled, and 0 if the +//! button event was not handled. +// +//***************************************************************************** +static int32_t +ClockSetKeyUp(tClockSetWidget *psWidget) +{ + // + // Get pointer to the time structure to be modified. + // + struct tm *psTime = psWidget->psTime; + + // + // Determine which field is highlighted. + // + switch(psWidget->ui32Highlight) + { + // + // Increment the year. Cap it at 2037 to keep things simple. + // + case FIELD_YEAR: + { + if(psTime->tm_year+1900 < 2037) + { + psTime->tm_year++; + } + break; + } + + // + // Increment the month. Adjust the day of the month if needed. + // + case FIELD_MONTH: + { + if(psTime->tm_mon < 11) + { + psTime->tm_mon++; + } + if(psTime->tm_mday > MaxDayOfMonth(psTime->tm_mon)) + { + psTime->tm_mday = MaxDayOfMonth(psTime->tm_mon); + } + break; + } + + // + // Increment the day. Cap it at the max number of days for the + // current value of month. + // + case FIELD_DAY: + { + if(psTime->tm_mday < MaxDayOfMonth(psTime->tm_mon)) + { + psTime->tm_mday++; + } + break; + } + + // + // Increment the hour. + // + case FIELD_HOUR: + { + if(psTime->tm_hour < 23) + { + psTime->tm_hour++; + } + break; + } + + // + // Increment the minute. + // + case FIELD_MINUTE: + { + if(psTime->tm_min < 59) + { + psTime->tm_min++; + } + break; + } + + // + // Bad value for field index - ignore. + // + default: + { + break; + } + } + + // + // Since something may have been changed in the clock value, request + // a repaint of the widget. + // + WidgetPaint(&psWidget->sBase); + + // + // Return indication that the button event was handled. + // + return(1); +} + +//***************************************************************************** +// +//! Handle the DOWN button event. +//! +//! \param psWidget is a pointer to the clock setting widget on which to +//! operate. +//! +//! This function handles the event when the user has pressed the down button. +//! It will decrement the currently highlighted date/time field if it is not +//! already at the minimum value. If the month is being changed then it +//! enforces the maximum number of days for the month. +//! +//! \return Returns non-zero if the button event was handled, and 0 if the +//! button event was not handled. +// +//***************************************************************************** +static int32_t +ClockSetKeyDown(tClockSetWidget *psWidget) +{ + // + // Get pointer to the time structure to be modified. + // + struct tm *psTime = psWidget->psTime; + + // + // Determine which field is highlighted. + // + switch(psWidget->ui32Highlight) + { + // + // Decrement the year. Minimum year is 1970. + // + case FIELD_YEAR: + { + if(psTime->tm_year+1900 > 1970) + { + psTime->tm_year--; + } + break; + } + + // + // Decrement the month. If the month has changed, check that the + // day is valid for this month, and enforce the maximum day number + // for this month. + // + case FIELD_MONTH: + { + if(psTime->tm_mon > 0) + { + psTime->tm_mon--; + } + if(psTime->tm_mday > MaxDayOfMonth(psTime->tm_mon)) + { + psTime->tm_mday = MaxDayOfMonth(psTime->tm_mon); + } + break; + } + + // + // Decrement the day + // + case FIELD_DAY: + { + if(psTime->tm_mday > 1) + { + psTime->tm_mday--; + } + break; + } + + // + // Decrement the hour + // + case FIELD_HOUR: + { + if(psTime->tm_hour > 0) + { + psTime->tm_hour--; + } + break; + } + + // + // Decrement the minute + // + case FIELD_MINUTE: + { + if(psTime->tm_min > 0) + { + psTime->tm_min--; + } + break; + } + + // + // Bad value for field index - ignore. + // + default: + { + break; + } + } + + // + // Since something may have been changed in the clock value, request + // a repaint of the widget. + // + WidgetPaint(&psWidget->sBase); + + // + // Return indication that the button event was handled. + // + return(1); +} + +//***************************************************************************** +// +//! Handle the LEFT button event. +//! +//! \param psWidget is a pointer to the clock setting widget on which to +//! operate. +//! +//! This function handles the event when the user has pressed the left button. +//! It will change the highlighted field to the previous field. If it is +//! at the first field in the display, it will wrap around to the last. +//! +//! \return Returns non-zero if the button event was handled, and 0 if the +//! button event was not handled. +// +//***************************************************************************** +static int32_t +ClockSetKeyLeft(tClockSetWidget *psWidget) +{ + // + // If not already at the minimum, decrement the highlighted field index. + // + if(psWidget->ui32Highlight) + { + psWidget->ui32Highlight--; + } + else + { + // + // Already at the first field, so reset to the last field. + // + psWidget->ui32Highlight = FIELD_LAST; + } + + // + // The highlighted field changed, so request a repaint of the widget. + // + WidgetPaint(&psWidget->sBase); + + // + // Return indication that the button event was handled. + // + return(1); +} + +//***************************************************************************** +// +//! Handle the RIGHT button event. +//! +//! \param psWidget is a pointer to the clock setting widget on which to +//! operate. +//! +//! This function handles the event when the user has pressed the right button. +//! It will change the highlighted field to the next field. If it is already +//! at the last field in the display, it will wrap around to the first. +//! +//! \return Returns non-zero if the button event was handled, and 0 if the +//! button event was not handled. +// +//***************************************************************************** +static int32_t +ClockSetKeyRight(tClockSetWidget *psWidget) +{ + // + // If not already at the last field, increment the highlighted field index. + // + if(psWidget->ui32Highlight < FIELD_LAST) + { + psWidget->ui32Highlight++; + } + else + { + // + // Already at the last field, so reset to the first field. + // + psWidget->ui32Highlight = 0; + } + + // + // The highlighted field changed, so request a repaint of the widget. + // + WidgetPaint(&psWidget->sBase); + + // + // Return indication that the button event was handled. + // + return(1); +} + +//***************************************************************************** +// +//! Handle the select button event. +//! +//! \param psWidget is a pointer to the clock setting widget on which to +//! operate. +//! +//! This function handles the event when the user has pressed the select +//! button. If either the OK or CANCEL fields is highlighted, then the +//! function will call the callback function to notify the application that +//! an action has been taken and the widget should be dismissed. +//! +//! \return Returns non-zero if the button event was handled, and 0 if the +//! button event was not handled. +// +//***************************************************************************** +static int32_t +ClockSetKeySelect(tClockSetWidget *psWidget) +{ + bool bOk; + + // + // Determine if the OK text field is highlighted and set a flag. + // + bOk = (psWidget->ui32Highlight == FIELD_OK) ? true : false; + + // + // If there is a callback function installed, and either the OK or CANCEL + // fields is highlighted, then take action. + // + if(psWidget->pfnOnOkClick && ((psWidget->ui32Highlight == FIELD_OK) || + (psWidget->ui32Highlight == FIELD_CANCEL))) + { + // + // Call the callback function and pass the flag to indicate if OK + // was selected (otherwise it was CANCEL). + // + psWidget->pfnOnOkClick(&psWidget->sBase, bOk); + + // + // Set the default highlighted field. This is the field that will + // be highlighted the next time this widget is activated. + // + psWidget->ui32Highlight = FIELD_CANCEL; + + // + // Return to caller, indicating the button event was handled. + // + return(1); + } + else + { + // + // There is no callback function, or neither the OK or CANCEL fields is + // highlighted. In this case ingore the button event. + // + return(0); + } +} + +//***************************************************************************** +// +//! Dispatch button events destined for this widget. +//! +//! \param psWidget is a pointer to the clock setting widget on which to +//! operate. +//! \param ui32Msg is the widget message to process. +//! +//! This function receives button/key event messages that are meant for +//! this widget. It then calls the appropriate function to handle the +//! button event. +//! +//! \return Returns non-zero if the button event was handled, and 0 if the +//! button event was not handled. +// +//***************************************************************************** +static int32_t +ClockSetKeyHandler(tWidget *psWidget, uint32_t ui32Msg) +{ + tClockSetWidget *psClockWidget; + + ASSERT(psWidget); + + // + // Get pointer to the clock setting widget. + // + psClockWidget = (tClockSetWidget *)psWidget; + + // + // Process the key event + // + switch(ui32Msg) + { + // + // Select key + // + case WIDGET_MSG_KEY_SELECT: + { + return(ClockSetKeySelect(psClockWidget)); + } + + // + // Up button + // + case WIDGET_MSG_KEY_UP: + { + return(ClockSetKeyUp(psClockWidget)); + } + + // + // Down button + // + case WIDGET_MSG_KEY_DOWN: + { + return(ClockSetKeyDown(psClockWidget)); + } + + // + // Left button + // + case WIDGET_MSG_KEY_LEFT: + { + return(ClockSetKeyLeft(psClockWidget)); + } + + // + // Right button + // + case WIDGET_MSG_KEY_RIGHT: + { + return(ClockSetKeyRight(psClockWidget)); + } + + // + // This is an unexpected event. Return an indication that the event + // was not handled. + // + default: + { + return(0); + } + } +} + +//***************************************************************************** +// +//! Handles messages for a clock setting widget. +//! +//! \param psWidget is a pointer to the clock set widget. +//! \param ui32Msg is the message. +//! \param ui32Param1 is the first parameter to the message. +//! \param ui32Param2 is the second parameter to the message. +//! +//! This function receives messages intended for this clock set widget and +//! processes them accordingly. The processing of the message varies based on +//! the message in question. +//! +//! Unrecognized messages are handled by calling WidgetDefaultMsgProc(). +//! +//! \return Returns a value appropriate to the supplied message. +// +//***************************************************************************** +int32_t +ClockSetMsgProc(tWidget *psWidget, uint32_t ui32Msg, uint32_t ui32Param1, + uint32_t ui32Param2) +{ + // + // Check the arguments. + // + ASSERT(psWidget); + + // + // Determine which message is being sent. + // + switch(ui32Msg) + { + // + // The widget paint request has been sent. + // + case WIDGET_MSG_PAINT: + { + // + // Handle the widget paint request. + // + ClockSetPaint(psWidget); + + // + // Return one to indicate that the message was successfully + // processed. + // + return(1); + } + + // + // Process any button/key event messages. + // + case WIDGET_MSG_KEY_SELECT: + case WIDGET_MSG_KEY_UP: + case WIDGET_MSG_KEY_DOWN: + case WIDGET_MSG_KEY_LEFT: + case WIDGET_MSG_KEY_RIGHT: + { + // + // If the key event is for this widget, then process the key event + // + if((tWidget *)ui32Param1 == psWidget) + { + return(ClockSetKeyHandler(psWidget, ui32Msg)); + } + } + + // + // An unknown request has been sent. + // + default: + { + // + // Let the default message handler process this message. + // + return(WidgetDefaultMsgProc(psWidget, ui32Msg, ui32Param1, + ui32Param2)); + } + } +} + +//***************************************************************************** +// +//! Initializes a clock setting widget. +//! +//! \param psWidget is a pointer to the clock set widget to initialize. +//! \param psDisplay is a pointer to the display on which to draw the widget. +//! \param i32X is the X coordinate of the upper left corner of the widget. +//! \param i32Y is the Y coordinate of the upper left corner of the widget. +//! \param i32Width is the width of the widget. +//! \param i32Height is the height of the widget. +//! \param psFont is the font to use for drawing text on the widget. +//! \param ui32ForegroundColor is the color of the text and lines on the +//! widget. +//! \param ui32BackgroundColor is the color of the widget background. +//! \param psTime is a pointer to the time structure to use for clock fields. +//! \param pfnOnOkClick is a callback function that is called when the user +//! selects the OK field on the display. +//! +//! This function initializes the caller provided clock setting widget. +//! +//! \return None. +// +//***************************************************************************** +void +ClockSetInit(tClockSetWidget *psWidget, const tDisplay *psDisplay, + int32_t i32X, int32_t i32Y, int32_t i32Width, int32_t i32Height, + tFont *psFont, uint32_t ui32ForegroundColor, + uint32_t ui32BackgroundColor, struct tm *psTime, + void (*pfnOnOkClick)(tWidget *psWidget, bool bOk)) +{ + uint32_t ui32Idx; + + // + // Check the arguments. + // + ASSERT(psWidget); + ASSERT(psDisplay); + + // + // Clear out the widget structure. + // + for(ui32Idx = 0; ui32Idx < sizeof(tClockSetWidget); ui32Idx += 4) + { + ((uint32_t *)psWidget)[ui32Idx / 4] = 0; + } + + // + // Set the size of the widget structure. + // + psWidget->sBase.i32Size = sizeof(tClockSetWidget); + + // + // Mark this widget as fully disconnected. + // + psWidget->sBase.psParent = 0; + psWidget->sBase.psNext = 0; + psWidget->sBase.psChild = 0; + + // + // Save the display pointer. + // + psWidget->sBase.psDisplay = psDisplay; + + // + // Set the extents of the display area. + // + psWidget->sBase.sPosition.i16XMin = i32X; + psWidget->sBase.sPosition.i16YMin = i32Y; + psWidget->sBase.sPosition.i16XMax = i32X + i32Width - 1; + psWidget->sBase.sPosition.i16YMax = i32Y + i32Height - 1; + + // + // Initialize the widget fields + // + psWidget->psFont = psFont; + psWidget->ui32ForegroundColor = ui32ForegroundColor; + psWidget->ui32BackgroundColor = ui32BackgroundColor; + psWidget->psTime = psTime; + psWidget->pfnOnOkClick = pfnOnOkClick; + + // + // Use the clock set message handler to process messages to this widget. + // + psWidget->sBase.pfnMsgProc = ClockSetMsgProc; +} + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** + diff --git a/boards/ek-lm4f232/qs-logger/clocksetwidget.h b/boards/ek-lm4f232/qs-logger/clocksetwidget.h new file mode 100644 index 0000000..56134df --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/clocksetwidget.h @@ -0,0 +1,273 @@ +//***************************************************************************** +// +// clocksetwidget.h - Prototypes for a widget to set a clock date/time. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __CLOCKSETWIDGET_H__ +#define __CLOCKSETWIDGET_H__ + +//***************************************************************************** +// +//! \addtogroup clocksetwidget_api +//! @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +//! A structure that represents a clock setting widget. +// +//***************************************************************************** +typedef struct _ClockSetWidget +{ + // + //! The generic widget information. + // + tWidget sBase; + + // + //! The font to use for drawing text on the widget. + // + const tFont *psFont; + + // + //! The foreground color of the widget. This is the color that will be + //! used for drawing text and lines, and will also be used as the highlight + //! color for a selected field on the widget. + // + uint32_t ui32ForegroundColor; + + // + //! The background color of the widget. + // + uint32_t ui32BackgroundColor; + + // + //! An index for the date/time field that is highlighted + // + uint32_t ui32Highlight; + + // + //! A pointer to a time structure that is used for showing and editing + //! the date and time. The application should supply the storage for this + //! structure, and this widget will modify it as the user changes the + //! date/time. + // + struct tm *psTime; + + // + //! A pointer to the function to be called when the OK or cancel button is + //! selected. The OK button is used to indicate the user is done setting + //! the time. The CANCEL button is used to indicate that the user does + //! not want to update the time. The flag bOk is true if the OK button + //! was selected, false otherwise. The callback function can be used by + //! the application to detect when the clock setting widget can be removed + //! from the screen and whether or not to update the time. + // + void (*pfnOnOkClick)(tWidget *psWidget, bool bOk); +} tClockSetWidget; + +//***************************************************************************** +// +//! Declares an initialized strip chart widget data structure. +//! +//! \param psParent is a pointer to the parent widget. +//! \param psNext is a pointer to the sibling widget. +//! \param psChild is a pointer to the first child widget. +//! \param psDisplay is a pointer to the off-screen display on which to draw. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param psFont is the font used for rendering text on the widget. +//! \param ui32ForegroundColor is the foreground color for the widget. +//! \param ui32BackgroundColor is the background color for the chart. +//! \param psTime is a pointer to storage for the time structure that the +//! widget will modify. +//! \param pfnOnOkClick is a callback function that is called when the user +//! selects the OK or CANCEL button on the widget. +//! +//! This macro provides an initialized clock setting widget data structure, +//! which can be used to construct the widget tree at compile time in global +//! variables (as opposed to run-time via function calls). This must be +//! assigned to a variable, such as: +//! +//! \verbatim +//! tClockSetWidget g_sClockSetter = ClockSetStruct(...); +//! \endverbatim +//! +//! Or, in an array of variables: +//! +//! \verbatim +//! tClockSetWidget g_psClockSetters[] = +//! { +//! ClockSetStruct(...), +//! ClockSetStruct(...) +//! }; +//! \endverbatim +//! +//! \return Nothing; this is not a function. +// +//***************************************************************************** +#define ClockSetStruct(psParent, psNext, psChild, psDisplay, i32X, i32Y, \ + i32Width, i32Height, psFont, ui32ForegroundColor, \ + ui32BackgroundColor, psTime, pfnOnOkClick) \ + { \ + { \ + sizeof(tClockSetWidget), \ + (tWidget *)(psParent), \ + (tWidget *)(psNext), \ + (tWidget *)(psChild), \ + psDisplay, \ + { \ + i32X, \ + i32Y, \ + (i32X) + (i32Width) - 1, \ + (i32Y) + (i32Height) - 1 \ + }, \ + ClockSetMsgProc \ + }, \ + psFont, ui32ForegroundColor, ui32BackgroundColor, 6, psTime, \ + pfnOnOkClick \ + } + +//***************************************************************************** +// +//! Declares an initialized variable containing a clock setting widget data +//! structure. +//! +//! \param sName is the name of the variable to be declared. +//! \param psParent is a pointer to the parent widget. +//! \param psNext is a pointer to the sibling widget. +//! \param psChild is a pointer to the first child widget. +//! \param psDisplay is a pointer to the off-screen display on which to draw. +//! \param i32X is the X coordinate of the upper left corner of the canvas. +//! \param i32Y is the Y coordinate of the upper left corner of the canvas. +//! \param i32Width is the width of the canvas. +//! \param i32Height is the height of the canvas. +//! \param psFont is the font used for rendering text on the widget. +//! \param ui32ForegroundColor is the foreground color for the widget. +//! \param ui32BackgroundColor is the background color for the chart. +//! \param psTime is a pointer to storage for the time structure that the +//! widget will modify. +//! \param pfnOnOkClick is a callback function that is called when the user +//! selects the OK or CANCEL button on the widget. +//! +//! This macro declares a variable containing an initialized clock setting +//! widget data structure, which can be used to construct the widget tree at +//! compile time in global variables (as opposed to run-time via function +//! calls). +//! +//! \return Nothing; this is not a function. +// +//***************************************************************************** +#define ClockSet(sName, psParent, psNext, psChild, psDisplay, i32X, i32Y, \ + i32Width, i32Height, psFont, ui32ForegroundColor, \ + ui32BackgroundColor, psTime, pfnOnOkClick) \ + tClockSetWidget sName = ClockSetStruct(psParent, psNext, psChild, \ + psDisplay, i32X, i32Y, \ + i32Width, i32Height, psFont, \ + ui32ForegroundColor, \ + ui32BackgroundColor, psTime, \ + pfnOnOkClick) + +//***************************************************************************** +// +//! Sets the pointer to the time structure for the clock set widget. +//! +//! \param psClockSetWidget is a pointer to the clock set widget to modify. +//! \param psTime is a pointer to the a time structure to use for clock +//! setting. +//! +//! This function sets the time structure used by the widget. +//! +//! \return None. +// +//***************************************************************************** +#define ClockSetTimePtrSet(psClockSetWidget, psTime) \ + do \ + { \ + (pClockSetWidget)->psTime = (psTime); \ + } \ + while(0) + +//***************************************************************************** +// +//! Sets the callback function to be used when OK or CANCEL is selected. +//! +//! \param pClockSetWidget is a pointer to the clock set widget to modify. +//! \param pfnCB is a pointer to function to call when OK is selected by the +//! user. +//! +//! This function sets the OK click callback function used by the widget. +//! +//! \return None. +// +//***************************************************************************** +#define ClockSetCallbackSet(pClockSetWidget, pfnCB) \ + do \ + { \ + (pClockSetWidget)->pfnOnOkClick = (pfnCB); \ + } while(0) + +//***************************************************************************** +// +// Prototypes for the clock set widget APIs. +// +//***************************************************************************** +extern void ClockSetInit(tClockSetWidget *psWidget, const tDisplay *psDisplay, + int32_t i32X, int32_t i32Y, int32_t i32Width, + int32_t i32Height, tFont *psFont, + uint32_t ui32ForegroundColor, + uint32_t ui32BackgroundColor, struct tm *psTime, + void (*pfnOnOkClick)(tWidget *psWidget, bool bOk)); +extern int32_t ClockSetMsgProc(tWidget *psWidget, uint32_t ui32Msg, + uint32_t ui32Param1, uint32_t ui32Param2); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +//***************************************************************************** +// +// Close the Doxygen group. +//! @} +// +//***************************************************************************** + +#endif // __CLOCKSETWIDGET_H__ diff --git a/boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.bin b/boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.bin new file mode 100644 index 0000000..d7e5596 Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.bin differ diff --git a/boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.out b/boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.out new file mode 100644 index 0000000..20ce755 Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/ewarm/Exe/qs-logger.out differ diff --git a/boards/ek-lm4f232/qs-logger/flashstore.c b/boards/ek-lm4f232/qs-logger/flashstore.c new file mode 100644 index 0000000..30cbcea --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/flashstore.c @@ -0,0 +1,625 @@ +//***************************************************************************** +// +// flashstore.c - Data logger module to handle storage in flash. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/flash.h" +#include "utils/ustdlib.h" +#include "qs-logger.h" +#include "usbstick.h" +#include "flashstore.h" + +//***************************************************************************** +// +// This module manages the storage of data logger data into flash memory. +// +//***************************************************************************** + +//***************************************************************************** +// +// Define the beginning and end of the flash storage area. You must make sure +// that this area is well clear of any space occupied by the application +// binary, and that this space is not used for any other purpose. +// The start and end addresses must be 1K aligned. The end address is +// exclusive - it is 1 value greater than the last valid location used for +// storage. +// +//***************************************************************************** +#define FLASH_STORE_START_ADDR 0x20000 +#define FLASH_STORE_END_ADDR 0x40000 + +//***************************************************************************** +// +// The next address in flash, that will be used for storing a data record. +// +//***************************************************************************** +static uint32_t g_ui32StoreAddr; + +//***************************************************************************** +// +// A buffer used to assemble a complete record of data prior to storing it +// in the flash. +// +//***************************************************************************** +static uint32_t g_pui32RecordBuf[32]; + +//***************************************************************************** +// +// Initializes the flash storage. This is a stub because there is nothing +// special to do. +// +//***************************************************************************** +void +FlashStoreInit(void) +{ +} + +//***************************************************************************** +// +// Saves data records that are stored in the flash to an externally connected +// USB memory storage device (USB stick). +// The flash memory is scanned for the presence of store data records. When +// records are found they are written in CSV format to the USB stick. This +// function assumes a non-corrupted storage area, and that any records, once +// found, are contiguous with all stored records. It will find the oldest +// record and start with that when storing. +// +//***************************************************************************** +int32_t +FlashStoreSave(void) +{ + uint32_t ui32Addr, ui32OldestRecord, ui32OldestSeconds, ui32Count, + ui32PartialCount; + tLogRecord *psRecord; + + // + // Initialize locals. + // + ui32OldestRecord = FLASH_STORE_START_ADDR; + ui32OldestSeconds = 0xFFFFFFFF; + + // + // Show a message to the user. + // + SetStatusText("SAVE", "SCANNING", "FLASH", 0); + + // + // Start at beginning of flash storage area + // + ui32Addr = FLASH_STORE_START_ADDR; + + // + // Search all of flash area checking every stored record. + // + while(ui32Addr < FLASH_STORE_END_ADDR) + { + // + // If a record signature is found, check for oldest record, then + // increment to the next record + // + if((HWREG(ui32Addr) & 0xFFFFFF00) == 0x53554100) + { + // + // Get a pointer to the data record (account for flash header word) + // + psRecord = (tLogRecord *)(ui32Addr + 4); + + // + // If the seconds in this record are older than any found so far + // then save the seconds value, and the address of this record + // + if(psRecord->ui32Seconds < ui32OldestSeconds) + { + ui32OldestSeconds = psRecord->ui32Seconds; + ui32OldestRecord = ui32Addr; + } + + // + // Advance the address to the next record. + // + ui32Addr += HWREG(ui32Addr) & 0xFF; + } + else + { + // + // A record was not found so just advance to the next location in + // flash + // + ui32Addr += 4; + } + } + + // + // If no "oldest" seconds was found, then there is no valid data stored + // + if(ui32OldestSeconds == 0xFFFFFFFF) + { + SetStatusText("SAVE", "NO RECORDS", "FOUND", "PRESS <"); + return(1); + } + + // + // Open the output file on the USB stick. It will return NULL if there + // was any problem. + // + if(!USBStickOpenLogFile(0)) + { + SetStatusText("SAVE", 0, "USB ERROR", "PRESS <"); + return(1); + } + + // + // Notify user we are saving data to USB + // + SetStatusText("SAVE", "SAVING", "TO USB", 0); + + // + // Start reading records from flash, start at the address of the oldest + // record, as found above. We scan through records, assuming the flash + // store is not corrupted. Continue scanning until a blank space is + // found which should indicate the end of recorded data, or until we + // have read all the records. + // + ui32Addr = ui32OldestRecord; + while(HWREG(ui32Addr) != 0xFFFFFFFF) + { + // + // If a record signature is found (which it should be), extract the + // record data and send it to USB stick. + // + if((HWREG(ui32Addr) & 0xFFFFFF00) == 0x53554100) + { + // + // Get byte count for this record + // + ui32Count = HWREG(ui32Addr) & 0xFF; + + // + // Adjust the count and the address to remove the flash header + // + ui32Count -= 4; + ui32Addr += 4; + + // + // Adjust for memory wrap + // + if(ui32Addr >= FLASH_STORE_END_ADDR) + { + ui32Addr = FLASH_STORE_START_ADDR; + } + + // + // If the contents of this record go past the end of the memory + // storage area, then perform a partial copy first. + // + ui32PartialCount = 0; + if((ui32Addr + ui32Count) >= FLASH_STORE_END_ADDR) + { + // + // Find how many bytes are left on this page + // + ui32PartialCount = FLASH_STORE_END_ADDR - ui32Addr; + + // + // Copy the portion until the end of memory store, adjust + // remaining count and address + // + memcpy(g_pui32RecordBuf, (void *)ui32Addr, ui32PartialCount); + ui32Count -= ui32PartialCount; + ui32Addr = FLASH_STORE_START_ADDR; + } + + // + // Copy entire record (or remaining part of record if memory wrap) + // into record buffer + // + memcpy(&g_pui32RecordBuf[ui32PartialCount / 4], (void *)ui32Addr, + ui32Count); + + // + // Update address pointer to next record + // + ui32Addr += ui32Count; + + // + // Now we have an entire data logger record copied from flash + // storage into a local (contiguous) memory buffer. Pass it + // to the USB file writing function to write the record to the + // USB stick. + // + USBStickWriteRecord((tLogRecord *)g_pui32RecordBuf); + } + else + { + // + // This should not happen, but it means we ended up in a non-blank + // location that is not the start of a record. In this case just + // advance through memory until either a blank location or another + // record is found. + // + // Increment to next word in flash, adjust for memory wrap. + // + ui32Addr += 4; + if(ui32Addr >= FLASH_STORE_END_ADDR) + { + ui32Addr = FLASH_STORE_START_ADDR; + } + } + } + + // + // Close the USB stick file so that any buffers will be flushed. + // + USBStickCloseFile(); + + // + // Inform user that save is complete. + // + SetStatusText("SAVE", "USB SAVE", "COMPLETE", "PRESS <"); + + // + // Return success + // + return(0); +} + +//***************************************************************************** +// +// This is called at the start of logging to prepare space in flash for +// storage of logged data. It searches for the first blank area in the +// flash storage to be used for storing records. +// +// If a starting address is specified then the search is skipped and it goes +// directly to the new address. If the starting address is 0, then it performs +// the search. +// +//***************************************************************************** +int32_t +FlashStoreOpenLogFile(uint32_t ui32StartAddr) +{ + uint32_t ui32Addr; + + // + // If a valid starting address is specified, then just use that and skip + // the search below. + // + if((ui32StartAddr >= FLASH_STORE_START_ADDR) && + (ui32StartAddr < FLASH_STORE_END_ADDR)) + { + g_ui32StoreAddr = ui32StartAddr; + return(0); + } + + // + // Start at beginning of flash storage area + // + ui32Addr = FLASH_STORE_START_ADDR; + + // + // Search until a blank is found or the end of flash storage area + // + while((HWREG(ui32Addr) != 0xFFFFFFFF) && (ui32Addr < FLASH_STORE_END_ADDR)) + { + // + // If a record signature is found, then increment to the next record + // + if((HWREG(ui32Addr) & 0xFFFFFF00) == 0x53554100) + { + ui32Addr += HWREG(ui32Addr) & 0xFF; + } + else + { + // + // Just advance to the next location in flash + // + ui32Addr += 4; + } + } + + // + // If we are at the end of flash that means no blank area was found. + // So reset to the beginning and erase the first page. + // + if(ui32Addr >= FLASH_STORE_END_ADDR) + { + ui32Addr = FLASH_STORE_START_ADDR; + FlashErase(ui32Addr); + } + + // + // When we reach here we either found a blank location, or made a new + // blank location by erasing the first page. + // To keep things simple we are making an assumption that the flash store + // is not corrupted and that the first blank location implies the start + // of a blank area suitable for storing data records. + // + g_ui32StoreAddr = ui32Addr; + + // + // Return success indication to caller + // + return(0); +} + +//***************************************************************************** +// +// This is called each time there is a new data record to log to the flash +// storage area. A simple algorithm is used which rotates programming +// data log records through an area of flash. It is assumed that the current +// page is blank. Records are stored on the current page until a page +// boundary is crossed. If the page boundary is crossed and the new page +// is not blank (testing only the first location), then the new page is +// erased. Finally the entire record is programmed into flash and the +// storage pointers are updated. +// +// While storing and when crossing to a new page, if the flash page is not +// blank it is erased. So this algorithm overwrites old data. +// +// The data is stored in flash as a record, with a flash header prepended, +// and with the record length padded to be a multiple of 4 bytes. The flash +// header is a 3-byte magic number and one byte of record length. +// +//***************************************************************************** +int32_t +FlashStoreWriteRecord(tLogRecord *psRecord) +{ + uint32_t ui32Idx, ui32ItemCount, *pui32Record; + + // + // Check the arguments + // + ASSERT(psRecord); + if(!psRecord) + { + return(1); + } + + // + // Determine how many channels are to be logged + // + ui32Idx = psRecord->ui16ItemMask; + ui32ItemCount = 0; + while(ui32Idx) + { + if(ui32Idx & 1) + { + ui32ItemCount++; + } + ui32Idx >>= 1; + } + + // + // Add 16-bit count equivalent of record header, time stamp, and + // selected items mask. This is the total number of 16 bit words + // of the record. + // + ui32ItemCount += 6; + + // + // Convert the count to bytes, be sure to pad to 32-bit alignment. + // + ui32ItemCount = ((ui32ItemCount * 2) + 3) & ~3; + + // + // Create the flash record header, which is a 3-byte signature and a + // one byte count of bytes in the record. Save it at the beginning + // of the write buffer. + // + ui32Idx = 0x53554100 | (ui32ItemCount & 0xFF); + g_pui32RecordBuf[0] = ui32Idx; + + // + // Copy the rest of the record to the buffer, and get a pointer to + // the buffer. + // + memcpy(&g_pui32RecordBuf[1], psRecord, ui32ItemCount - 4); + pui32Record = g_pui32RecordBuf; + + // + // Check to see if the record is going to cross a page boundary. + // + if(((g_ui32StoreAddr & 0x3FF) + ui32ItemCount) > 0x3FF) + { + // + // Find number of bytes remaining on this page + // + ui32Idx = 0x400 - (g_ui32StoreAddr & 0x3FF); + + // + // Program part of the record on the space remaining on the current + // page + // + FlashProgram(pui32Record, g_ui32StoreAddr, ui32Idx); + + // + // Increment the store address by the amount just written, which + // should make the new store address be at the beginning of the next + // flash page. + // + g_ui32StoreAddr += ui32Idx; + + // + // Adjust the remaining bytes to program, and the pointer to the + // remainder of the record data. + // + ui32ItemCount -= ui32Idx; + pui32Record = &g_pui32RecordBuf[ui32Idx / 4]; + + // + // Check to see if the new page is past the end of store and adjust + // + if(g_ui32StoreAddr >= FLASH_STORE_END_ADDR) + { + g_ui32StoreAddr = FLASH_STORE_START_ADDR; + } + + // + // If new page is not blank, then erase it + // + if(HWREG(g_ui32StoreAddr) != 0xFFFFFFFF) + { + FlashErase(g_ui32StoreAddr); + } + } + + // + // Now program the remaining part of the record (if we crossed a page + // boundary above) or the full record to the current location in flash + // + FlashProgram(pui32Record, g_ui32StoreAddr, ui32ItemCount); + + // + // Increment the storage address to the next location. + // + g_ui32StoreAddr += ui32ItemCount; + + // + // Return success indication to caller. + // + return(0); +} + +//***************************************************************************** +// +// Return the current address being used for storing records. +// +//***************************************************************************** +uint32_t +FlashStoreGetAddr(void) +{ + return(g_ui32StoreAddr); +} + +//***************************************************************************** +// +// Erase the data storage area of flash. +// +//***************************************************************************** +void +FlashStoreErase(void) +{ + uint32_t ui32Addr; + + // + // Inform user we are erasing + // + SetStatusText("ERASE", 0, "ERASING", 0); + + // + // Loop through entire storage area and erase each page. + // + for(ui32Addr = FLASH_STORE_START_ADDR; ui32Addr < FLASH_STORE_END_ADDR; + ui32Addr += 0x400) + { + FlashErase(ui32Addr); + } + + // + // Inform user the erase is done. + // + SetStatusText("SAVE", "ERASE", "COMPLETE", "PRESS <"); +} + +//***************************************************************************** +// +// Determine if the flash block that contains the address is blank. +// +//***************************************************************************** +static int32_t +IsBlockFree(uint32_t ui32BaseAddr) +{ + uint32_t ui32Addr; + + // + // Make sure we start at the beginning of a 1K block + // + ui32BaseAddr &= ~0x3FF; + + // + // Loop through every address in this block and test if it is blank. + // + for(ui32Addr = 0; ui32Addr < 0x400; ui32Addr += 4) + { + if(HWREG(ui32BaseAddr + ui32Addr) != 0xFFFFFFFF) + { + // + // Found a non-blank location, so return indication that block + // is not free. + // + return(0); + } + } + + // + // If we made it to here then every location in this block is erased, + // so return indication that the block is free. + // + return(1); +} + +//***************************************************************************** +// +// Report to the user the amount of free space and used space in the data +// storage area. +// +//***************************************************************************** +void +FlashStoreReport(void) +{ + uint32_t ui32Addr, ui32FreeBlocks, ui32UsedBlocks = 0; + static char pcBufFree[16], pcBufUsed[16]; + + // + // Initialize locals. + // + ui32FreeBlocks = 0; + ui32UsedBlocks = 0; + + // + // Loop through each block of the storage area and count how many blocks + // are free and non-free. + // + for(ui32Addr = FLASH_STORE_START_ADDR; ui32Addr < FLASH_STORE_END_ADDR; + ui32Addr += 0x400) + { + if(IsBlockFree(ui32Addr)) + { + ui32FreeBlocks++; + } + else + { + ui32UsedBlocks++; + } + } + + // + // Report the result to the user via a status display screen. + // + usnprintf(pcBufFree, sizeof(pcBufFree), "FREE: %3uK", ui32FreeBlocks); + usnprintf(pcBufUsed, sizeof(pcBufUsed), "USED: %3uK", ui32UsedBlocks); + SetStatusText("FREE FLASH", pcBufFree, pcBufUsed, "PRESS <"); +} diff --git a/boards/ek-lm4f232/qs-logger/flashstore.h b/boards/ek-lm4f232/qs-logger/flashstore.h new file mode 100644 index 0000000..7b50538 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/flashstore.h @@ -0,0 +1,60 @@ +//***************************************************************************** +// +// flashstore.h - Prototypes and definitions for flash storage module. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** +#ifndef __FLASHSTORE_H__ +#define __FLASHSTORE_H__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Module function prototypes. +// +//***************************************************************************** +extern void FlashStoreInit(void); +extern int32_t FlashStoreOpenLogFile(uint32_t ui32StartAddr); +extern int32_t FlashStoreWriteRecord(tLogRecord *psRecord); +extern int32_t FlashStoreSave(void); +extern void FlashStoreErase(void); +extern void FlashStoreReport(void); +extern uint32_t FlashStoreGetAddr(void); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif // __FLASHSTORE_H__ diff --git a/boards/ek-lm4f232/qs-logger/gcc/qs-logger.axf b/boards/ek-lm4f232/qs-logger/gcc/qs-logger.axf new file mode 100644 index 0000000..ecbf290 Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/gcc/qs-logger.axf differ diff --git a/boards/ek-lm4f232/qs-logger/gcc/qs-logger.bin b/boards/ek-lm4f232/qs-logger/gcc/qs-logger.bin new file mode 100644 index 0000000..cf196f3 Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/gcc/qs-logger.bin differ diff --git a/boards/ek-lm4f232/qs-logger/images.c b/boards/ek-lm4f232/qs-logger/images.c new file mode 100644 index 0000000..ae59b95 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/images.c @@ -0,0 +1,865 @@ +//***************************************************************************** +// +// images.c - Data for images used in the user interface. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "grlib/grlib.h" + +//***************************************************************************** +// +// This image contains the TI logo with black background. +// +//***************************************************************************** +const uint8_t g_pui8Image_TI_Black[] = +{ + IMAGE_FMT_4BPP_COMP, + 96, 0, + 64, 0, + + 15, + 0x00, 0x00, 0x00, + 0x11, 0x11, 0x15, + 0x0d, 0x0a, 0x55, + 0x2d, 0x2d, 0x2d, + 0x18, 0x13, 0xa1, + 0x4c, 0x4c, 0x4c, + 0x23, 0x1c, 0xea, + 0x6b, 0x6b, 0x6b, + 0x87, 0x87, 0x87, + 0x9b, 0x9b, 0x9b, + 0xa8, 0xa8, 0xa8, + 0xb9, 0xb9, 0xb9, + 0xc8, 0xc8, 0xc8, + 0xd7, 0xd7, 0xd7, + 0xe6, 0xe6, 0xe6, + 0xfe, 0xfe, 0xfe, + + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x8f, 0x03, 0x44, 0x44, 0x20, 0x07, + 0x07, 0x77, 0x2f, 0x83, 0x07, 0x66, 0x66, 0x20, 0x02, 0x10, 0x07, 0x07, + 0xe0, 0x77, 0x2f, 0x05, 0x66, 0x66, 0x20, 0x26, 0x20, 0xf8, 0x07, 0x07, + 0x77, 0x2f, 0x05, 0x66, 0x66, 0x20, 0x2f, 0x24, 0x10, 0x03, 0x01, 0x07, + 0x07, 0x77, 0x2f, 0x00, 0x00, 0x66, 0x66, 0x62, 0x24, 0x14, 0x44, 0x20, + 0x07, 0x00, 0x7d, 0xbc, 0xcb, 0xc1, 0x07, 0x07, 0x77, 0x80, 0x2f, 0x66, + 0x66, 0x62, 0x64, 0x26, 0x66, 0x40, 0x00, 0x00, 0x75, 0x3f, 0xc3, 0x85, + 0x33, 0x01, 0x31, 0x01, 0x00, 0x31, 0x00, 0x10, 0x00, 0x05, 0x10, 0x07, + 0xc0, 0xbf, 0x76, 0x66, 0x66, 0x22, 0x64, 0x14, 0x66, 0x00, 0x20, 0x00, + 0x00, 0x0f, 0x90, 0x7e, 0xaa, 0x95, 0x00, 0xfd, 0x08, 0xe3, 0x0a, 0xf1, + 0x03, 0xba, 0xc8, 0xe0, 0x07, 0xbf, 0x73, 0x22, 0x22, 0x22, 0x66, 0x62, + 0x00, 0x02, 0x62, 0x02, 0x66, 0x40, 0x00, 0x00, 0x0f, 0x00, 0x90, 0x8f, + 0x00, 0x50, 0x7f, 0x5a, 0x30, 0x3c, 0x0e, 0xf9, 0x0c, 0xf0, 0x05, 0x05, + 0xcd, 0x97, 0x46, 0x00, 0x66, 0x66, 0x66, 0x64, 0x12, 0x62, 0x24, 0x66, + 0x00, 0x62, 0x00, 0x00, 0x0f, 0x90, 0x7f, 0x8a, 0x70, 0x00, 0x0a, 0xf3, + 0x00, 0x85, 0x5f, 0x05, 0xff, 0xb3, 0xe0, 0x05, 0xcd, 0x97, 0x02, 0x66, + 0x66, 0x66, 0x66, 0x00, 0x24, 0x62, 0x66, 0x66, 0x64, 0x00, 0x00, 0x0f, + 0x00, 0x90, 0x8f, 0x57, 0x30, 0x08, 0xf9, 0x00, 0xd8, 0x07, 0x8f, 0x50, + 0x18, 0xdf, 0x30, 0x04, 0xd4, 0xa7, 0x00, 0x00, 0x00, 0x26, 0x66, 0x66, + 0x66, 0x26, 0x42, 0x00, 0x66, 0x66, 0x64, 0x00, 0x00, 0x0f, 0xa0, 0x8f, + 0x00, 0x00, 0x31, 0x88, 0x3f, 0x73, 0xc7, 0x7e, 0xc7, 0x1c, 0x50, 0x1f, + 0x50, 0x05, 0xcd, 0x97, 0x04, 0x66, 0x00, 0x66, 0x66, 0x26, 0x22, 0x66, + 0x66, 0x64, 0x00, 0x00, 0x00, 0x3d, 0x90, 0x8e, 0xaa, 0xb7, 0xd3, 0x0c, + 0x03, 0xdc, 0x80, 0x09, 0xe9, 0xca, 0xc8, 0x06, 0xc6, 0x80, 0x86, 0x02, + 0x66, 0x22, 0x66, 0x00, 0x00, 0x26, 0x00, 0x64, 0x21, 0x00, 0x00, 0x31, + 0x31, 0x10, 0x33, 0x00, 0x01, 0x10, 0x00, 0x11, 0x00, 0x00, 0x10, 0x03, + 0x70, 0x10, 0x06, 0xc6, 0x87, 0x22, 0x00, 0x46, 0x10, 0x13, 0x00, 0x46, + 0x20, 0x01, 0x3d, 0xa1, 0x07, 0x07, 0xc0, 0x77, 0x2f, 0x00, 0x00, 0x06, + 0x66, 0x66, 0x62, 0x80, 0x02, 0x0f, 0x90, 0x30, 0x01, 0x31, 0x03, 0x51, + 0x00, 0x03, 0x51, 0x53, 0x13, 0x35, 0x00, 0x33, 0x30, 0x00, 0x13, 0x33, + 0x10, 0x00, 0x03, 0x33, 0x15, 0x51, 0x00, 0x13, 0x00, 0x13, 0x13, 0x31, + 0x53, 0x01, 0x53, 0x18, 0x00, 0x00, 0x00, 0xe9, 0xd1, 0x04, 0x66, 0x66, + 0x40, 0x20, 0x9a, 0x0f, 0x81, 0xfd, 0x00, 0xe7, 0x7b, 0x00, 0xab, 0x8a, + 0xbf, 0xa9, 0x7f, 0xba, 0xe5, 0x5f, 0x00, 0x70, 0x3e, 0x39, 0xf3, 0x00, + 0xef, 0x3a, 0xf9, 0x08, 0xb8, 0x5f, 0xb0, 0x1d, 0x69, 0x5b, 0x9c, 0x93, + 0x10, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x01, 0x66, 0x40, 0x66, 0xab, + 0x0f, 0x90, 0xaf, 0xc0, 0x87, 0xf7, 0x00, 0x01, 0x50, 0x3f, 0x01, 0x5f, + 0x30, 0xef, 0x1f, 0x00, 0x30, 0x0b, 0x07, 0xfc, 0x05, 0xfe, 0x09, 0xf0, + 0x00, 0x03, 0x3c, 0xf8, 0x09, 0x70, 0x5f, 0x01, 0xee, 0x06, 0x00, 0x33, + 0x00, 0x00, 0x00, 0xe9, 0xd1, 0x26, 0x20, 0x66, 0x20, 0xa2, 0x0f, 0x90, + 0x95, 0xf9, 0x85, 0x00, 0x8f, 0xf8, 0x00, 0x5f, 0x10, 0x1f, 0x97, 0xc7, + 0x00, 0x1f, 0x30, 0x0b, 0x17, 0xaf, 0x37, 0xbe, 0x08, 0x00, 0xf8, 0xb3, + 0x08, 0x5f, 0x89, 0x10, 0x7f, 0x00, 0x03, 0x3f, 0xfc, 0x30, 0x00, 0x00, + 0x00, 0xe9, 0xd1, 0x10, 0x02, 0x44, 0x20, 0xa2, 0x0f, 0x90, 0xb0, 0x3f, + 0x00, 0xf3, 0x03, 0x8f, 0xc0, 0x5f, 0x10, 0x3f, 0x8b, 0x00, 0xe0, 0x1f, + 0x30, 0x0b, 0x18, 0x5a, 0xf5, 0x5f, 0x00, 0x08, 0xe3, 0x51, 0x1b, 0x07, + 0xfd, 0x00, 0x7f, 0x01, 0x10, 0x00, 0x7b, 0xfb, 0x00, 0x00, 0x00, 0xe9, + 0xc0, 0xd4, 0xa2, 0x0f, 0xa0, 0xc3, 0x07, 0xf7, 0x81, 0x00, 0x0c, 0xe0, + 0x5f, 0x10, 0x3f, 0x10, 0xfb, 0x0f, 0x00, 0x80, 0x5e, 0x09, 0x53, 0xf0, + 0x7f, 0x0a, 0xf0, 0x00, 0x05, 0x7b, 0x00, 0x9f, 0x10, 0x7f, 0x00, 0x87, + 0x07, 0x03, 0xfd, 0x00, 0x00, 0x00, 0xe9, 0xd4, 0xa2, 0x00, 0x3d, 0x93, + 0xc5, 0x00, 0x75, 0x8b, 0xab, 0x30, 0x00, 0x7e, 0x50, 0x5e, 0x70, 0x5f, + 0x75, 0xc9, 0xb5, 0x00, 0x0c, 0x70, 0x70, 0x9d, 0x38, 0xd9, 0xa9, 0x7c, + 0x00, 0x30, 0x08, 0x30, 0x8e, 0x50, 0x5c, 0xac, 0x73, 0x1f, 0x00, 0x00, + 0x00, 0xe9, 0xd4, 0xa7, 0x5f, 0x17, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xc0, 0x07, 0x07, +}; + +//***************************************************************************** +// +// This image contains a splash screen image. +// +//***************************************************************************** +const uint8_t g_pui8Image_Splash1[] = +{ + IMAGE_FMT_4BPP_COMP, + 96, 0, + 64, 0, + + 15, + 0x00, 0x00, 0x00, + 0x28, 0x28, 0x28, + 0x41, 0x41, 0x41, + 0x55, 0x55, 0x55, + 0x67, 0x67, 0x67, + 0x77, 0x77, 0x77, + 0x86, 0x86, 0x86, + 0x96, 0x96, 0x96, + 0xa7, 0xa7, 0xa7, + 0xb7, 0xb7, 0xb7, + 0xc6, 0xc6, 0xc6, + 0xd8, 0xd8, 0xd8, + 0xe6, 0xe6, 0xe6, + 0xf0, 0xf0, 0xf0, + 0xf9, 0xf9, 0xf9, + 0xff, 0xff, 0xff, + + 0x1f, 0xff, 0xff, 0xff, 0xe9, 0xd4, 0xa7, 0x5f, 0x17, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xdf, 0x07, 0x06, 0x76, 0x07, 0x07, + 0x77, 0x2f, 0x07, 0x0f, 0xff, 0xff, 0x20, 0x5f, 0x07, 0x07, 0x77, 0x2f, + 0x8f, 0x07, 0xff, 0x36, 0x05, 0x07, 0x07, 0x77, 0x2f, 0x87, 0x07, 0xff, + 0x27, 0xe0, 0x9f, 0x07, 0x07, 0x77, 0xc4, 0x2f, 0x07, 0x26, 0xf6, 0x1f, + 0x03, 0xf8, 0x5f, 0xe8, 0x07, 0x07, 0x77, 0xcd, 0x27, 0xff, 0x36, 0xff, + 0x4e, 0x15, 0x03, 0x70, 0x1c, 0x07, 0x1f, 0x3b, 0xfe, 0x00, 0x42, 0x24, + 0x42, 0x22, 0x35, 0x45, 0xbf, 0xea, 0x00, 0x88, 0x99, 0xab, 0xcf, 0xff, + 0xff, 0x35, 0xff, 0x47, 0x81, 0x02, 0xb2, 0x29, 0x3d, 0x05, 0xcd, 0x97, + 0x00, 0x50, 0x3a, 0xb0, 0x1a, 0xfb, 0x02, 0x63, 0x01, 0x00, 0x11, 0x22, + 0x21, 0x21, 0x11, 0x24, 0x8f, 0x63, 0x00, 0xff, 0xf1, 0x7f, 0xff, 0xff, + 0xf9, 0x06, 0xf9, 0x70, 0x2f, 0x05, 0xcd, 0x96, 0x90, 0x41, 0x7f, 0xf1, + 0x00, 0x8f, 0xf7, 0x1f, 0xff, 0x62, 0xaf, 0xff, 0xff, 0x00, 0xee, 0xc9, + 0x53, 0x22, 0x11, 0xff, 0xf3, 0x3f, 0x8e, 0x51, 0x9f, 0xf6, 0x2f, 0x04, + 0xd4, 0xa6, 0xfa, 0x00, 0x52, 0x08, 0xf5, 0x2f, 0xf1, 0x6f, 0xf3, 0x2f, + 0x40, 0xeb, 0x15, 0xfd, 0x60, 0xaf, 0xf6, 0x1f, 0xff, 0x07, 0xff, 0x16, + 0xff, 0xf2, 0x5f, 0x75, 0x3d, 0x03, 0x00, 0xc5, 0x12, 0x63, 0x1f, 0xf9, + 0x1f, 0xf2, 0x5f, 0x10, 0xf2, 0x4f, 0x63, 0x16, 0xf5, 0x2f, 0xfa, 0x1d, + 0x03, 0xff, 0xf7, 0x1f, 0xff, 0x91, 0xdf, 0x76, 0x36, 0x00, 0xff, 0xff, + 0xb3, 0x12, 0x9f, 0xfd, 0x19, 0xfc, 0x02, 0x1b, 0xf3, 0x4f, 0xf1, 0x6f, + 0x18, 0x17, 0x18, 0x01, 0xff, 0x11, 0x7f, 0xf1, 0x5f, 0xff, 0x15, 0x7f, + 0x80, 0x37, 0xb2, 0x04, 0xcf, 0xff, 0xff, 0x34, 0xff, 0x02, 0x19, 0xf4, + 0x4f, 0xf1, 0xab, 0x1f, 0x0f, 0x71, 0x03, 0xff, 0x32, 0x32, 0x81, 0xef, + 0xf2, 0x7f, 0x3f, 0x10, 0xf4, 0x04, 0xdf, 0x0b, 0x25, 0xf5, 0x3f, 0xe1, + 0x20, 0xc6, 0x3f, 0x0f, 0xf2, 0x4f, 0x62, 0xf9, 0x06, 0x31, 0xfd, 0x12, + 0x87, 0x3e, 0xfb, 0x01, 0xcf, 0x02, 0x00, 0xd1, 0xbf, 0x53, 0xf7, 0x2f, + 0xb1, 0xe3, 0x6f, 0x80, 0x07, 0xfc, 0x0b, 0xf1, 0x14, 0x1f, 0xe0, 0x4f, + 0xc8, 0x87, 0x3e, 0x90, 0x5f, 0x03, 0xf2, 0x5f, 0x92, 0x04, 0xfa, 0x2f, + 0xa2, 0xd1, 0xaf, 0x07, 0xff, 0x43, 0x0c, 0xfb, 0x67, 0xef, 0x15, 0x8f, + 0x46, 0xfb, 0x07, 0x80, 0x04, 0xf5, 0x3f, 0xd1, 0xcd, 0x1f, 0xa2, 0xb1, + 0x50, 0xdf, 0x01, 0xee, 0x04, 0x81, 0xff, 0xff, 0xfd, 0x72, 0x1a, 0x1c, + 0x7c, 0x4b, 0xf0, 0x5f, 0x14, 0xfb, 0x02, 0x1d, 0xf2, 0x7f, 0x1d, 0x93, + 0xa1, 0x02, 0x5a, 0xa7, 0x04, 0x16, 0x01, 0x70, 0xdf, 0x14, 0x74, 0x1a, + 0x40, 0x32, 0x7e, 0x26, 0xf3, 0x4f, 0x1a, 0x94, 0x91, 0xa4, 0x0a, 0xce, + 0x03, 0xf4, 0x2f, 0x01, 0xf1, 0x3f, 0xc8, 0x0e, 0xc5, 0xf9, 0x0c, 0x7e, + 0x52, 0xf6, 0x2f, 0x11, 0x28, 0x85, 0x72, 0x0f, 0xff, 0xc1, 0xaf, 0x01, + 0x32, 0xfe, 0x08, 0x7f, 0x34, 0xf2, 0x3f, 0x06, 0xb1, 0x04, 0xfb, 0x1f, + 0x45, 0x85, 0x72, 0x0d, 0x87, 0xff, 0x2c, 0xff, 0x52, 0x03, 0x61, 0x0e, + 0x3d, 0xc1, 0xbf, 0x81, 0x7e, 0xf2, 0x8f, 0x2d, 0x84, 0x86, 0x72, 0x0d, + 0x04, 0xaa, 0xff, 0xff, 0x22, 0xef, 0x02, 0xf1, 0x4f, 0xd0, 0x06, 0x34, + 0x41, 0x8f, 0xf5, 0x3f, 0x38, 0xa3, 0x24, 0x66, 0x72, 0x12, 0xf7, 0xaf, + 0x01, 0xf9, 0x12, 0x4d, 0xcf, 0x02, 0xf8, 0x1f, 0x06, 0xc4, 0x15, 0x8c, + 0x00, 0xfe, 0xbe, 0xff, 0xfa, 0x1f, 0x55, 0xc3, 0x56, 0x01, 0x82, 0xff, + 0xf7, 0x8f, 0xff, 0xf6, 0xaf, 0x01, 0x00, 0xf3, 0x04, 0xdf, 0xff, 0xff, + 0xfb, 0xbf, 0xff, 0x60, 0x57, 0x03, 0xda, 0xb7, 0xcf, 0xff, 0xff, 0xfe, + 0x40, 0x19, 0x8c, 0xfc, 0x6e, 0xff, 0xff, 0x1b, 0xa2, 0x06, 0xd4, 0x46, + 0x82, 0xff, 0xfb, 0x51, 0x02, 0xf2, 0x00, 0x33, 0xbf, 0xff, 0xff, 0x51, + 0x5c, 0xff, 0x93, 0xc0, 0x8c, 0x59, 0x60, 0x2f, 0xff, 0xff, 0xfc, 0x1a, + 0x90, 0x12, 0xfd, 0x6d, 0x5a, 0x36, 0xf2, 0xb4, 0x37, 0x40, 0xa1, 0x17, + 0xf3, 0x44, 0x9f, 0xff, 0xff, 0x6a, 0x08, 0xff, 0xff, 0xf2, 0xbf, 0x6e, + 0xb1, 0x05, 0xff, 0x00, 0xff, 0xfc, 0x1b, 0xff, 0xff, 0x76, 0xff, 0xfd, + 0x41, 0x9e, 0x62, 0x73, 0xf2, 0x95, 0x36, 0xb1, 0x1e, 0x00, 0xff, 0xf7, + 0x13, 0x5f, 0xff, 0xff, 0xf4, 0x0a, 0x10, 0xff, 0xf3, 0x8f, 0x6e, 0xf3, + 0x22, 0xbf, 0xff, 0x04, 0xfc, 0x1b, 0xff, 0xff, 0xaa, 0x7d, 0xc2, 0xf3, + 0x00, 0x76, 0x35, 0xd1, 0xdf, 0xff, 0xfa, 0xcf, 0xff, 0x00, 0xff, 0xf8, + 0xbf, 0xff, 0xfa, 0x11, 0x0e, 0xff, 0x02, 0xff, 0xf2, 0x03, 0x9f, 0xf3, + 0x6f, 0x0d, 0xff, 0x02, 0xf6, 0x10, 0x6f, 0xff, 0xfd, 0x19, 0x96, 0xc5, + 0x00, 0xef, 0xf1, 0xb6, 0x57, 0x35, 0xf1, 0xbf, 0xff, 0x00, 0xf6, 0xaf, + 0xff, 0xff, 0xf7, 0xbf, 0xff, 0xfc, 0x00, 0x00, 0x02, 0xef, 0xff, 0x78, + 0x91, 0x7f, 0xf5, 0x40, 0x4f, 0x04, 0xff, 0xff, 0xfb, 0x15, 0x2f, 0xff, + 0x20, 0xff, 0x16, 0x91, 0xfc, 0xef, 0xff, 0xfc, 0xbf, 0x00, 0xc8, 0xff, + 0xf3, 0x79, 0x56, 0x34, 0xf1, 0x9f, 0x80, 0x16, 0xfd, 0x13, 0x10, 0x08, + 0xff, 0x72, 0x47, 0x10, 0xff, 0xf8, 0x3f, 0x76, 0xff, 0x26, 0x1b, 0xff, + 0x20, 0xff, 0x43, 0x01, 0xa4, 0xff, 0xff, 0xf8, 0x6f, 0x00, 0xff, 0xff, + 0xf5, 0x4c, 0x45, 0x44, 0xf2, 0x7f, 0x80, 0x14, 0xda, 0xef, 0xfb, 0x2f, + 0x60, 0x00, 0x2d, 0x06, 0xfd, 0xcf, 0xff, 0xfb, 0x3e, 0x74, 0x41, 0x15, + 0x00, 0x17, 0xff, 0xff, 0x91, 0xff, 0xfb, 0xbf, 0xdd, 0x10, 0xff, 0xff, + 0xfe, 0x59, 0xf8, 0x2c, 0x55, 0x43, 0x20, 0xb6, 0x4f, 0x12, 0xfb, 0xdf, + 0xd8, 0xef, 0xf9, 0x05, 0x3b, 0x1b, 0x23, 0x50, 0x9f, 0x49, 0x39, 0x72, + 0x80, 0x52, 0xff, 0x17, 0x15, 0xff, 0xff, 0xf2, 0x4f, 0x20, 0xf7, 0x8f, + 0x7c, 0xc9, 0xfb, 0x2b, 0x43, 0x55, 0x24, 0x89, 0x2f, 0x12, 0xf6, 0xbf, + 0xe1, 0x10, 0x6f, 0x16, 0x35, 0xf8, 0x09, 0x29, 0x44, 0x0c, 0x41, 0x25, + 0x04, 0x33, 0xff, 0xff, 0xfb, 0x0a, 0x8e, 0xa5, 0xff, 0x04, 0x2a, 0x43, + 0x66, 0x4f, 0x1b, 0x16, 0xf2, 0x07, 0x00, 0xf8, 0x0f, 0xff, 0x80, 0xaf, + 0xff, 0xff, 0xa1, 0x8c, 0x76, 0xff, 0x29, 0x61, 0x19, 0x69, 0xb4, 0xff, + 0x00, 0xf7, 0x6f, 0xf8, 0x8f, 0xff, 0xff, 0x44, 0x43, 0x10, 0x26, 0x26, + 0x24, 0x16, 0x10, 0xff, 0xb0, 0x8f, 0x01, 0xff, 0xf6, 0x0f, 0xff, 0xff, + 0xf3, 0x5f, 0x6e, 0x00, 0x50, 0x41, 0xbf, 0xff, 0xff, 0xf8, 0x0a, 0xff, + 0x00, 0xc8, 0xff, 0xfb, 0xbf, 0xf8, 0x8f, 0xff, 0xff, 0x01, 0x23, 0xdd, + 0xab, 0xb7, 0xe1, 0x07, 0xcf, 0x0b, 0x08, 0xb0, 0x26, 0x4b, 0x04, 0xb9, + 0x23, 0xff, 0xff, 0x31, 0xfb, 0x0b, 0x7b, 0x51, 0x81, 0xf1, 0x1f, 0x21, + 0x20, 0xc0, 0x6f, 0x85, 0xf1, 0x2f, 0xff, 0xff, 0xd8, 0x00, 0x23, 0x84, + 0x22, 0x34, 0x6a, 0xcb, 0xb9, 0x63, 0x0a, 0x16, 0xff, 0x40, 0xaf, 0x19, + 0xb0, 0xd9, 0x51, 0x84, 0x05, 0xff, 0xf2, 0x26, 0x12, 0x69, 0x81, 0x01, + 0x80, 0x3a, 0xff, 0xff, 0xf9, 0x00, 0x46, 0x44, 0x33, 0x00, 0x33, 0x7f, + 0xff, 0xd8, 0x53, 0x41, 0x01, 0x00, 0x04, 0x00, 0xbf, 0xff, 0xf5, 0x3f, + 0x19, 0xf5, 0x1f, 0x0c, 0xff, 0xff, 0xf1, 0x5f, 0x03, 0x9a, 0xf2, 0x03, + 0x00, 0x89, 0x51, 0x0f, 0xa0, 0x00, 0x4b, 0xff, 0xff, 0x01, 0xfc, 0x94, + 0x00, 0x9f, 0x97, 0x78, 0x9c, 0x33, 0x00, 0xf2, 0x35, 0xc5, 0x25, 0x0c, + 0xff, 0xff, 0x13, 0x83, 0x9a, 0x11, 0xff, 0xff, 0xfa, 0x1a, 0x53, 0x29, + 0x00, 0x22, 0xf4, 0x4b, 0x20, 0xa9, 0x3c, 0x40, 0x00, 0x02, 0x52, 0x01, + 0x22, 0x10, 0x00, 0x03, 0x56, 0xff, 0x00, 0x33, 0xcb, 0xf8, 0x1f, 0x41, + 0xff, 0xff, 0xe1, 0x41, 0xaf, 0x71, 0xf1, 0x1c, 0xff, 0xff, 0x44, 0x36, + 0x00, 0xf2, 0x10, 0x8f, 0x63, 0xf3, 0x00, 0x02, 0x08, 0x01, 0xff, 0x81, + 0x00, 0x00, 0x02, 0xc0, 0x4f, 0x4d, 0x00, 0xfa, 0x0b, 0x8c, 0xf6, 0x2f, + 0xf1, 0x6f, 0xff, 0x21, 0xf5, 0x3f, 0x7a, 0x40, 0x36, 0xab, 0x14, 0x3d, + 0x00, 0xff, 0xff, 0x93, 0x00, 0x00, 0x00, 0x02, 0x8b, 0x00, 0x2c, 0xfe, + 0xd6, 0x03, 0x90, 0x1c, 0xa9, 0x12, 0x20, 0x88, 0xdf, 0x3c, 0x24, 0xff, + 0xf6, 0x1f, 0xf3, 0x08, 0x0b, 0xff, 0xfa, 0x1f, 0x8a, 0xfd, 0x74, 0x33, + 0x60, 0x5f, 0x4c, 0x1a, 0xc7, 0x44, 0x59, 0xef, 0xf3, 0x00, 0x3f, 0xf4, + 0x04, 0x9f, 0xf0, 0x2b, 0xef, 0xc2, 0x10, 0x32, 0x13, 0xcf, 0x33, 0x61, + 0xff, 0xff, 0x34, 0x07, 0xdf, 0x24, 0xff, 0x65, 0x4a, 0x93, 0x6b, 0xb7, + 0x00, 0xff, 0xff, 0xfb, 0x31, 0xdf, 0xf2, 0x4f, 0xff, 0x01, 0xfa, 0x20, + 0x8f, 0xff, 0xfc, 0x20, 0x2f, 0x03, 0x00, 0xd0, 0x7f, 0xed, 0x74, 0x1a, + 0x83, 0x54, 0x70, 0x70, 0x3b, 0x03, 0x6b, 0xb7, 0xff, 0xfa, 0x13, 0x2a, + 0x00, 0xff, 0xf1, 0x9f, 0xff, 0xff, 0xc3, 0x1a, 0xff, 0x10, 0x90, 0x12, + 0x06, 0x6c, 0x0b, 0x44, 0x23, 0x30, 0x0e, 0x36, 0x22, 0x50, 0x0c, 0x93, + 0x6b, 0xb7, 0xff, 0x04, 0xf4, 0x0b, 0xff, 0xff, 0x51, 0x3a, 0x80, 0x6f, + 0x10, 0xb2, 0x02, 0xbb, 0x04, 0x61, 0x80, 0x11, 0xae, 0x0e, 0x70, 0x21, + 0x15, 0x8f, 0x94, 0x64, 0xa5, 0xfc, 0x04, 0x10, 0x12, 0xb5, 0xa9, 0x0a, + 0x3a, 0xfb, 0x22, 0x20, 0x35, 0x59, 0x05, 0xf5, 0x03, 0x53, 0xef, 0xa1, + 0x38, 0x91, 0x5f, 0x95, 0x5d, 0x24, 0xfa, 0x12, 0x00, 0x12, 0x10, 0x20, + 0x9f, 0x33, 0xf8, 0x7f, 0x06, 0xfe, 0x78, 0x9d, 0xda, 0x96, 0x56, 0x15, + 0x66, 0x82, 0x3c, 0xff, 0x37, 0x07, 0x77, 0x2f, 0x07, 0x07, 0x07, 0x07, + 0xc0, 0x07, 0x07, +}; + +const uint8_t g_pui8Image_Splash2[] = +{ + IMAGE_FMT_4BPP_COMP, + 96, 0, + 64, 0, + + 15, + 0x00, 0x00, 0x00, + 0x28, 0x28, 0x28, + 0x42, 0x42, 0x42, + 0x55, 0x55, 0x55, + 0x65, 0x65, 0x65, + 0x78, 0x78, 0x78, + 0x86, 0x86, 0x86, + 0x96, 0x96, 0x96, + 0xa6, 0xa6, 0xa6, + 0xbb, 0xbb, 0xbb, + 0xcf, 0xcf, 0xcf, + 0xe0, 0xe0, 0xe0, + 0xea, 0xea, 0xea, + 0xf2, 0xf2, 0xf2, + 0xf9, 0xf9, 0xf9, + 0xff, 0xff, 0xff, + + 0x1f, 0xff, 0xff, 0xff, 0xe9, 0xd4, 0xa7, 0x5f, 0x17, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xfe, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0xff, 0x1f, 0xff, 0xa5, 0xdf, 0x07, 0x07, 0x77, 0x2f, 0x07, + 0x17, 0xff, 0x60, 0x8f, 0x03, 0xbb, 0x07, 0x07, 0x77, 0xcb, 0x2f, 0x02, + 0x52, 0x27, 0x03, 0x21, 0x07, 0x07, 0xe2, 0x77, 0x2f, 0x02, 0x54, 0xf1, + 0x7f, 0x01, 0xf8, 0x3e, 0x03, 0xef, 0x07, 0x07, 0x77, 0x2f, 0x01, 0x62, + 0x23, 0xfa, 0x1b, 0x01, 0xe1, 0x85, 0xaf, 0x07, 0x07, 0x80, 0x75, 0xc6, + 0x67, 0xd7, 0x34, 0x77, 0x69, 0xff, 0x08, 0xff, 0xa9, 0xaa, 0xcf, 0x01, + 0x72, 0xff, 0x62, 0x8e, 0x01, 0x24, 0xf3, 0x9f, 0x07, 0xbf, 0x74, 0xa4, + 0x00, 0x14, 0x63, 0x03, 0x88, 0x14, 0x64, 0x47, 0x41, 0x00, 0x23, 0x33, + 0x22, 0x57, 0x9b, 0xff, 0x92, 0xff, 0x01, 0xf2, 0x7f, 0xff, 0xf8, 0x1f, + 0xf3, 0x9f, 0x06, 0xc0, 0xc6, 0x85, 0xb1, 0x21, 0x9f, 0xfd, 0xae, 0xf6, + 0x00, 0x3f, 0xff, 0x30, 0x49, 0xff, 0xff, 0xf9, 0x43, 0x00, 0x33, 0x34, + 0x41, 0xdf, 0xf8, 0x3f, 0xff, 0xf2, 0x1c, 0x7f, 0xd2, 0xbf, 0x05, 0xcd, + 0x96, 0xb8, 0x05, 0x00, 0xf5, 0x5f, 0xf7, 0xbf, 0xf3, 0x5f, 0xf8, 0x1e, + 0x80, 0x85, 0x51, 0x8f, 0xfc, 0x2c, 0xff, 0xb2, 0xef, 0x70, 0x82, 0x05, + 0xcd, 0x95, 0xf9, 0x43, 0x33, 0x7f, 0x00, 0xf7, 0x2f, 0xf1, 0x8f, 0xf2, + 0x8f, 0xf3, 0x8f, 0x80, 0x05, 0xf8, 0x1f, 0xff, 0x29, 0xff, 0x83, 0xff, + 0x70, 0x34, 0x8d, 0x55, 0x1c, 0xf7, 0x23, 0x6a, 0xfd, 0x00, 0x6f, 0xff, + 0x2a, 0xf2, 0x6f, 0xf2, 0x9f, 0xba, 0x80, 0x07, 0x26, 0xff, 0x31, 0xbf, + 0x73, 0xfb, 0x1b, 0xc2, 0x87, 0x3f, 0xff, 0xfb, 0x21, 0x9f, 0x0a, 0x35, + 0x04, 0xf3, 0x4f, 0xf2, 0xaf, 0x2a, 0x07, 0xa1, 0xef, 0x06, 0x61, 0x2a, + 0x73, 0xf3, 0x3f, 0x87, 0x3f, 0xff, 0x20, 0x70, 0x6f, 0x01, 0x53, 0xff, + 0x82, 0xf7, 0x2f, 0x20, 0xf3, 0xd9, 0x07, 0xff, 0xf3, 0x4f, 0x84, 0xf6, + 0x19, 0x08, 0xf1, 0xaf, 0x87, 0x3f, 0xc3, 0x1a, 0x02, 0x00, 0xa1, 0xef, + 0xb1, 0xfa, 0x1f, 0xf2, 0xf5, 0x3f, 0x81, 0x07, 0xfa, 0x2e, 0xf3, 0x57, + 0x1f, 0x73, 0x8f, 0x90, 0x47, 0xfa, 0x05, 0x03, 0xf3, 0x8f, 0xf2, 0x9f, + 0x08, 0x1d, 0xe2, 0xf3, 0x5f, 0x07, 0xff, 0x45, 0xfe, 0x19, 0x78, 0xcf, + 0x46, 0x8f, 0x47, 0x90, 0x9f, 0x03, 0x00, 0xf6, 0x3f, 0xf4, 0x5f, 0x2a, + 0xd3, 0xf3, 0x8f, 0x15, 0xff, 0xff, 0x99, 0x05, 0x92, 0x01, 0x65, 0xa5, + 0xc8, 0x6d, 0x31, 0xfa, 0x09, 0xc5, 0x2d, 0xf7, 0x3f, 0x01, 0x38, 0xd2, + 0xf2, 0x9f, 0xff, 0xff, 0x89, 0x05, 0x4c, 0x52, 0x01, 0xc2, 0xbf, 0x9d, + 0x65, 0xff, 0xff, 0x20, 0xf1, 0x7f, 0x0d, 0x28, 0xfa, 0x2f, 0x47, 0xd3, + 0x42, 0xe2, 0x06, 0xba, 0xff, 0xfa, 0x1c, 0x01, 0xf3, 0x62, 0x3f, 0x15, + 0x4d, 0xff, 0xff, 0x62, 0x7e, 0x64, 0x00, 0xfe, 0x1f, 0x56, 0xd3, 0xd2, + 0xcf, 0xfa, 0x8f, 0x84, 0x03, 0xa7, 0xff, 0xf2, 0x5f, 0x01, 0xfe, 0x19, + 0xc2, 0x0e, 0x53, 0xba, 0xff, 0xff, 0x1a, 0x7e, 0xa2, 0x00, 0xff, 0x2a, + 0x75, 0xd4, 0xc2, 0xcf, 0xfa, 0x8f, 0xac, 0x05, 0x71, 0x3b, 0x52, 0x0e, + 0x53, 0x60, 0xaf, 0x20, 0xf8, 0x3f, 0x7e, 0xf3, 0x7f, 0x47, 0x94, 0xc4, + 0x00, 0xb2, 0xef, 0xff, 0xff, 0xfe, 0xaf, 0xff, 0x97, 0x93, 0x01, 0x30, + 0x7f, 0x32, 0xf2, 0x9f, 0x06, 0x92, 0x08, 0x80, 0x3f, 0xf5, 0x6f, 0x86, + 0xf5, 0x3f, 0x75, 0x10, 0xb2, 0xb4, 0xb2, 0x11, 0xfc, 0x7e, 0xff, 0xcb, + 0x04, 0xff, 0xa9, 0xf8, 0x37, 0x9f, 0x32, 0xf7, 0x1f, 0xc2, 0x06, 0x92, + 0xa0, 0x2f, 0xf3, 0xaf, 0x86, 0xfa, 0x04, 0x2f, 0x94, 0xd3, 0x84, 0xb3, + 0x16, 0xa8, 0xf4, 0x2c, 0x6f, 0xbf, 0x33, 0x18, 0x06, 0x32, 0x91, 0x2e, + 0x40, 0x92, 0x8f, 0xff, 0x7e, 0xb3, 0xd3, 0x66, 0xa3, 0x80, 0x17, 0xf3, + 0xa5, 0x5f, 0xff, 0xff, 0xf8, 0x49, 0x31, 0xff, 0x82, 0x07, 0x29, 0x70, + 0x1f, 0x54, 0x8f, 0x02, 0xff, 0x95, 0xf3, 0xc4, 0x46, 0xb3, 0x17, 0xf4, + 0x00, 0x77, 0x4f, 0xff, 0xff, 0x22, 0x99, 0xff, 0xf2, 0x41, 0x9f, 0x6f, + 0xff, 0xff, 0x41, 0x1f, 0x46, 0x05, 0x00, 0xf7, 0xbf, 0xff, 0xa2, 0xf3, + 0x95, 0x36, 0xf2, 0x40, 0xcf, 0x12, 0xa9, 0xff, 0xff, 0xba, 0xf7, 0x02, + 0x00, 0x4f, 0xff, 0xfb, 0x49, 0x7e, 0xff, 0xf3, 0x6f, 0xc2, 0x03, 0xdb, + 0xff, 0x12, 0x4f, 0x36, 0x01, 0xf9, 0x00, 0xaf, 0xfb, 0x9f, 0xf8, 0xcc, + 0xbf, 0xf2, 0xb5, 0x00, 0x86, 0x45, 0xf3, 0xaf, 0xff, 0xff, 0x8b, 0xff, + 0x00, 0x87, 0xff, 0xff, 0xa7, 0xf9, 0x00, 0x1f, 0xff, 0x00, 0xff, 0xf2, + 0x09, 0xff, 0xf5, 0x3f, 0xff, 0xff, 0x61, 0xff, 0xe9, 0xd2, 0xf9, 0x21, + 0x3f, 0x36, 0xca, 0x00, 0xaf, 0xfb, 0x7f, 0xff, 0xf8, 0x8f, 0xf4, 0x86, + 0x01, 0x88, 0x25, 0xf3, 0x8f, 0xff, 0xff, 0x9b, 0x03, 0x00, 0xfb, 0x00, + 0x04, 0xff, 0xff, 0xfa, 0xa3, 0x6f, 0x30, 0xf8, 0x2f, 0x8b, 0x63, 0xf7, + 0x12, 0x5f, 0x44, 0x80, 0x94, 0xfd, 0xdf, 0xac, 0xff, 0xf6, 0x77, 0x6a, + 0x10, 0x34, 0xf5, 0x6f, 0x16, 0xfd, 0x46, 0x00, 0x1a, 0x02, 0xff, 0x59, + 0xb0, 0xaf, 0xfc, 0x2c, 0x76, 0xff, 0x00, 0xff, 0xf5, 0x10, 0x9f, 0x63, + 0xff, 0xff, 0xd9, 0x00, 0xff, 0xfb, 0xaf, 0xf7, 0x8f, 0x59, 0xff, 0xf9, + 0x00, 0x46, 0x5b, 0x34, 0xd8, 0x5f, 0xff, 0xf8, 0xaf, 0x10, 0xff, 0xff, + 0xbb, 0x01, 0x3d, 0x90, 0x00, 0x4f, 0x07, 0x82, 0x29, 0xff, 0xff, 0x28, + 0xa1, 0x89, 0xd2, 0x00, 0xf5, 0x21, 0x9f, 0xc2, 0xbf, 0xff, 0xd9, 0xff, + 0x00, 0xfa, 0x8f, 0xfe, 0xdf, 0xff, 0xff, 0xfb, 0x46, 0x02, 0x5b, 0x44, + 0x9c, 0x6f, 0xff, 0xfb, 0xa9, 0x98, 0x00, 0xf9, 0x9f, 0xff, 0x2c, 0x42, + 0x32, 0x21, 0xff, 0x0c, 0xff, 0xff, 0xff, 0x35, 0xda, 0xba, 0xff, 0xff, + 0x05, 0xf7, 0x00, 0x7f, 0xf4, 0x4f, 0xbb, 0xaf, 0x32, 0x04, 0x44, 0x5b, + 0x64, 0x5f, 0x3f, 0x14, 0xf8, 0x9f, 0x02, 0xfa, 0x44, 0x1f, 0x73, 0xf2, + 0x1f, 0x19, 0x53, 0xc0, 0x74, 0x42, 0xf7, 0x35, 0x3f, 0xfc, 0x19, 0xff, + 0x00, 0xfe, 0xef, 0xff, 0xfc, 0xcf, 0x99, 0xfb, 0xaf, 0x00, 0xff, 0x34, + 0x8f, 0xf7, 0x2f, 0x27, 0xff, 0xfc, 0x10, 0x8e, 0xff, 0xab, 0x01, 0xf3, + 0x03, 0xbf, 0x17, 0x2e, 0xff, 0x12, 0xb9, 0x91, 0x99, 0x81, 0xd2, 0xfa, + 0x00, 0x22, 0x1f, 0xff, 0x70, 0xcf, 0xf8, 0x9f, 0xff, 0x00, 0xbc, 0xee, + 0xbb, 0xf9, 0x8f, 0xff, 0x88, 0xa7, 0x00, 0x7b, 0x18, 0x72, 0xff, 0xfd, + 0xaf, 0xff, 0x89, 0x80, 0x01, 0x90, 0x13, 0xe6, 0x1f, 0xff, 0xf1, 0x3f, + 0x0e, 0xff, 0xff, 0xf2, 0x9f, 0x91, 0x79, 0x61, 0xfc, 0x00, 0x04, 0x19, + 0xff, 0xf5, 0x0c, 0xfe, 0xef, 0xff, 0x00, 0x9a, 0x99, 0xf9, 0xdf, 0xff, + 0xff, 0x62, 0x45, 0x08, 0x46, 0xa5, 0xc3, 0x0c, 0x14, 0xf5, 0x00, 0x06, + 0x05, 0x50, 0xbf, 0xff, 0xfd, 0x09, 0xb1, 0x3f, 0x74, 0x81, 0x42, 0x38, + 0x90, 0xdf, 0xff, 0x71, 0xef, 0x02, 0x00, 0xe7, 0xbf, 0xff, 0xf7, 0x0c, + 0xff, 0xff, 0xf9, 0x00, 0x23, 0x61, 0x59, 0xbb, 0xce, 0xcd, 0xfe, 0x74, + 0x0a, 0x20, 0x00, 0x00, 0x2f, 0x41, 0x81, 0x19, 0x17, 0xc0, 0x02, 0xe2, + 0xff, 0xff, 0x90, 0x55, 0x0b, 0xff, 0x20, 0x90, 0x07, 0x85, 0x50, 0x35, + 0x43, 0x32, 0x12, 0x00, 0x8f, 0xfd, 0x64, 0x65, 0x54, 0x45, 0x34, 0x34, + 0x00, 0x94, 0x03, 0x69, 0x13, 0x7c, 0xff, 0xff, 0xf2, 0x06, 0x2f, 0xff, + 0xff, 0xa1, 0xcf, 0x04, 0xd1, 0xf1, 0x00, 0x0f, 0x80, 0x51, 0x45, 0x00, + 0x17, 0xbe, 0xef, 0x00, 0xff, 0xfd, 0xa7, 0x61, 0x0c, 0xf8, 0x66, 0x78, + 0x40, 0xdf, 0x2a, 0xfc, 0xff, 0x17, 0xff, 0xf2, 0x3c, 0x04, 0x4a, 0xb5, + 0x32, 0x4a, 0xff, 0xb1, 0xff, 0xf4, 0x60, 0x2f, 0x5a, 0x3a, 0xff, 0xfc, + 0x00, 0x34, 0xc2, 0x00, 0x67, 0x00, 0x00, 0x10, 0x11, 0x22, 0x33, 0x24, + 0x40, 0x23, 0x57, 0xff, 0xff, 0x26, 0xff, 0xf2, 0x01, 0x00, 0xb8, 0xcf, + 0xff, 0x10, 0x9f, 0xff, 0x90, 0xaf, 0x10, 0xff, 0xff, 0x19, 0x37, 0xff, + 0xb0, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x3f, 0x67, + 0x80, 0x1a, 0x43, 0xff, 0xf2, 0x75, 0x15, 0xdf, 0xb8, 0x06, 0x70, 0x0a, + 0xff, 0xf8, 0x08, 0x92, 0x1f, 0xfd, 0x00, 0x52, 0x11, 0x41, 0x00, 0x02, + 0x33, 0xe8, 0xab, 0x40, 0x06, 0x67, 0xff, 0xff, 0xfe, 0xff, 0x71, 0xff, + 0x00, 0xf3, 0x2f, 0xa2, 0x23, 0xa4, 0x31, 0x0b, 0xff, 0x06, 0xff, 0x91, + 0x26, 0xa5, 0x19, 0x27, 0x02, 0xf1, 0x01, 0x04, 0x24, 0x91, 0xff, 0xff, + 0xa0, 0x8f, 0x5f, 0x00, 0xff, 0xfe, 0xff, 0xb1, 0xaf, 0xff, 0x12, 0xcf, + 0x08, 0xf6, 0x13, 0x00, 0x7f, 0x01, 0x93, 0x23, 0xbf, 0xc0, 0x2f, 0x02, + 0x60, 0xbf, 0x38, 0xf2, 0x0d, 0xff, 0x30, 0xf9, 0x09, 0x5f, 0x11, 0xf2, + 0x3f, 0xff, 0xe2, 0x0c, 0x12, 0x9f, 0xb3, 0x5f, 0x67, 0x1f, 0xff, 0xff, + 0x00, 0x14, 0xf8, 0x3f, 0xff, 0x50, 0x8f, 0xff, 0x61, 0x20, 0x11, 0x2a, + 0x17, 0xff, 0xfb, 0x1a, 0xfa, 0x9c, 0x38, 0x44, 0x07, 0x87, 0x3f, 0x01, + 0xf9, 0x1f, 0xf1, 0x00, 0x2f, 0xff, 0xfa, 0x06, 0xff, 0xfc, 0x30, 0x0a, + 0x80, 0x07, 0xff, 0xff, 0x50, 0xae, 0x25, 0x30, 0x19, 0xe0, 0x87, 0x3f, + 0x01, 0xfa, 0x0b, 0xa2, 0x10, 0x9f, 0x02, 0xff, 0x90, 0x9f, 0xf8, 0x12, + 0x05, 0x07, 0xff, 0x03, 0xff, 0xf8, 0x33, 0x30, 0x56, 0xcf, 0x87, 0x3f, + 0x80, 0x02, 0x06, 0xf2, 0x40, 0x1f, 0xff, 0xf7, 0x06, 0x19, 0x3b, 0x90, + 0x2e, 0x07, 0x01, 0xfc, 0x89, 0x97, 0xc0, 0x4f, 0x04, 0x70, 0x96, 0x10, + 0x2f, 0xff, 0xff, 0x0f, 0x60, 0x01, 0x71, 0x5f, 0x07, 0x07, 0x77, 0x2f, + 0x00, 0xff, 0xff, 0xf9, 0x36, 0x42, 0xaf, 0xff, 0xff, 0x1e, 0xfa, 0xce, + 0x89, 0x07, 0x07, 0x77, 0x2f, +}; + +const uint8_t g_pui8Image_Splash3[] = +{ + IMAGE_FMT_4BPP_COMP, + 96, 0, + 64, 0, + + 15, + 0x00, 0x00, 0x00, + 0x2a, 0x2a, 0x2a, + 0x44, 0x44, 0x44, + 0x56, 0x56, 0x56, + 0x67, 0x67, 0x67, + 0x76, 0x76, 0x76, + 0x87, 0x87, 0x87, + 0x97, 0x97, 0x97, + 0xa5, 0xa5, 0xa5, + 0xb7, 0xb7, 0xb7, + 0xc8, 0xc8, 0xc8, + 0xd6, 0xd6, 0xd6, + 0xe2, 0xe2, 0xe2, + 0xec, 0xec, 0xec, + 0xf7, 0xf7, 0xf7, + 0xff, 0xff, 0xff, + + 0x1f, 0xff, 0xff, 0xff, 0xe9, 0xd4, 0xa7, 0x5f, 0x17, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x02, 0x3e, 0xfb, 0x4e, 0x07, 0x07, 0x77, 0x2f, 0x07, 0xff, + 0x3e, 0xf9, 0x05, 0x07, 0x07, 0x77, 0x2f, 0x07, 0xff, 0x1f, 0xf5, 0x11, + 0xbf, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x1f, 0xf1, 0x84, 0x3f, 0x07, 0x07, + 0x77, 0x2f, 0x07, 0x1e, 0xf1, 0xba, 0x1e, 0x07, 0x07, 0x77, 0x29, 0xdc, + 0x08, 0xd9, 0x77, 0xca, 0x8c, 0x07, 0xff, 0xc1, 0xdf, 0x4e, 0x18, 0x02, + 0xfe, 0xcf, 0x6f, 0x27, 0x03, 0x61, 0x00, 0x31, 0x03, 0x34, 0x01, 0x32, + 0x27, 0xf9, 0x33, 0x08, 0x33, 0x33, 0x12, 0x4b, 0x01, 0xa1, 0xff, 0x24, + 0x8e, 0x01, 0xfa, 0x41, 0x1f, 0x05, 0xcd, 0x95, 0xfe, 0x00, 0x61, 0x08, + 0xf8, 0x1f, 0xff, 0x08, 0xff, 0xa1, 0x00, 0x01, 0x59, 0xab, 0x96, 0x65, + 0x20, 0x13, 0x7f, 0x00, 0xff, 0x92, 0xff, 0x51, 0xff, 0xff, 0xfb, 0x11, + 0x38, 0x72, 0x3f, 0x03, 0xdb, 0xb7, 0xfd, 0x75, 0x31, 0x00, 0x27, 0x9f, + 0xfc, 0x8f, 0xfa, 0x2d, 0xff, 0xa1, 0x40, 0x5f, 0x0a, 0xfe, 0x94, 0x11, + 0x3e, 0xc2, 0xef, 0x01, 0x61, 0xff, 0xff, 0x80, 0x5f, 0xe1, 0xaf, 0x7a, + 0xc0, 0x5a, 0xc6, 0xff, 0xff, 0xe6, 0x22, 0x25, 0x14, 0x00, 0xfe, 0xcf, + 0xf9, 0x6f, 0xfe, 0xef, 0xfa, 0x09, 0x80, 0x15, 0xf9, 0x20, 0x32, 0xdf, + 0x51, 0xff, 0xf8, 0x1c, 0x09, 0xff, 0x22, 0x7d, 0x45, 0x0a, 0xc3, 0x02, + 0x00, 0x7d, 0xff, 0xbc, 0xfe, 0x18, 0xf9, 0x1f, 0xf6, 0x10, 0x8f, 0xfb, + 0xaf, 0x0e, 0xfc, 0x10, 0xcf, 0x33, 0x06, 0xff, 0xa0, 0x9f, 0xf7, 0x0e, + 0x7e, 0x3e, 0xff, 0x00, 0xf4, 0x02, 0xbf, 0xff, 0xfe, 0x1a, 0xff, 0x32, + 0x08, 0xfb, 0x1b, 0xf3, 0x6f, 0x1f, 0xff, 0xff, 0xf2, 0x01, 0x7f, 0x24, + 0xff, 0x14, 0xff, 0x90, 0x9f, 0x6f, 0x88, 0x25, 0xfa, 0x01, 0xcf, 0x01, + 0x41, 0xff, 0x81, 0x08, 0xff, 0x17, 0xf2, 0x7f, 0x1f, 0xff, 0xff, 0xf4, + 0x03, 0x2f, 0x30, 0xda, 0x0f, 0xf6, 0x07, 0x77, 0x2e, 0x20, 0x60, 0x7f, + 0x02, 0xe1, 0x8f, 0xd1, 0xbf, 0x34, 0x20, 0xf1, 0x8f, 0x17, 0xff, 0xff, + 0xfb, 0x1f, 0x60, 0x0c, 0x00, 0x9f, 0x10, 0xaf, 0x77, 0x2d, 0xf5, 0x0b, + 0x81, 0x03, 0xf3, 0x2f, 0xf2, 0x6f, 0x44, 0xf1, 0x17, 0x83, 0x02, 0x34, + 0xf5, 0x37, 0xf1, 0x2f, 0x7f, 0x36, 0x20, 0x50, 0xcf, 0x03, 0xfa, 0x1c, + 0xf4, 0x3f, 0x53, 0x02, 0xf1, 0xbf, 0x39, 0xff, 0xfb, 0x8f, 0x05, 0xfe, + 0x0e, 0x05, 0xff, 0xff, 0x51, 0xa5, 0x6d, 0x31, 0xfa, 0x40, 0x0a, 0x0d, + 0x24, 0xf8, 0x1f, 0x73, 0xd1, 0xed, 0x08, 0x1c, 0xff, 0xfb, 0x7f, 0x05, + 0xf1, 0x1f, 0xff, 0x1d, 0xff, 0xb0, 0xaf, 0x15, 0x65, 0x51, 0x5f, 0x0d, + 0x01, 0x71, 0xfc, 0x1e, 0xa2, 0xb1, 0xf8, 0x1f, 0x05, 0x0b, 0xee, 0xff, + 0xff, 0x21, 0x01, 0xf4, 0x86, 0x4d, 0x10, 0xff, 0xff, 0x61, 0x7e, 0xe1, + 0x9f, 0x19, 0xe1, 0x04, 0x92, 0xf6, 0x2f, 0xe8, 0xef, 0x02, 0xfe, 0x4b, + 0x16, 0xff, 0xf8, 0x0d, 0x02, 0x07, 0x0e, 0xc6, 0x18, 0xa0, 0x0a, 0xb6, + 0x29, 0xf3, 0x4f, 0x26, 0xf2, 0x71, 0x00, 0xf4, 0x3f, 0xd8, 0xef, 0xff, + 0xf5, 0x9f, 0xff, 0x04, 0xfe, 0xcf, 0xff, 0xf1, 0x7f, 0x02, 0x90, 0xef, + 0xe4, 0x02, 0xb2, 0xc4, 0xf9, 0x1e, 0x52, 0xdc, 0xff, 0x00, 0xfc, 0xaf, + 0xf8, 0x2f, 0x53, 0xf2, 0x52, 0xf4, 0x4a, 0x5f, 0x09, 0xfa, 0xdf, 0x02, + 0x81, 0x03, 0xf1, 0x72, 0x4f, 0xcb, 0xa3, 0x52, 0xf4, 0x2f, 0x84, 0xf9, + 0x00, 0x7f, 0xfe, 0x1c, 0x92, 0xf2, 0x52, 0xf3, 0x6f, 0xa6, 0x0f, 0x22, + 0x03, 0xf8, 0x1e, 0x7f, 0x33, 0xf1, 0x10, 0x7f, 0xff, 0x69, 0x75, 0x25, + 0xe2, 0xf3, 0x22, 0x27, 0xf3, 0x7f, 0x0f, 0x16, 0xaf, 0xcc, 0x7f, 0x33, + 0x08, 0xa1, 0xdf, 0xff, 0xbd, 0x75, 0x62, 0xf2, 0xf4, 0x00, 0x13, 0xf2, + 0x7f, 0xff, 0xfc, 0xdf, 0xff, 0xfa, 0x00, 0xaf, 0xff, 0xff, 0xfc, 0x29, + 0x4f, 0xff, 0xff, 0x0d, 0xfe, 0xbe, 0xff, 0x51, 0x15, 0xcd, 0x71, 0x8a, + 0x40, 0xa5, 0x63, 0xb1, 0xe2, 0xb6, 0x13, 0xd2, 0x8f, 0x00, 0xff, 0xf7, + 0x9f, 0xff, 0xf9, 0x8f, 0xfe, 0x6c, 0x00, 0xfa, 0x2a, 0x3f, 0xff, 0xff, + 0x91, 0x14, 0xff, 0x3a, 0xa1, 0xcf, 0x1b, 0xdb, 0xb1, 0x61, 0x92, 0xdb, + 0x00, 0xff, 0xff, 0xd6, 0xef, 0xff, 0xf2, 0xb4, 0x87, 0x10, 0x23, 0xd2, + 0x7f, 0x14, 0xfe, 0xad, 0xfa, 0x2c, 0x00, 0x1b, 0xff, 0xff, 0x45, 0xfb, + 0xef, 0xf1, 0x6f, 0xc1, 0x74, 0x44, 0xff, 0x52, 0xff, 0xff, 0xda, 0x7a, + 0x82, 0xd9, 0xf3, 0x86, 0x68, 0x13, 0xe3, 0x17, 0xfd, 0x00, 0x17, 0x36, + 0xff, 0xff, 0xf7, 0x17, 0xff, 0xf4, 0x61, 0x2f, 0x76, 0x33, 0x32, 0xff, + 0xe9, 0xa7, 0x7d, 0x02, 0xf5, 0x58, 0x47, 0x23, 0xc4, 0x4f, 0x17, 0x10, + 0x00, 0x42, 0xef, 0xff, 0xb9, 0xf9, 0x5f, 0xf8, 0x1f, 0xc2, 0x77, 0x2a, + 0x32, 0xff, 0xd6, 0xef, 0x01, 0x66, 0x00, 0xff, 0xda, 0xef, 0xf9, 0x28, + 0x46, 0x44, 0x97, 0x40, 0x2f, 0x11, 0xfd, 0xdf, 0xff, 0xfc, 0x6e, 0xff, + 0x00, 0x20, 0x21, 0x1f, 0xff, 0x82, 0x60, 0x4f, 0xfc, 0x72, 0x1a, 0x09, + 0x59, 0xd4, 0xff, 0x91, 0x01, 0xfe, 0x00, 0xff, 0xff, 0xcc, 0xff, 0xb6, + 0xff, 0xfd, 0x26, 0x08, 0x47, 0x45, 0x79, 0x1f, 0x11, 0xf8, 0x9f, 0xff, + 0x00, 0xfc, 0x7f, 0xff, 0x22, 0x10, 0x00, 0x8f, 0xf9, 0x0d, 0x5a, 0xff, + 0xff, 0x17, 0x71, 0x59, 0xba, 0xcc, 0x04, 0xd1, 0xaf, 0xff, 0xff, 0xa6, + 0x74, 0xff, 0x26, 0x00, 0x47, 0x56, 0x4d, 0x1c, 0xff, 0xfe, 0x7d, 0xff, + 0x20, 0xff, 0xbd, 0x19, 0x18, 0x40, 0x11, 0x13, 0xdf, 0xa4, 0x31, 0x23, + 0x14, 0x50, 0x9f, 0xc3, 0xf2, 0x3f, 0x10, 0xff, 0xff, 0xed, 0x74, 0xff, + 0x26, 0x44, 0x5a, 0x00, 0x2f, 0x18, 0xff, 0xff, 0xbf, 0xda, 0xff, 0x79, + 0x00, 0xff, 0xff, 0xfd, 0x28, 0x14, 0x94, 0xf5, 0x09, 0xa0, 0x31, 0x61, + 0x14, 0xa0, 0x05, 0xba, 0xb8, 0x9f, 0x10, 0xff, 0xff, 0xfb, 0x6a, 0xf8, + 0x7f, 0xfe, 0x9e, 0x82, 0x31, 0x25, 0x45, 0x8f, 0x5d, 0x53, 0x11, 0xb7, + 0x80, 0x02, 0xf6, 0x39, 0x08, 0x56, 0xff, 0x60, 0xcf, 0x08, 0xff, 0xff, + 0xb1, 0xbf, 0x8a, 0xff, 0xf7, 0x00, 0x00, 0x00, 0x02, 0x51, 0x9f, 0xff, + 0xff, 0x50, 0xff, 0x02, 0xff, 0x87, 0xfc, 0xcf, 0xfd, 0x6e, 0x59, 0x79, + 0x04, 0xfb, 0x8f, 0x52, 0x80, 0xcf, 0x13, 0xff, 0xff, 0x01, 0xf1, 0x10, + 0x24, 0x2f, 0xff, 0xf5, 0x0f, 0xb9, 0x40, 0x5f, 0x74, 0xb7, 0x56, 0x12, + 0x72, 0x04, 0xff, 0x04, 0xff, 0xf2, 0x2f, 0xff, 0xaa, 0x7c, 0xff, 0xb4, + 0x04, 0x22, 0x02, 0x44, 0x71, 0x09, 0x9d, 0x40, 0x00, 0x00, 0x22, 0xdf, + 0xff, 0xff, 0x13, 0xff, 0xff, 0xfa, 0x40, 0x0c, 0x0d, 0xff, 0xf9, 0x01, + 0xf1, 0x3f, 0xff, 0x20, 0xf9, 0x04, 0x8e, 0xfa, 0x07, 0xbe, 0xfd, 0xab, + 0x08, 0x32, 0x41, 0x24, 0xaf, 0x01, 0xfe, 0x81, 0x00, 0x2a, 0x00, 0x3d, + 0x39, 0xb1, 0x99, 0x22, 0x05, 0xff, 0x00, 0xff, 0xf2, 0x37, 0x04, 0xfb, + 0x30, 0x61, 0x1b, 0x80, 0x85, 0xf1, 0x05, 0x66, 0x43, 0x11, 0x4e, 0xff, + 0x00, 0xa5, 0x22, 0x24, 0x46, 0x75, 0x30, 0x00, 0x01, 0x20, 0xa3, 0x5f, + 0x41, 0xf4, 0x1f, 0xff, 0xff, 0xd1, 0x60, 0x9f, 0x04, 0x89, 0x20, 0x43, + 0x11, 0x72, 0x31, 0x20, 0x00, 0x3a, 0x83, 0xd6, 0x02, 0xe6, 0x43, 0x35, + 0x40, 0xaf, 0x29, 0xfa, 0x54, 0x41, 0x00, 0x02, 0x10, 0x10, 0x2f, 0xfb, + 0x1c, 0x4a, 0x06, 0xff, 0xff, 0xf5, 0x60, 0x1f, 0x03, 0x92, 0xf5, 0x01, + 0x01, 0x30, 0x00, 0x00, 0x3c, 0x10, 0x12, 0x22, 0x12, 0x11, 0x32, 0x22, + 0x40, 0x8f, 0x4f, 0xf5, 0x00, 0x7f, 0x35, 0x3d, 0xff, 0x41, 0x23, 0x82, + 0xb0, 0x9f, 0xff, 0xff, 0x18, 0x3f, 0x00, 0xff, 0xa2, 0x00, 0x00, 0x28, + 0xf9, 0x00, 0x00, 0x04, 0x00, 0x00, 0x11, 0x09, 0xdf, 0x57, 0xff, 0xe1, + 0x00, 0x05, 0xf9, 0x1f, 0x61, 0xff, 0xe1, 0x14, 0x6c, 0x01, 0xff, 0xff, + 0xf7, 0x0d, 0xff, 0xff, 0x62, 0x37, 0x80, 0x03, 0xf3, 0x03, 0x10, 0x00, + 0x9f, 0xff, 0x15, 0x80, 0x5f, 0xff, 0xfd, 0x00, 0x7f, 0xf1, 0x6f, 0xf1, + 0x00, 0x7f, 0xfc, 0x67, 0x21, 0x4f, 0xff, 0xff, 0x71, 0x18, 0x58, 0x74, + 0x12, 0x2f, 0x03, 0x20, 0x7f, 0xf0, 0x04, 0x59, 0x16, 0xff, 0xc0, 0x9f, + 0x57, 0xf2, 0x3f, 0x00, 0xff, 0x12, 0xff, 0xfb, 0x08, 0xff, 0xfd, 0x30, + 0x01, 0x1e, 0xff, 0xff, 0xfa, 0x43, 0x44, 0x8f, 0x37, 0x90, 0x02, 0xe1, + 0x06, 0x11, 0xc0, 0x3f, 0xf7, 0x04, 0x40, 0xef, 0x4e, 0xb1, 0xdf, 0xe1, + 0x0c, 0xff, 0xff, 0x07, 0xa1, 0x25, 0x51, 0x00, 0x3f, 0x6e, 0x2e, 0x01, + 0x00, 0x14, 0xff, 0xf0, 0x2f, 0xff, 0xfc, 0x09, 0xff, 0x20, 0x80, 0x06, + 0x1e, 0x80, 0x25, 0x00, 0x8f, 0xff, 0x03, 0xff, 0xfd, 0x77, 0x65, 0x06, + 0xdf, 0x6e, 0x2e, 0x02, 0xff, 0xff, 0xfe, 0x1b, 0xb4, 0x05, 0x51, 0x60, + 0x08, 0x9f, 0x80, 0x01, 0xef, 0x15, 0x50, 0x00, 0x18, 0xb8, 0x04, 0xed, + 0x7d, 0x45, 0x0c, 0x41, 0x21, 0x07, 0x84, 0x11, 0xf8, 0x02, 0x10, 0x0a, + 0x16, 0xed, 0x8d, 0xe1, 0x07, 0xbf, 0x77, 0xff, 0xb0, 0x00, 0x05, 0x0a, + 0x1e, 0xf6, 0x22, 0xcf, 0x07, 0x07, 0x77, 0x2f, 0xff, 0x0f, 0xff, 0xf9, + 0x45, 0xbf, 0x07, 0x07, 0x77, 0x2f, 0xfc, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, +}; + +const uint8_t g_pui8Image_Splash4[] = +{ + IMAGE_FMT_4BPP_COMP, + 96, 0, + 64, 0, + + 15, + 0x00, 0x00, 0x00, + 0x29, 0x29, 0x29, + 0x42, 0x42, 0x42, + 0x55, 0x55, 0x55, + 0x66, 0x66, 0x66, + 0x77, 0x77, 0x77, + 0x88, 0x88, 0x88, + 0x98, 0x98, 0x98, + 0xa5, 0xa5, 0xa5, + 0xb4, 0xb4, 0xb4, + 0xc6, 0xc6, 0xc6, + 0xd8, 0xd8, 0xd8, + 0xe6, 0xe6, 0xe6, + 0xf1, 0xf1, 0xf1, + 0xfa, 0xfa, 0xfa, + 0xff, 0xff, 0xff, + + 0x1f, 0xff, 0xff, 0xff, 0xe9, 0xd4, 0xa7, 0x5f, 0x17, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xe7, 0x07, 0x07, 0x01, 0xfc, 0xaf, + 0x07, 0x07, 0x77, 0xc7, 0x2f, 0x07, 0xff, 0xf3, 0x0d, 0x07, 0x07, 0x77, + 0xc7, 0x2f, 0x07, 0xff, 0xa1, 0x17, 0x07, 0x07, 0x77, 0xc7, 0x2f, 0x07, + 0xff, 0x45, 0x72, 0x07, 0x07, 0x77, 0xc7, 0x2f, 0x07, 0xff, 0x28, 0xb1, + 0x07, 0x07, 0x77, 0x88, 0x2a, 0xed, 0xff, 0xef, 0x07, 0xff, 0xff, 0xfc, + 0x1c, 0x1b, 0xe1, 0xbf, 0x07, 0x47, 0x07, 0xfd, 0x55, 0x00, 0x42, 0x12, + 0x22, 0x11, 0x18, 0xff, 0xfc, 0xab, 0x21, 0x9a, 0xce, 0x03, 0xf7, 0x1f, + 0xd1, 0xaf, 0x01, 0x70, 0xa8, 0x05, 0xcd, 0x96, 0xb6, 0x50, 0x24, 0x05, + 0x00, 0xcf, 0x51, 0xca, 0x51, 0x54, 0x12, 0x23, 0x33, 0x10, 0x33, 0x33, + 0x5b, 0x01, 0xf4, 0x2f, 0xe1, 0xaf, 0x0e, 0xff, 0xff, 0x83, 0x01, 0x04, + 0xd4, 0xa7, 0xd2, 0x00, 0x03, 0x59, 0xff, 0x6b, 0xff, 0x6a, 0xff, 0xff, + 0x00, 0x10, 0x6e, 0xff, 0xff, 0xdc, 0xb7, 0x31, 0x19, 0x00, 0xff, 0xff, + 0xf2, 0x4f, 0xd1, 0xaf, 0xff, 0xa0, 0x38, 0x1a, 0x25, 0x03, 0xdb, 0xb6, + 0xfb, 0x53, 0x42, 0x00, 0x02, 0xcf, 0xbc, 0xff, 0xff, 0xfc, 0x1b, 0xff, + 0x20, 0xe1, 0x1e, 0x0b, 0xfc, 0x52, 0x14, 0xbf, 0xf2, 0x01, 0x6f, 0xc1, + 0xaf, 0xf6, 0x05, 0xfb, 0x1d, 0x7b, 0xc0, 0x53, 0xb5, 0xf6, 0x11, 0x47, + 0x86, 0x2b, 0xff, 0x01, 0x41, 0xff, 0xff, 0xfa, 0x1f, 0xff, 0x02, 0x16, + 0x00, 0xb4, 0x04, 0xf2, 0x8f, 0x91, 0xdf, 0x50, 0xbf, 0x30, 0xf2, 0x5f, + 0x76, 0x36, 0xfa, 0x11, 0x7f, 0xff, 0x00, 0xff, 0xcc, 0xff, 0xa1, 0xef, + 0x4b, 0xf9, 0x1f, 0x20, 0xfa, 0x2e, 0x17, 0xd2, 0x11, 0x8f, 0x52, 0xf6, + 0x19, 0x0b, 0xff, 0x50, 0x7f, 0x36, 0x30, 0x7f, 0x01, 0x01, 0xf2, 0x8f, + 0xf2, 0x7f, 0x19, 0xf7, 0x2f, 0x1f, 0x80, 0x01, 0x60, 0x8f, 0x27, 0xc0, + 0xaf, 0xf7, 0x0b, 0xc8, 0x6f, 0x25, 0xc0, 0x1d, 0x02, 0xf4, 0x1f, 0xf4, + 0x0c, 0x3f, 0x17, 0xf6, 0x2f, 0x1f, 0x6a, 0x3f, 0x2b, 0x0c, 0x25, 0xff, + 0x30, 0xaf, 0x6f, 0x24, 0xf9, 0x05, 0x80, 0x03, 0xfe, 0x18, 0xf9, 0x1f, + 0x34, 0xf5, 0x2f, 0xc0, 0x1f, 0x01, 0xfa, 0x1d, 0x20, 0x2f, 0xc0, 0x1c, + 0xc8, 0x77, 0x2d, 0xa0, 0x6f, 0x04, 0x32, 0xfd, 0x1d, 0x18, 0x52, 0xf3, + 0x3f, 0x17, 0x01, 0xf7, 0x0f, 0xb4, 0x32, 0xcb, 0x04, 0x7f, 0x35, 0xfb, + 0x07, 0x05, 0x90, 0x06, 0xff, 0x19, 0x92, 0xf2, 0x4f, 0x0f, 0x01, 0x70, + 0x0c, 0x9f, 0xff, 0xf0, 0x7f, 0x7f, 0x35, 0xf1, 0x3f, 0x81, 0xbe, 0x8f, + 0x26, 0xb1, 0xf3, 0x4f, 0x2c, 0x07, 0x01, 0xff, 0xf5, 0x0a, 0xff, 0xff, + 0xf2, 0x5f, 0x87, 0xa0, 0x3d, 0x51, 0x06, 0xf4, 0x3f, 0x53, 0xc1, 0xf4, + 0x20, 0x5b, 0x1f, 0x07, 0xff, 0x70, 0xaf, 0xff, 0xff, 0x34, 0xfa, 0x1b, + 0x87, 0x3d, 0x06, 0x06, 0xf9, 0x1f, 0x04, 0x82, 0xd1, 0xf5, 0x47, 0x2f, + 0x07, 0xfb, 0x08, 0xb2, 0x02, 0x32, 0x87, 0x3c, 0xf9, 0x0e, 0x7f, 0x19, + 0x04, 0xc2, 0xd2, 0xd6, 0x44, 0x3f, 0x01, 0xfd, 0x5c, 0xa3, 0x02, 0xf2, + 0xaa, 0xff, 0xd0, 0x9f, 0x07, 0xbb, 0x90, 0x54, 0xff, 0x6b, 0x21, 0x33, + 0xf1, 0xd2, 0xb8, 0x00, 0x33, 0x6f, 0xd6, 0xdf, 0xff, 0xfe, 0xae, 0xff, + 0x04, 0xfd, 0xef, 0xff, 0xa1, 0xcf, 0x02, 0xf6, 0x2f, 0xe5, 0x03, 0xdb, + 0x82, 0xb0, 0xaf, 0x83, 0xbd, 0x21, 0x00, 0x71, 0xf2, 0xb3, 0xa9, 0x12, + 0x8f, 0xd9, 0xdf, 0x42, 0xf8, 0x69, 0xf5, 0xbf, 0xff, 0x32, 0x03, 0xfd, + 0x74, 0x1a, 0x03, 0xa3, 0x7a, 0x51, 0x8d, 0xf9, 0xbf, 0x00, 0xff, 0xd1, + 0xc3, 0xa4, 0x89, 0x12, 0xaf, 0xff, 0x20, 0xff, 0xf7, 0xe1, 0xfd, 0xef, + 0xff, 0x16, 0xdf, 0xb1, 0x2b, 0x33, 0x04, 0xd4, 0xff, 0xff, 0x32, 0x5b, + 0x00, 0xef, 0xf6, 0x8a, 0xcb, 0x9f, 0xf2, 0x94, 0x85, 0x00, 0x69, 0x02, + 0xcf, 0xfe, 0xef, 0xff, 0xff, 0xf7, 0x02, 0x9f, 0xff, 0xff, 0xfd, 0x18, + 0x2d, 0x01, 0x79, 0x3a, 0xff, 0x81, 0x02, 0xe2, 0xc4, 0x23, 0x31, 0xbf, + 0x00, 0xf6, 0x7f, 0xfb, 0xcf, 0xfb, 0x9f, 0xf4, 0x56, 0x00, 0x76, 0x58, + 0x03, 0xff, 0xe4, 0xbf, 0xff, 0xff, 0x00, 0xf9, 0xaf, 0xf7, 0xbf, 0xfb, + 0x1a, 0x2b, 0xff, 0x00, 0xff, 0xf2, 0x43, 0x5f, 0xf1, 0x9f, 0xff, 0xff, + 0x60, 0xff, 0xe9, 0xd4, 0xff, 0x15, 0xff, 0xff, 0xfa, 0x10, 0x4f, 0xfc, + 0xcf, 0x62, 0xf8, 0x45, 0x68, 0x49, 0x04, 0x03, 0xff, 0xfc, 0xfa, 0x7f, + 0x01, 0xf6, 0xbf, 0x00, 0xfd, 0x06, 0x38, 0xff, 0xff, 0xb1, 0x78, 0xaf, + 0x30, 0xf3, 0x5f, 0x22, 0x02, 0xff, 0xff, 0xeb, 0xad, 0x08, 0xff, 0x16, + 0xff, 0xf9, 0x02, 0xaa, 0xff, 0xfc, 0x00, 0xdf, 0xfc, 0x24, 0x59, 0x3a, + 0x02, 0xff, 0xff, 0x22, 0xfc, 0xaf, 0x03, 0xfd, 0x01, 0x35, 0x41, 0x01, + 0x18, 0xff, 0xf6, 0x3f, 0x8b, 0x62, 0xf7, 0x10, 0x00, 0x08, 0x3f, 0x24, + 0xff, 0xfb, 0x02, 0x87, 0xff, 0xf6, 0x01, 0xaf, 0xff, 0x24, 0x48, 0x39, + 0x12, 0xcf, 0x12, 0x20, 0xfe, 0x7d, 0xe1, 0x10, 0x01, 0xdf, 0xff, 0xe4, + 0x0c, 0x79, 0x3d, 0xfa, 0x1e, 0x72, 0x52, 0xff, 0x20, 0x08, 0x10, 0x00, + 0x11, 0x14, 0x01, 0xfb, 0x7f, 0xa9, 0x80, 0x63, 0x24, 0x49, 0x39, 0x11, + 0xaf, 0xff, 0x89, 0x08, 0xff, 0xff, 0xfe, 0x7c, 0x01, 0x10, 0x00, 0x2d, + 0x03, 0xff, 0xf4, 0x30, 0x3f, 0xff, 0x19, 0x23, 0x01, 0x02, 0xf5, 0x23, + 0x02, 0xa4, 0x02, 0x02, 0x31, 0xfb, 0x08, 0x8f, 0x98, 0xff, 0xfe, 0x51, + 0x25, 0x39, 0x29, 0x00, 0x31, 0x5f, 0xff, 0xbb, 0xff, 0x49, 0xff, 0xff, + 0x00, 0xe7, 0xcf, 0xff, 0x24, 0x20, 0x00, 0x5f, 0xff, 0x0c, 0x71, 0xaf, + 0xff, 0x34, 0x31, 0x19, 0xff, 0xff, 0x00, 0xf2, 0x00, 0x4f, 0xff, 0x11, + 0x30, 0xaf, 0xff, 0x40, 0xfe, 0x7a, 0xf8, 0x9f, 0xff, 0xff, 0x25, 0x9a, + 0x10, 0x2a, 0x42, 0x3f, 0x11, 0xab, 0xff, 0xff, 0xf9, 0x01, 0xcf, 0xfe, + 0x19, 0xf2, 0x01, 0x01, 0xcf, 0x29, 0x60, 0x52, 0x0a, 0xe2, 0xf2, 0x40, + 0x89, 0xdf, 0x30, 0x08, 0x22, 0x4f, 0xff, 0xb5, 0x7a, 0xfd, 0xdf, 0xff, + 0x02, 0xff, 0x25, 0xff, 0xcf, 0x36, 0x2b, 0x12, 0xf6, 0x00, 0xaf, 0xff, + 0xff, 0xfb, 0x1d, 0x80, 0x42, 0xe3, 0x58, 0x0b, 0x29, 0x81, 0x0a, 0x52, + 0xf1, 0x31, 0x50, 0x00, 0x44, 0x12, 0x4c, 0x09, 0xff, 0xdc, 0xff, 0xb6, + 0x80, 0x49, 0xf9, 0xaf, 0xff, 0x33, 0x8b, 0xaf, 0xef, 0x00, 0x44, 0xff, + 0xfc, 0x7e, 0xff, 0xf9, 0xbf, 0xff, 0x01, 0xff, 0xf6, 0x1f, 0x11, 0x35, + 0xff, 0x60, 0xb9, 0x30, 0xd1, 0xaf, 0x11, 0xe9, 0xff, 0xf1, 0x11, 0x83, + 0x00, 0x00, 0x00, 0xcf, 0x50, 0xdf, 0xff, 0xff, 0xdc, 0x00, 0xff, 0xcb, + 0xfe, 0xdc, 0xdf, 0xff, 0x22, 0x16, 0x02, 0x17, 0x56, 0x80, 0x7d, 0xfc, + 0x7e, 0x14, 0x75, 0x00, 0x41, 0x0b, 0xff, 0xf4, 0x0f, 0xff, 0xff, 0xf3, + 0x60, 0x5f, 0x83, 0xb9, 0x21, 0x4f, 0x75, 0x8d, 0xff, 0x20, 0xf5, 0x0d, + 0x0a, 0x96, 0xfc, 0x7f, 0xff, 0xfc, 0x01, 0x12, 0x66, 0x86, 0x72, 0x00, + 0x11, 0x2a, 0x0b, 0x00, 0xfd, 0x21, 0x21, 0xab, 0x52, 0xcf, 0xff, 0x13, + 0x08, 0xff, 0xff, 0xf8, 0x1f, 0x7b, 0xff, 0xff, 0xf7, 0x22, 0x2f, 0x15, + 0x29, 0xf2, 0x12, 0xaf, 0x83, 0xef, 0x00, 0xff, 0xf4, 0x02, 0x65, 0x65, + 0x43, 0x4b, 0xfb, 0x00, 0x31, 0x24, 0x67, 0x8a, 0xcb, 0xa8, 0x50, 0x00, + 0x00, 0x01, 0x2b, 0xf2, 0x4f, 0xff, 0xb0, 0x8f, 0xff, 0x30, 0xff, 0x09, + 0x03, 0xd9, 0x22, 0x43, 0x36, 0x78, 0x02, 0x62, 0x07, 0xf0, 0x02, 0x8b, + 0xef, 0x72, 0xfe, 0x04, 0x10, 0xb9, 0x76, 0x58, 0xae, 0x21, 0x94, 0x33, + 0x00, 0x31, 0x00, 0x00, 0x00, 0x21, 0x22, 0x07, 0xf2, 0x01, 0x5f, 0xff, + 0xf7, 0x0c, 0xff, 0xff, 0x42, 0x12, 0x80, 0xe2, 0x90, 0x38, 0x02, 0x40, + 0x2a, 0x22, 0x10, 0x00, 0x12, 0x00, 0x01, 0x34, 0x43, 0x24, 0x46, 0x61, + 0x40, 0x1c, 0x46, 0xff, 0xf9, 0x05, 0x79, 0x12, 0xff, 0x00, 0xff, 0x61, + 0xf1, 0x6f, 0xff, 0xff, 0x21, 0xff, 0x10, 0xff, 0xc1, 0xaf, 0x3d, 0xfd, + 0x20, 0x00, 0x10, 0x00, 0x13, 0x00, 0x04, 0x82, 0xc9, 0x50, 0x00, 0x04, + 0x18, 0x10, 0x00, 0x0b, 0x55, 0x19, 0xfa, 0x1d, 0xff, 0x00, 0x35, 0xff, + 0xff, 0xd1, 0x00, 0xaf, 0xff, 0xff, 0x04, 0xd0, 0x4f, 0xff, 0xf4, 0x2f, + 0x36, 0xfb, 0x94, 0x00, 0x22, 0x10, 0x24, 0xaf, 0x71, 0xff, 0xf5, 0x03, + 0x08, 0x6b, 0xff, 0xf7, 0x02, 0x56, 0xff, 0xff, 0xf8, 0x01, 0x1f, 0xff, + 0x18, 0xff, 0xff, 0xd0, 0x01, 0x71, 0x06, 0xfb, 0x01, 0xcf, 0xfe, 0x19, + 0x37, 0x03, 0xf0, 0x03, 0x3f, 0xfe, 0x10, 0x01, 0x47, 0xc4, 0x12, 0x3d, + 0x00, 0xf7, 0x1f, 0xff, 0x21, 0xbf, 0xff, 0xfa, 0x6c, 0x86, 0x02, 0xe3, + 0x01, 0x57, 0x16, 0x37, 0x03, 0xfe, 0x01, 0x03, 0xff, 0xa4, 0x10, 0x02, + 0x10, 0x1a, 0x57, 0x01, 0xff, 0xf8, 0x1f, 0xff, 0xf5, 0x02, 0xcf, 0x05, + 0x18, 0xc5, 0x22, 0x5e, 0x37, 0x04, 0xf1, 0x18, 0xdf, 0x08, 0x70, 0x1f, + 0xc5, 0xbf, 0x57, 0xff, 0xff, 0x21, 0x1c, 0xef, 0xb6, 0x10, 0x87, 0x47, + 0x06, 0xfb, 0x23, 0x18, 0x21, 0x00, 0x6f, 0x17, 0x02, 0xf2, 0x07, 0x70, + 0x71, 0x05, 0x7f, 0x37, 0x07, 0xff, 0xc6, 0x29, 0x17, 0x8f, 0x04, 0xa2, + 0x32, 0x7f, 0x77, 0x2f, 0x77, 0x2f, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xe0, 0x07, 0x07, 0x07, +}; + +const uint8_t g_pui8Image_Splash5[] = +{ + IMAGE_FMT_4BPP_COMP, + 96, 0, + 64, 0, + + 15, + 0x00, 0x00, 0x00, + 0x29, 0x29, 0x29, + 0x43, 0x43, 0x43, + 0x57, 0x57, 0x57, + 0x67, 0x67, 0x67, + 0x77, 0x77, 0x77, + 0x86, 0x86, 0x86, + 0x98, 0x98, 0x98, + 0xa9, 0xa9, 0xa9, + 0xba, 0xba, 0xba, + 0xca, 0xca, 0xca, + 0xd8, 0xd8, 0xd8, + 0xe7, 0xe7, 0xe7, + 0xf4, 0xf4, 0xf4, + 0xfb, 0xfb, 0xfb, + 0xff, 0xff, 0xff, + + 0x1f, 0xff, 0xff, 0xff, 0xe9, 0xd4, 0xa7, 0x5f, 0x12, 0x3e, 0xfe, 0x06, + 0x07, 0x07, 0x77, 0x2f, 0x07, 0xff, 0x27, 0xf7, 0x02, 0x03, 0xf6, 0x4f, + 0x07, 0x07, 0x77, 0xc4, 0x2f, 0x01, 0xf2, 0x42, 0x9f, 0x02, 0x30, 0x3f, + 0xf8, 0x07, 0x07, 0x77, 0x2f, 0x01, 0xf1, 0xa5, 0x4f, 0x9f, 0x01, 0xe1, + 0x58, 0xd2, 0x07, 0xa7, 0x5f, 0x17, 0x11, 0xb1, 0xf9, 0x1f, 0x01, 0x22, + 0xf7, 0x3f, 0x07, 0xe0, 0x07, 0x77, 0x2a, 0xb8, 0x64, 0x43, 0x46, 0xac, + 0x00, 0x99, 0xdf, 0xff, 0x91, 0xff, 0x17, 0xff, 0xff, 0x0e, 0xf5, 0x1f, + 0xf5, 0x4f, 0x07, 0xbf, 0x77, 0xff, 0x00, 0xff, 0x94, 0x22, 0x11, 0x23, + 0x44, 0x32, 0x11, 0x00, 0x01, 0x13, 0xaf, 0x72, 0xff, 0x33, 0xff, 0xff, + 0x0e, 0xe0, 0x8f, 0xf3, 0x7f, 0x07, 0xbf, 0x77, 0xf9, 0x08, 0x30, 0x13, + 0x6a, 0xdf, 0x01, 0xfa, 0xaf, 0xc4, 0x00, 0x14, 0x72, 0xff, 0x71, 0xff, + 0xff, 0x43, 0xff, 0x38, 0xb2, 0xef, 0x07, 0xbf, 0x73, 0xd9, 0x53, 0x43, + 0x10, 0x33, 0x20, 0x28, 0x1f, 0xd2, 0x02, 0xff, 0xb1, 0x07, 0xef, 0xfe, + 0x08, 0xff, 0x43, 0x77, 0x2f, 0x03, 0x02, 0x92, 0x12, 0x36, 0x77, 0x76, + 0x7d, 0x1f, 0xff, 0x00, 0xff, 0x60, 0xcf, 0xb1, 0xdf, 0xf4, 0x1f, 0xfe, + 0x70, 0x1a, 0x6f, 0x27, 0x01, 0xfc, 0x42, 0x03, 0xbf, 0xc0, 0x3f, 0x03, + 0xb8, 0xf1, 0x3f, 0xb1, 0xdf, 0xc1, 0x1c, 0x8f, 0xf5, 0x3f, 0x4f, 0x07, + 0x01, 0x90, 0x28, 0x02, 0xef, 0xff, 0xff, 0xb5, 0xff, 0x68, 0x1f, 0xf9, + 0x00, 0x03, 0xfb, 0x1f, 0x71, 0xff, 0x21, 0xff, 0x90, 0x61, 0xbf, 0x6f, + 0x27, 0xff, 0xfe, 0x94, 0x06, 0x52, 0x10, 0xb2, 0xef, 0x26, 0x1f, 0xb0, + 0x6f, 0xfe, 0x1d, 0x06, 0x70, 0x62, 0x0c, 0xf9, 0x07, 0x77, 0x2f, 0xff, + 0x00, 0xfa, 0x21, 0x24, 0xaf, 0xff, 0x87, 0xff, 0x58, 0x10, 0xf2, 0xcf, + 0x17, 0x17, 0x13, 0xff, 0xff, 0x6c, 0x06, 0xe9, 0x53, 0xcf, 0x60, 0x8f, + 0x77, 0x2f, 0xff, 0x20, 0x40, 0x4b, 0x59, 0x71, 0xff, 0x53, 0xf2, 0x9f, + 0x49, 0xad, 0x16, 0xf9, 0x0d, 0x03, 0xf6, 0x0a, 0x7e, 0xc8, 0x3e, 0x01, + 0xd1, 0x1c, 0x22, 0xf1, 0x6f, 0xa2, 0x08, 0xf3, 0x7f, 0xd9, 0xef, 0x01, + 0xc9, 0xff, 0xeb, 0x13, 0xef, 0xf2, 0x2f, 0x03, 0xf3, 0x8f, 0xcb, 0xa3, + 0x90, 0xb6, 0xfa, 0x02, 0x2a, 0xfb, 0xb8, 0x2f, 0xf2, 0x10, 0xc4, 0x6f, + 0x80, 0x0a, 0xa6, 0xff, 0xc6, 0xdf, 0x2e, 0xf0, 0x9f, 0x03, 0xf3, 0xcc, + 0xa3, 0xb6, 0x60, 0x40, 0x7f, 0x2a, 0xfa, 0x0c, 0x37, 0xf2, 0x87, 0x5f, + 0x45, 0x71, 0x0e, 0x91, 0xdf, 0x49, 0x02, 0xf3, 0x23, 0xc8, 0x5e, 0x1b, + 0xf3, 0x0a, 0x6c, 0x25, 0x82, 0xf5, 0x11, 0x59, 0x3f, 0x71, 0x0e, 0x61, + 0xfd, 0x19, 0x02, 0x32, 0xf4, 0x6f, 0x7e, 0x3e, 0xff, 0x20, 0x75, 0xb1, + 0x01, 0x72, 0xfa, 0x38, 0x3f, 0x80, 0xff, 0x98, 0x04, 0x13, 0x71, 0xfa, + 0x1d, 0x02, 0xf5, 0x3f, 0x15, 0xcd, 0xa0, 0x71, 0x0d, 0x75, 0xf2, 0x54, + 0x7f, 0x37, 0x3f, 0x02, 0x81, 0xff, 0x87, 0xff, 0xf7, 0x9f, 0x01, 0x90, + 0x26, 0xfa, 0x1f, 0x02, 0xf7, 0x2f, 0x15, 0xcd, 0xff, 0x10, 0xff, 0xa0, + 0xaf, 0x75, 0xf9, 0x26, 0x2f, 0x45, 0x00, 0x4b, 0xb0, 0xef, 0xff, 0xff, + 0xfb, 0xcf, 0xff, 0x04, 0x89, 0xff, 0x91, 0xfb, 0x1e, 0x02, 0xfa, 0x2f, + 0xc4, 0x15, 0xcd, 0xff, 0xff, 0x13, 0x7c, 0xdf, 0xff, 0x01, 0xff, 0x26, + 0x3d, 0x84, 0x48, 0xd1, 0xcf, 0x03, 0x00, 0x68, 0xff, 0xa1, 0xcf, 0x1b, + 0xff, 0xfa, 0x7c, 0x1c, 0xff, 0xfb, 0x1d, 0x0c, 0xd4, 0x21, 0xf6, 0x0f, + 0x80, 0x7b, 0xf8, 0x6f, 0xff, 0xff, 0x43, 0x56, 0xd3, 0x01, 0x45, 0xe0, + 0xcf, 0xff, 0xff, 0xfc, 0x9f, 0x01, 0x00, 0xf1, 0x8f, 0x17, 0xff, 0x72, + 0x66, 0xff, 0xfb, 0x72, 0x2d, 0x0b, 0xdb, 0xb3, 0xf1, 0x5f, 0x7b, 0xfd, + 0x00, 0xcf, 0xff, 0xff, 0x92, 0x74, 0xf3, 0x25, 0xf1, 0x08, 0xbf, 0xff, + 0xff, 0xf9, 0x6a, 0xf2, 0x1f, 0x52, 0x03, 0xff, 0xb7, 0x9f, 0xff, 0xfa, + 0x1f, 0x0b, 0xdb, 0x90, 0xb3, 0xa0, 0xcf, 0x7f, 0xf1, 0x73, 0xf5, 0x25, + 0x08, 0xe1, 0x9f, 0xff, 0xac, 0x03, 0xf4, 0x04, 0xa1, 0x03, 0xfd, 0x92, + 0x07, 0x8f, 0xf8, 0x2f, 0x0f, 0xbc, 0x40, 0x52, 0x85, 0xfd, 0x5c, 0xff, + 0xf3, 0x64, 0x98, 0x04, 0x25, 0xd1, 0x7f, 0xff, 0x49, 0x03, 0xf5, 0x21, + 0x01, 0x94, 0x8f, 0x23, 0x51, 0x9f, 0xf5, 0x2f, 0x05, 0x90, 0xcd, 0xff, + 0x24, 0x85, 0xfe, 0x9d, 0xff, 0xf6, 0x04, 0x36, 0x6a, 0x34, 0xd2, 0x5f, + 0x03, 0xf8, 0x7f, 0x00, 0xf7, 0x2a, 0x11, 0x6f, 0xb6, 0x57, 0xff, 0xf2, + 0x64, 0x6f, 0x05, 0xcd, 0xff, 0x17, 0x02, 0xf7, 0x8f, 0x81, 0x52, 0xf9, + 0x27, 0x4b, 0x43, 0xb5, 0x2f, 0x03, 0x02, 0xf9, 0x7f, 0xf9, 0x1f, 0xa0, + 0x3f, 0x01, 0xc1, 0x74, 0xbf, 0x83, 0x5b, 0x33, 0x18, 0x02, 0xfb, 0xcb, + 0x40, 0xaf, 0x21, 0xfd, 0x18, 0x4a, 0x53, 0x8b, 0x1f, 0xa2, 0x01, 0x96, + 0x01, 0xfc, 0x1c, 0xd0, 0xaa, 0x42, 0xe0, 0x0a, 0xe2, 0xc5, 0xfd, 0x19, + 0xff, 0xff, 0xfa, 0x08, 0x7f, 0xff, 0xf8, 0x7f, 0x42, 0x17, 0x59, 0x53, + 0x40, 0x4f, 0x81, 0xff, 0xaa, 0xf7, 0xdf, 0xff, 0xfb, 0x17, 0x1e, 0x91, + 0x1d, 0x01, 0x18, 0x42, 0x22, 0xc6, 0x06, 0x17, 0xff, 0xff, 0xfb, 0x8f, + 0x39, 0xda, 0x27, 0x00, 0x68, 0x54, 0x3f, 0x23, 0xff, 0xfb, 0x5f, 0xff, + 0x00, 0xc6, 0xef, 0xff, 0xf9, 0x0f, 0x52, 0x2e, 0xff, 0x17, 0xff, 0xf6, + 0x1f, 0x29, 0xef, 0x09, 0xc9, 0xd4, 0x40, 0x34, 0x9c, 0xfa, 0xcc, 0x7f, + 0xff, 0xff, 0x45, 0x01, 0x68, 0x54, 0x4f, 0x71, 0xff, 0xfc, 0x9f, 0x02, + 0x00, 0xf4, 0x2e, 0x38, 0x1f, 0xff, 0xff, 0xf2, 0x4f, 0xe9, 0x0c, 0xd4, + 0x42, 0x91, 0x7c, 0xf7, 0x8f, 0x39, 0x02, 0x64, 0x89, 0xba, 0xff, 0x90, + 0xbf, 0x04, 0x30, 0x01, 0xf3, 0x78, 0x1f, 0xff, 0xff, 0xf1, 0x9f, 0x0c, + 0xca, 0x64, 0x32, 0xf1, 0x8f, 0x01, 0x9a, 0x54, 0x62, 0x04, 0xff, 0xa8, + 0xf1, 0x20, 0x6f, 0x02, 0xfa, 0x30, 0x01, 0x13, 0x23, 0xe0, 0x1f, 0xff, + 0xff, 0x91, 0x3c, 0xd0, 0x0c, 0xa3, 0xf3, 0x51, 0xff, 0x68, 0xff, 0xff, + 0x00, 0xc7, 0xdf, 0xff, 0xff, 0x72, 0x2c, 0x80, 0x23, 0x00, 0x20, 0x10, + 0x45, 0x45, 0x56, 0x41, 0x12, 0x38, 0x01, 0xf7, 0x03, 0x42, 0x2e, 0xff, + 0xff, 0x63, 0x19, 0xe4, 0x01, 0xd4, 0xa3, 0xfe, 0x17, 0x6c, 0xc5, 0xef, + 0x00, 0xff, 0xff, 0x50, 0x26, 0x36, 0x85, 0x18, 0x70, 0x00, 0x00, 0x00, + 0x00, 0x14, 0x04, 0x8f, 0xf8, 0x22, 0x07, 0x1f, 0x1a, 0xff, 0xff, 0x35, + 0x1c, 0xd4, 0xa4, 0x20, 0x80, 0x9f, 0x66, 0xfa, 0x01, 0x75, 0x23, 0x11, + 0x00, 0xaf, 0xfb, 0x20, 0x16, 0x79, 0xcf, 0x70, 0x1f, 0x01, 0xfb, 0x1f, + 0x26, 0x46, 0xff, 0xff, 0x26, 0x26, 0x84, 0xc6, 0xff, 0xff, 0x36, 0x16, + 0x66, 0x80, 0x36, 0x00, 0x43, 0x46, 0xbf, 0xff, 0xff, 0xfb, 0x44, 0x54, + 0x01, 0x42, 0x42, 0x2f, 0xfa, 0x1f, 0xb2, 0x53, 0x19, 0xc0, 0x26, 0xc6, + 0xff, 0xf6, 0x2f, 0x50, 0x12, 0x7d, 0x01, 0xfe, 0xff, 0xff, 0xec, 0xb8, + 0x31, 0x19, 0x1e, 0x00, 0xc8, 0x8b, 0xf6, 0x1f, 0xf6, 0x2f, 0xf4, 0x72, + 0x1a, 0x8f, 0xff, 0x35, 0x6e, 0x2a, 0xfe, 0x02, 0xf5, 0x00, 0x06, 0x20, + 0x87, 0x43, 0x03, 0x33, 0x23, 0x34, 0x20, 0x00, 0x4b, 0x27, 0xff, 0xff, + 0xc0, 0x9f, 0xf2, 0x03, 0x3f, 0xf4, 0x8a, 0x0b, 0xff, 0x35, 0x67, 0x1e, + 0x00, 0xf3, 0x38, 0x02, 0xff, 0xf1, 0x1c, 0xc6, 0x09, 0x08, 0xad, 0xe7, + 0x43, 0x3a, 0x1f, 0xff, 0xa0, 0x4f, 0x01, 0xf0, 0x2f, 0xf3, 0x8f, 0x80, + 0x4a, 0x17, 0x6f, 0x80, 0x26, 0xf4, 0x5a, 0x04, 0xff, 0x41, 0xff, 0xfa, + 0x02, 0x13, 0x43, 0x4a, 0xba, 0x42, 0x6f, 0x17, 0xf5, 0x00, 0x01, 0x10, + 0x4f, 0xf3, 0x9f, 0xfb, 0x21, 0x3f, 0xc0, 0x77, 0x2e, 0xf8, 0x01, 0x05, + 0xff, 0x90, 0x8f, 0x01, 0xff, 0xdd, 0xdd, 0x70, 0x2f, 0xf7, 0x07, 0x17, + 0x03, 0xfc, 0x40, 0x35, 0x2f, 0xa1, 0xdf, 0x8f, 0x47, 0x80, 0x31, 0x14, + 0x03, 0xff, 0xf9, 0x11, 0xaf, 0xff, 0x04, 0xff, 0x90, 0x0b, 0xb0, 0x08, + 0x07, 0xff, 0xfb, 0x1c, 0xf3, 0x0d, 0x81, 0x97, 0x4f, 0x02, 0x27, 0x30, + 0x00, 0xcf, 0xff, 0xf5, 0x12, 0x32, 0x33, 0x10, 0x12, 0x20, 0x00, 0x4e, + 0x07, 0xff, 0xff, 0xc0, 0x00, 0x08, 0xe0, 0x97, 0x4f, 0x02, 0x82, 0x60, + 0x8f, 0xff, 0xff, 0x03, 0xe9, 0x9a, 0xa9, 0x86, 0x8d, 0x9b, 0x07, 0x01, + 0x1c, 0xf8, 0x73, 0x5f, 0x8f, 0x47, 0x02, 0xf1, 0x21, 0x7c, 0x2f, 0x3f, + 0x07, 0x77, 0x2f, 0x07, 0xf3, 0x68, 0x7c, 0x0f, 0x07, 0x07, 0x77, 0x2f, + 0x07, 0xf6, 0x4c, 0x7c, 0x1e, 0x07, 0x07, 0x77, 0x2f, 0x07, 0xf9, 0x02, + 0x7c, 0x1f, 0x07, 0x07, 0x77, 0x2f, 0x07, 0xf8, 0x24, 0x7c, 0x1f, 0x07, + 0x07, 0x77, 0x2f, 0x07, 0xf4, 0x56, 0x7c, 0x3f, 0x07, 0x07, 0x77, 0x2f, + 0x07, 0xf1, 0x62, 0x7c, 0xaf, 0x07, 0x07, 0x77, 0x2f, 0x07, 0x71, 0x03, + 0xf8, 0x07, 0x07, 0x77, 0x2f, 0x07, 0xfa, 0x12, 0x0c, 0xf8, 0x07, 0x07, + 0x77, 0x2f, 0x04, 0xfe, 0xff, 0xff, 0x1f, 0x50, 0x01, 0xbf, 0x07, 0x07, + 0x77, 0x2f, 0x06, 0x1f, 0xf5, 0x00, 0x2c, 0x07, 0x07, 0x77, 0x2f, 0x07, + 0x3e, 0xf1, 0x05, 0x07, 0x07, 0x77, 0x2f, 0x07, 0xff, 0x3f, 0xf8, 0x6f, + 0x07, 0x07, 0x77, 0x2f, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0xf0, 0x07, 0x07, 0x07, 0x07, +}; + +const uint8_t *g_ppui8Image_Splash[] = +{ + g_pui8Image_Splash1, g_pui8Image_Splash2, g_pui8Image_Splash3, + g_pui8Image_Splash4, g_pui8Image_Splash5 +}; diff --git a/boards/ek-lm4f232/qs-logger/images.h b/boards/ek-lm4f232/qs-logger/images.h new file mode 100644 index 0000000..b100571 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/images.h @@ -0,0 +1,37 @@ +//***************************************************************************** +// +// images.h - Header file for graphics images. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __IMAGES_H__ +#define __IMAGES_H__ + +//***************************************************************************** +// +// Prototypes for the globals exported by this driver. +// +//***************************************************************************** +extern const uint8_t g_pui8Image_TI_Black[]; +extern const uint8_t *g_ppui8Image_Splash[]; + +#endif // __IMAGES_H__ + diff --git a/boards/ek-lm4f232/qs-logger/menus.c b/boards/ek-lm4f232/qs-logger/menus.c new file mode 100644 index 0000000..1cf790e --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/menus.c @@ -0,0 +1,704 @@ +//***************************************************************************** +// +// menus.c - Application menus definition and supporting functions. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** +#include +#include +#include +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "grlib/canvas.h" +#include "utils/ustdlib.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/slidemenuwidget.h" +#include "drivers/stripchartwidget.h" +#include "utils/ustdlib.h" +#include "stripchartmanager.h" +#include "clocksetwidget.h" +#include "qs-logger.h" +#include "acquire.h" +#include "menus.h" + +//***************************************************************************** +// +// This is the menus module of the data logger example application. It +// contains the definitions of all the menus that are used by the application +// and provides some helper functions. +// +//***************************************************************************** + +//***************************************************************************** +// +// Define two offscreen buffers and display structures. These are used for +// off-screen drawing for animation effects. Only limited colors are needed +// so 4bpp buffers are used to save memory. +// +//***************************************************************************** +#define OFFSCREEN_BUF_SIZE GrOffScreen4BPPSize(96, 64) +uint8_t g_pui8OffscreenBufA[OFFSCREEN_BUF_SIZE]; +uint8_t g_pui8OffscreenBufB[OFFSCREEN_BUF_SIZE]; +tDisplay g_sOffscreenDisplayA; +tDisplay g_sOffscreenDisplayB; + +//***************************************************************************** +// +// Create a palette that is used by the on-screen menus and anything else that +// uses the (above) off-screen buffers. This palette should contain any +// colors that are used by any widget using the offscreen buffers. There can +// be up to 16 colors in this palette. +// The numerical values of colors in the list below were selected as colors +// that produced good results on the display and did not already have named +// values. +// +//***************************************************************************** +uint32_t g_pui32Palette[] = +{ + ClrBlack, + ClrWhite, + ClrDarkBlue, + ClrLightBlue, + ClrRed, + ClrDarkGreen, + ClrYellow, + ClrBlue, + ClrGreen, + 0x000040, + ClrLime, + ClrAqua, + 0x004000, + ClrFuchsia, + 0xC00040, + 0x60E080, +}; +#define NUM_PALETTE_ENTRIES (sizeof(g_pui32Palette) / sizeof(uint32_t)) + +//***************************************************************************** +// +// Define the length of text strings used for holding data values. +// +//***************************************************************************** +#define TEXT_FIELD_LENGTH 20 + +//***************************************************************************** +// +// Defines a set of text fields that are used by various widgets for dynamic +// updating of text. +// +//***************************************************************************** +static char g_pcTextFields[NUM_TEXT_ITEMS][TEXT_FIELD_LENGTH]; + +//***************************************************************************** +// +// Defines a set of canvas widgets that are used for showing the temperature +// on a simple screen with an outline and a title. +// +//***************************************************************************** +tCanvasWidget g_sTempContainerCanvas; +Canvas(g_sTempExtValueCanvas, &g_sTempContainerCanvas, 0, 0, + &g_sCFAL96x64x16, 0, 44, 96, 20, (CANVAS_STYLE_OUTLINE | + CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_EXTTEMP], 0, 0); +Canvas(g_sTempIntValueCanvas, &g_sTempContainerCanvas, &g_sTempExtValueCanvas, + 0, &g_sCFAL96x64x16, 0, 24, 96, 20, (CANVAS_STYLE_OUTLINE | + CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_INTTEMP], 0, 0); +Canvas(g_sTempTitleCanvas, &g_sTempContainerCanvas, &g_sTempIntValueCanvas, 0, + &g_sCFAL96x64x16, 0, 0, 96, 24, (CANVAS_STYLE_OUTLINE | + CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, "TEMPERATURE", 0, 0); +Canvas(g_sTempContainerCanvas, 0, 0, &g_sTempTitleCanvas, &g_sCFAL96x64x16, 0, + 0, 96, 64, 0, ClrDarkBlue, ClrWhite, ClrWhite, 0, 0, 0, 0); + +//***************************************************************************** +// +// Defines a set of canvas widgets that are used for showing the accelerometer +// data on a simple screen with an outline and a title. +// +//***************************************************************************** +tCanvasWidget g_sAccelContainerCanvas; +Canvas(g_sAccelZCanvas, &g_sAccelContainerCanvas, 0, 0, &g_sCFAL96x64x16, 0, + 48, 96, 16, (CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_ACCELZ], 0, 0); +Canvas(g_sAccelYCanvas, &g_sAccelContainerCanvas, &g_sAccelZCanvas, 0, + &g_sCFAL96x64x16, 0, 32, 96, 16, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_ACCELY], 0, 0); +Canvas(g_sAccelXCanvas, &g_sAccelContainerCanvas, &g_sAccelYCanvas, 0, + &g_sCFAL96x64x16, 0, 16, 96, 16, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_ACCELX], 0, 0); +Canvas(g_sAccelTitleCanvas, &g_sAccelContainerCanvas, &g_sAccelXCanvas, 0, + &g_sCFAL96x64x16, 0, 0, 96, 16, (CANVAS_STYLE_OUTLINE | + CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, "ACCEL", 0, 0); +Canvas(g_sAccelContainerCanvas, 0, 0, &g_sAccelTitleCanvas, &g_sCFAL96x64x16, + 0, 0, 96, 64, 0, ClrDarkBlue, ClrWhite, ClrWhite, 0, 0, 0, 0); + +//***************************************************************************** +// +// Defines a set of canvas widgets that are used for showing the analog input +// data on a simple screen with no decorations. +// +//***************************************************************************** +tCanvasWidget g_sAINContainerCanvas; +Canvas(g_sAIN3Canvas, &g_sAINContainerCanvas, 0, 0, &g_sCFAL96x64x16, 0, 48, + 96, 16, (CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | CANVAS_STYLE_TEXT_VCENTER), + ClrDarkGreen, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_USER3], 0, 0); +Canvas(g_sAIN2Canvas, &g_sAINContainerCanvas, &g_sAIN3Canvas, 0, + &g_sCFAL96x64x16, 0, 32, 96, 16, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkGreen, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_USER2], 0, 0); +Canvas(g_sAIN1Canvas, &g_sAINContainerCanvas, &g_sAIN2Canvas, 0, + &g_sCFAL96x64x16, 0, 16, 96, 16, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkGreen, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_USER1], 0, 0); +Canvas(g_sAIN0Canvas, &g_sAINContainerCanvas, &g_sAIN1Canvas, 0, + &g_sCFAL96x64x16, 0, 0, 96, 16, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkGreen, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_USER0], 0, 0); +Canvas(g_sAINContainerCanvas, 0, 0, &g_sAIN0Canvas, &g_sCFAL96x64x16, 0, 0, 96, + 64, 0, ClrDarkGreen, ClrWhite, ClrWhite, 0, 0, 0, 0); + +//***************************************************************************** +// +// Defines a set of canvas widgets that are used for showing the current +// on a simple screen with an outline and a title. +// +//***************************************************************************** +tCanvasWidget g_sCurrentContainerCanvas; +Canvas(g_sCurrentValueCanvas, &g_sCurrentContainerCanvas, 0, 0, + &g_sCFAL96x64x16, 0, 24, 96, 40, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrBlack, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[LOG_ITEM_CURRENT], 0, 0); +Canvas(g_sCurrentTitleCanvas, &g_sCurrentContainerCanvas, + &g_sCurrentValueCanvas, 0, &g_sCFAL96x64x16, 0, 0, 96, 24, + (CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | CANVAS_STYLE_TEXT_VCENTER), + ClrBlack, ClrWhite, ClrWhite, &g_sFontFixed6x8, "CURRENT", 0, 0); +Canvas(g_sCurrentContainerCanvas, 0, 0, &g_sCurrentTitleCanvas, + &g_sCFAL96x64x16, 0, 0, 96, 64, 0, ClrBlack, ClrWhite, ClrWhite, 0, 0, + 0, 0); + +//***************************************************************************** +// +// Defines a set of canvas widgets that are used for showing the clock date +// and time. +// +//***************************************************************************** +tCanvasWidget g_sClockContainerCanvas; +Canvas(g_sClockTimeCanvas, &g_sClockContainerCanvas, 0, 0, &g_sCFAL96x64x16, 0, + 38, 96, 16, (CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[TEXT_ITEM_TIME], 0, 0); +Canvas(g_sClockDateCanvas, &g_sClockContainerCanvas, &g_sClockTimeCanvas, + 0, &g_sCFAL96x64x16, 0, 22, 96, 16, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[TEXT_ITEM_DATE], 0, 0); +Canvas(g_sClockTitleCanvas, &g_sClockContainerCanvas, &g_sClockDateCanvas, 0, + &g_sCFAL96x64x16, 0, 0, 96, 16, (CANVAS_STYLE_OUTLINE | + CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrDarkBlue, ClrWhite, ClrWhite, &g_sFontFixed6x8, "CLOCK", 0, 0); +Canvas(g_sClockContainerCanvas, 0, 0, &g_sClockTitleCanvas, &g_sCFAL96x64x16, + 0, 0, 96, 64, CANVAS_STYLE_OUTLINE, ClrDarkBlue, ClrWhite, ClrWhite, 0, + 0, 0, 0); + +//***************************************************************************** +// +// Defines a set of canvas widgets that are used for showing a status +// screen. It is a simple canvas container that can show a title and 3 +// lines of text. +// +//***************************************************************************** +tCanvasWidget g_sStatusContainerCanvas; +Canvas(g_sStatus3Canvas, &g_sStatusContainerCanvas, 0, 0, &g_sCFAL96x64x16, 1, + 48, 94, 12, (CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrRed, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[TEXT_ITEM_STATUS3], 0, 0); +Canvas(g_sStatus2Canvas, &g_sStatusContainerCanvas, &g_sStatus3Canvas, 0, + &g_sCFAL96x64x16, 1, 30, 94, 12, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_FILL | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrRed, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[TEXT_ITEM_STATUS2], 0, 0); +Canvas(g_sStatus1Canvas, &g_sStatusContainerCanvas, &g_sStatus2Canvas, 0, + &g_sCFAL96x64x16, 1, 18, 94, 12, (CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_FILL | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrRed, ClrWhite, ClrWhite, &g_sFontFixed6x8, + g_pcTextFields[TEXT_ITEM_STATUS1], 0, 0); +Canvas(g_sStatusTitleCanvas, &g_sStatusContainerCanvas, &g_sStatus1Canvas, 0, + &g_sCFAL96x64x16, 0, 0, 96, 16, (CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE | + CANVAS_STYLE_TEXT_HCENTER | + CANVAS_STYLE_TEXT_VCENTER), + ClrWhite, ClrWhite, ClrBlack, &g_sFontFixed6x8, + g_pcTextFields[TEXT_ITEM_STATUS_TITLE], 0, 0); +Canvas(g_sStatusContainerCanvas, 0, 0, &g_sStatusTitleCanvas, &g_sCFAL96x64x16, + 0, 0, 96, 64, CANVAS_STYLE_OUTLINE, ClrRed, ClrWhite, ClrWhite, 0, 0, 0, + 0); + +//***************************************************************************** +// +// Allocate space for a time structure that is used with the clock setting +// widget. +// +//***************************************************************************** +struct tm g_sTimeClock; + +//***************************************************************************** +// +// Define a clock setting widget. It is used to allow the user to set the +// RTC (real time clock). +// +//***************************************************************************** +ClockSet(g_sClockSetter, 0, 0, 0, &g_sCFAL96x64x16, 0, 0, 96, 64, + g_psFontFixed6x8, ClrWhite, ClrDarkGreen, &g_sTimeClock, 0); + +//***************************************************************************** +// +// Define the main (root) menu. +// +//***************************************************************************** +tSlideMenu g_sConfigMenu; +tSlideMenu g_sViewMenu; +tSlideMenu g_sConfirmMenu; +tSlideMenuItem g_psMainMenuItems[] = +{ + {"CONFIG", &g_sConfigMenu, 0, 0}, + {"START", 0, &g_sStripChart.sBase, ClrBlack}, + {"VIEW", &g_sViewMenu, 0, 0}, + {"SAVE", 0, &g_sStatusContainerCanvas.sBase, ClrRed}, + {"ERASE", &g_sConfirmMenu, 0, 0} +}; +tSlideMenu g_psMainMenu = +{ + 0, (sizeof(g_psMainMenuItems) / sizeof(tSlideMenuItem)), g_psMainMenuItems, + 0, 0, 0, 0 +}; + +//***************************************************************************** +// +// Define the configuration (CONFIG) sub-menu. +// +// (root)-->CONFIG +// +//***************************************************************************** +tSlideMenu g_sChannelsMenu; +tSlideMenu g_sPeriodMenu; +tSlideMenu g_sStorageMenu; +tSlideMenu g_sSleepMenu; +tSlideMenuItem g_psConfigMenuItems[] = +{ + {"CHANNELS", &g_sChannelsMenu, 0, 0}, {"PERIOD", &g_sPeriodMenu, 0, 0}, + {"STORAGE", &g_sStorageMenu, 0, 0}, {"SLEEP", &g_sSleepMenu, 0, 0}, + {"CLOCK", 0, &g_sClockSetter.sBase, ClrDarkGreen} +}; +tSlideMenu g_sConfigMenu = +{ + &g_psMainMenu, (sizeof(g_psConfigMenuItems) / sizeof(tSlideMenuItem)), + g_psConfigMenuItems, 0, 0, 0, 0 +}; + +//***************************************************************************** +// +// Define the channel selection sub-menu. +// +// (root)-->CONFIG-->CHANNELS +// +//***************************************************************************** +tSlideMenuItem g_psChannelsMenuItems[] = +{ + {"CHAN 0", 0, 0, 0}, {"CHAN 1", 0, 0, 0}, {"CHAN 2", 0, 0, 0}, + {"CHAN 3", 0, 0, 0}, {"ACCEL X", 0, 0, 0}, {"ACCEL Y", 0, 0, 0}, + {"ACCEL Z", 0, 0, 0}, {"EXT TEMP", 0, 0, 0}, {"INT TEMP", 0, 0, 0}, + {"CURRENT", 0, 0, 0}, +}; +tSlideMenu g_sChannelsMenu = +{ + &g_sConfigMenu, (sizeof(g_psChannelsMenuItems) / sizeof(tSlideMenuItem)), + g_psChannelsMenuItems, 0, 0, 1, 0 +}; + +//***************************************************************************** +// +// Define the logging period sub-menu. +// +// (root)-->CONFIG-->PERIOD +// +//***************************************************************************** +#define MENU_CONFIG_PERIOD_DEFAULT 3 +tSlideMenuItem g_psPeriodMenuItems[] = +{ + {"1/32 sec", 0, 0, 0}, {"1/16 sec", 0, 0, 0}, {"1/8 sec", 0, 0, 0}, + {"1/4 sec", 0, 0, 0}, {"1/2 sec", 0, 0, 0}, {"1 sec", 0, 0, 0}, + {"5 sec", 0, 0, 0}, {"10 sec", 0, 0, 0}, {"1 min", 0, 0, 0}, + {"5 min", 0, 0, 0}, {"10 min", 0, 0, 0}, {"1 hour", 0, 0, 0}, + {"5 hour", 0, 0, 0}, {"10 hour", 0, 0, 0}, {"1 day", 0, 0, 0}, +}; +tSlideMenu g_sPeriodMenu = +{ + &g_sConfigMenu, (sizeof(g_psPeriodMenuItems) / sizeof(tSlideMenuItem)), + g_psPeriodMenuItems, 0, 0, 0, 0 +}; + +//***************************************************************************** +// +// Maps items from the period menu to match values for RTC. Lower 8 bits +// is subsecond value, upper 24 bits is seconds. The lower 8 bits represent +// subseconds in 7 bits, right-justififed. So 0x01 is 1/128 of a second. +// The order of the values here needs to match what appears in the PERIOD +// menu in menus.c. +// +//***************************************************************************** +static uint32_t g_pui32LogPeriod[] = +{ + 0x00000004, // 1/32 + 0x00000008, // 1/16 + 0x00000010, // 1/8 + 0x00000020, // 1/4 + 0x00000040, // 1/2 + 0x00000100, // 1s + 0x00000500, // 5s + 0x00000A00, // 10s + 0x00003C00, // 1m - 60s + 0x00012C00, // 5m - 300s + 0x00025800, // 10m - 600s + 0x000E1000, // 1hr - 3600s + 0x00465000, // 5hr - 18000s + 0x008CA000, // 10hr - 36000s + 0x01518000, // 1d - 86400s +}; + +//***************************************************************************** +// +// Define the storage options sub-menu. +// +// (root)-->CONFIG-->STORAGE +// +//***************************************************************************** +tSlideMenuItem g_psStorageMenuItems[] = +{ + {"NONE", 0, 0, 0}, {"USB", 0, 0, 0}, {"HOST PC", 0, 0, 0}, + {"FLASH", 0, 0, 0}, +}; +tSlideMenu g_sStorageMenu = +{ + &g_sConfigMenu, (sizeof(g_psStorageMenuItems) / sizeof(tSlideMenuItem)), + g_psStorageMenuItems, 0, 0, 0, 0 +}; + +//***************************************************************************** +// +// Define the sleep option sub-menu. +// +// (root)-->CONFIG-->SLEEP +// +//***************************************************************************** +tSlideMenuItem g_psSleepMenuItems[] = +{ + {"NO", 0, 0, 0}, {"YES", 0, 0, 0}, +}; + +tSlideMenu g_sSleepMenu = +{ + &g_sConfigMenu, (sizeof(g_psSleepMenuItems) / sizeof(tSlideMenuItem)), + g_psSleepMenuItems, 0, 0, 0, 0 +}; + +//***************************************************************************** +// +// Define the view options sub-menu. +// +// (root)-->VIEW +// +//***************************************************************************** +tSlideMenuItem g_psViewMenuItems[] = +{ + {"AIN0-3", 0, (tWidget *)&g_sAINContainerCanvas, ClrDarkGreen}, + {"ACCEL", 0, (tWidget *)&g_sAccelContainerCanvas, ClrDarkBlue}, + {"TEMPERATURE", 0, (tWidget *)&g_sTempContainerCanvas, ClrDarkBlue}, + {"CURRENT", 0, (tWidget *)&g_sCurrentContainerCanvas, ClrBlack}, + {"CLOCK", 0, &g_sClockContainerCanvas.sBase, ClrDarkBlue}, + {"FLASH SPACE", 0, &g_sStatusContainerCanvas.sBase, ClrRed}, +}; +tSlideMenu g_sViewMenu = +{ + &g_psMainMenu, (sizeof(g_psViewMenuItems) / sizeof(tSlideMenuItem)), + g_psViewMenuItems, 0, 0, 0, 0 +}; + +//***************************************************************************** +// +// Define the ERASE confirmation menu. +// +// (root)-->ERASE +// +//***************************************************************************** +tSlideMenuItem g_sConfirmMenuItems[] = +{ + {"ERASE DATA?", 0, &g_sStatusContainerCanvas.sBase, ClrRed}, +}; +tSlideMenu g_sConfirmMenu = +{ + &g_psMainMenu, (sizeof(g_sConfirmMenuItems) / sizeof(tSlideMenuItem)), + g_sConfirmMenuItems, 0, 0, 0, 0 +}; + +//***************************************************************************** +// +// Define the slide menu widget. This is the wigdet that controls and +// displays all the above menus. +// +//***************************************************************************** +SlideMenu(g_sMenuWidget, WIDGET_ROOT, 0, 0, &g_sCFAL96x64x16, 0, 0, 96, 64, + &g_sOffscreenDisplayA, &g_sOffscreenDisplayB, 16, ClrWhite, ClrRed, + ClrBlack, &g_sFontFixed6x8, &g_psMainMenu, 0); + +//***************************************************************************** +// +// This function allows dynamic text fields to be updated. +// +//***************************************************************************** +void +MenuUpdateText(uint32_t ui32TextID, const char *pcText) +{ + // + // If the text field ID is valid, then update the string for that text + // field. The next time the associated widget is painted, the new text + // will be shown. + // + if(ui32TextID < NUM_TEXT_ITEMS) + { + usnprintf(g_pcTextFields[ui32TextID], TEXT_FIELD_LENGTH, "%s", pcText); + } +} + +//***************************************************************************** +// +// Get the state defined by the configuration menu items. +// This function will query the configuration menus to determine the current +// choices for channels, period, etc. These will be stored in the structure +// that was passed to the function. +// +//***************************************************************************** +void +MenuGetState(tConfigState *psState) +{ + int32_t ui32Temp; + + // + // Check the arguments + // + ASSERT(psState); + + if(!psState) + { + return; + } + + // + // Read the various configuration menus and store their state + // + if(SlideMenuFocusItemGet(&g_sSleepMenu) > 0) + { + psState->bSleep = true; + } + else + { + psState->bSleep = false; + } + ui32Temp = SlideMenuFocusItemGet(&g_sStorageMenu);; + psState->ui8Storage = (uint8_t)ui32Temp; + ui32Temp = SlideMenuSelectedGet(&g_sChannelsMenu); + psState->ui16SelectedMask = (uint16_t)ui32Temp; + ui32Temp = g_pui32LogPeriod[SlideMenuFocusItemGet(&g_sPeriodMenu)]; + psState->ui32Period = ui32Temp; +} + +//***************************************************************************** +// +// Set the configuration menu state. +// This function is used to set the state of the configuration menus. This +// is used to "remember" a prior setting when the application is restarted +// or wakes from sleep. +// +//***************************************************************************** +void +MenuSetState(tConfigState *psState) +{ + uint32_t ui32Idx; + + // + // Check the parameters + // + ASSERT(psState); + ASSERT(psState->ui8Storage < CONFIG_STORAGE_CHOICES); + ASSERT(psState->ui32Period & (psState->ui32Period < 0x2000000)); + + // + // Update each configuration menu item to match the new state + // + SlideMenuFocusItemSet(&g_sSleepMenu, psState->bSleep); + SlideMenuFocusItemSet(&g_sStorageMenu, psState->ui8Storage); + SlideMenuSelectedSet(&g_sChannelsMenu, psState->ui16SelectedMask); + + // + // For the period, search the values table to find the index + // + for(ui32Idx = 0; ui32Idx < (sizeof(g_pui32LogPeriod) / sizeof(uint32_t)); + ui32Idx++) + { + if(psState->ui32Period == g_pui32LogPeriod[ui32Idx]) + { + SlideMenuFocusItemSet(&g_sPeriodMenu, ui32Idx); + + // + // Everything has been updated now so return to caller + // + return; + } + } + + // + // If we get to this point, that means that there was no match for the + // period. In that case, set it to default value. + // + SlideMenuFocusItemSet(&g_sPeriodMenu, MENU_CONFIG_PERIOD_DEFAULT); + psState->ui32Period = g_pui32LogPeriod[MENU_CONFIG_PERIOD_DEFAULT]; +} + +//***************************************************************************** +// +// Set the default values for the menu configuration. +// This function is used to initialize the application state configuration with +// some default values for the menu settings. +// +//***************************************************************************** +void +MenuGetDefaultState(tConfigState *psState) +{ + // + // Check the parameters. + // + ASSERT(psState); + + // + // Set default values for all the menu items + // + if(psState) + { + psState->bSleep = false; + psState->ui8Storage = CONFIG_STORAGE_NONE; + psState->ui16SelectedMask = 0; + psState->ui32Period = 0x00000100; // 1 second + } +} + +//***************************************************************************** +// +// Initialize the offscreen buffers and the menu structure. This should be +// called before using the application menus. +// The parameter is a function pointer to a callback function whenever the +// menu widget activates or deactivates a child widget. +// +//***************************************************************************** +void +MenuInit(void (*pfnActive)(tWidget *, tSlideMenuItem *, bool)) +{ + uint32_t ui32Idx; + + // + // Initialize two offscreen displays and assign the palette. These + // buffers are used by the slide menu widget and other parts of the + // application to allow for animation effects. + // + GrOffScreen4BPPInit(&g_sOffscreenDisplayA, g_pui8OffscreenBufA, 96, 64); + GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayA, g_pui32Palette, 0, + NUM_PALETTE_ENTRIES); + GrOffScreen4BPPInit(&g_sOffscreenDisplayB, g_pui8OffscreenBufB, 96, 64); + GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayB, g_pui32Palette, 0, + NUM_PALETTE_ENTRIES); + + // + // Initialize each of the text fields with a "blank" indication. + // + for(ui32Idx = 0; ui32Idx < NUM_LOG_ITEMS; ui32Idx++) + { + usnprintf(g_pcTextFields[ui32Idx], TEXT_FIELD_LENGTH, "----"); + } + + // + // Set the slide menu widget callback function. + // + SlideMenuActiveCallbackSet(&g_sMenuWidget, pfnActive); +} diff --git a/boards/ek-lm4f232/qs-logger/menus.h b/boards/ek-lm4f232/qs-logger/menus.h new file mode 100644 index 0000000..c961462 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/menus.h @@ -0,0 +1,83 @@ +//***************************************************************************** +// +// menus.h - Prototypes and definitions for application menus. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __MENUS_H__ +#define __MENUS_H__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Declare off-screen displays, buffers and menus for access by the rest of the +// application. +// +//***************************************************************************** +extern uint8_t g_pui8OffscreenBufA[]; +extern uint8_t g_pui8OffscreenBufB[]; +extern tDisplay g_sOffscreenDisplayA; +extern tDisplay g_sOffscreenDisplayB; +extern tSlideMenuWidget g_sMenuWidget; +extern tStripChartWidget g_sStripChart; +extern tSlideMenu g_sChannelsMenu; +extern tSlideMenu g_sPeriodMenu; +extern tCanvasWidget g_sAINContainerCanvas; +extern tCanvasWidget g_sAccelContainerCanvas; +extern tCanvasWidget g_sTempContainerCanvas; +extern tCanvasWidget g_sCurrentContainerCanvas; +extern tCanvasWidget g_sClockContainerCanvas; +extern tCanvasWidget g_sStatusContainerCanvas; +extern tClockSetWidget g_sClockSetter; +extern struct tm g_sTimeClock; + +//***************************************************************************** +// +// Module function prototypes. +// +//***************************************************************************** +extern void MenuInit(void (*pfnActive)(tWidget *, tSlideMenuItem *, bool)); +extern void MenuUpdateText(uint32_t ui32TextID, const char *pcText); +extern void MenuGetState(tConfigState *pState); +extern void MenuSetState(tConfigState *pState); +extern void MenuGetDefaultState(tConfigState *pState); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.c b/boards/ek-lm4f232/qs-logger/qs-logger.c new file mode 100644 index 0000000..e3e7390 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.c @@ -0,0 +1,1260 @@ +//***************************************************************************** +// +// qs-logger.c - Data logger Quickstart application for EK-LM4F232. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include +#include "driverlib/adc.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/hibernate.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom.h" +#include "driverlib/rom_map.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/uart.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "grlib/canvas.h" +#include "inc/hw_gpio.h" +#include "inc/hw_hibernate.h" +#include "inc/hw_memmap.h" +#include "inc/hw_sysctl.h" +#include "inc/hw_types.h" +#include "usblib/usblib.h" +#include "utils/ustdlib.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/buttons.h" +#include "drivers/slidemenuwidget.h" +#include "drivers/stripchartwidget.h" +#include "clocksetwidget.h" +#include "qs-logger.h" +#include "images.h" +#include "menus.h" +#include "acquire.h" +#include "usbstick.h" +#include "usbserial.h" +#include "flashstore.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Data Logger (qs-logger)

+//! +//! This example application is a data logger. It can be configured to collect +//! data from up to 10 data sources. The possible data sources are: +//! - 4 analog inputs, 0-20V +//! - 3-axis accelerometer +//! - internal and external temperature sensors +//! - processor current consumption +//! +//! The data logger provides a menu navigation that is operated by the buttons +//! on the EK-LM4F232 board (up, down, left, right, select). The data logger +//! can be configured by using the menus. The following items can be +//! configured: +//! - data sources to be logged +//! - sample rate +//! - storage location +//! - sleep modes +//! - clock +//! +//! Using the data logger: +//! +//! Use the CONFIG menu to configure the data logger. The following choices +//! are provided: +//! +//! - CHANNELS - enable specific channels of data that will be logged +//! - PERIOD - select the sample period +//! - STORAGE - select where the collected data will be stored: +//! - FLASH - stored in the internal flash memory +//! - USB - stored on a connected USB memory stick +//! - HOST PC - transmitted to a host PC via USB OTG virtual serial port +//! - NONE - the data will only be displayed and not stored +//! - SLEEP - select whether or not the board sleeps between samples. Sleep +//! mode is allowed when storing to flash at with a period of 1 second or +//! longer. +//! - CLOCK - allows setting of internal time-of-day clock that is used for +//! time stamping of the sampled data +//! +//! Use the START menu to start the data logger running. It will begin +//! collecting and storing the data. It will continue to collect data until +//! stopped by pressing the left button or select button. +//! +//! While the data logger is collecting data and it is not configured to +//! sleep, a simple strip chart showing the collected data will appear on the +//! display. If the data logger is configured to sleep, then no strip chart +//! will be shown. +//! +//! If the data logger is storing to internal flash memory, it will overwrite +//! the oldest data. If storing to a USB memory device it will store data +//! until the device is full. +//! +//! The VIEW menu allows viewing the values of the data sources in numerical +//! format. When viewed this way the data is not stored. +//! +//! The SAVE menu allows saving data that was stored in internal flash memory +//! to a USB stick. The data will be saved in a text file in CSV format. +//! +//! The ERASE menu is used to erase the internal memory so more data can be +//! saved. +//! +//! When the EK-LM4F232 board running qs-logger is connected to a host PC via +//! the USB OTG connection for the first time, Windows will prompt for a device +//! driver for the board. +//! This can be found in /ti/TivaWare_C_Series-x.x/windows_drivers +//! assuming you installed the software in the default folder. +//! +//! A companion Windows application, logger, can be found in the +//! /ti/TivaWare_C_Series-x.x/tools/bin directory. When the data logger's +//! STORAGE option is set to "HOST PC" and the board is connected to a PC +//! via the USB OTG connection, captured data will be transfered back to the PC +//! using the virtual serial port that the EK board offers. When the logger +//! application is run, it will search for the first connected EK-LM4F232 board +//! and display any sample data received. The application also offers the +//! option to log the data to a file on the PC. +// +//***************************************************************************** + +//***************************************************************************** +// +// The clock rate for the SysTick interrupt and a counter of system clock +// ticks. The SysTick interrupt is used for basic timing in the application. +// +//***************************************************************************** +#define CLOCK_RATE 100 +#define MS_PER_SYSTICK (1000 / CLOCK_RATE) +static volatile uint32_t g_ui32TickCount; +uint32_t g_ui32LastTick = 0; + +//***************************************************************************** +// +// A widget handle of the widget that should receive the focus of any button +// events. +// +//***************************************************************************** +static uint32_t g_ui32KeyFocusWidgetHandle; + +//***************************************************************************** +// +// Tracks the data logging state. +// +//***************************************************************************** +typedef enum +{ + eSTATE_IDLE, + eSTATE_LOGGING, + eSTATE_VIEWING, + eSTATE_SAVING, + eSTATE_ERASING, + eSTATE_FREEFLASH, + eSTATE_CLOCKSET, + eSTATE_CLOCKEXIT, +} tLoggerState; +static tLoggerState g_iLoggerState = eSTATE_IDLE; + +//***************************************************************************** +// +// The configuration of the application. This holds the information that +// will need to be saved if sleeping is used. +// +//***************************************************************************** +static tConfigState g_sConfigState; + +//***************************************************************************** +// +// The current state of USB OTG in the system based on the detected mode. +// +//***************************************************************************** +volatile tUSBMode g_iCurrentUSBMode = eUSBModeNone; + +//***************************************************************************** +// +// The size of the host controller's memory pool in bytes. +// +//***************************************************************************** +#define HCD_MEMORY_SIZE 128 + +//***************************************************************************** +// +// The memory pool to provide to the Host controller driver. +// +//***************************************************************************** +uint8_t g_pui8HCDPool[HCD_MEMORY_SIZE]; + +//***************************************************************************** +// +// Forward declaration of callback function used for clock setter widget. +// +//***************************************************************************** +static void ClockSetOkCallback(tWidget *pWidget, bool bOk); + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Provide a simple function so other parts of the application can update +// a status display. +// +//***************************************************************************** +void +SetStatusText(const char *pcTitle, const char *pcLine1, const char *pcLine2, + const char *pcLine3) +{ + static const char pcBlankLine[] = " "; + + // + // Check to see if each parameter was passed, and if so then update its + // text field on the status dislay. + // + pcTitle = pcTitle ? pcTitle : pcBlankLine; + MenuUpdateText(TEXT_ITEM_STATUS_TITLE, pcTitle); + pcLine1 = pcLine1 ? pcLine1 : pcBlankLine; + MenuUpdateText(TEXT_ITEM_STATUS1, pcLine1); + pcLine2 = pcLine2 ? pcLine2 : pcBlankLine; + MenuUpdateText(TEXT_ITEM_STATUS2, pcLine2); + pcLine3 = pcLine3 ? pcLine3 : pcBlankLine; + MenuUpdateText(TEXT_ITEM_STATUS3, pcLine3); + + // + // Force a repaint after all the status text fields have been updated. + // + WidgetPaint(WIDGET_ROOT); + WidgetMessageQueueProcess(); +} +//***************************************************************************** +// +// Handles the SysTick timeout interrupt. +// +//***************************************************************************** +void +SysTickIntHandler(void) +{ + // + // Increment the tick count. + // + g_ui32TickCount++; +} + +//***************************************************************************** +// +// This function returns the number of ticks since the last time this function +// was called. +// +//***************************************************************************** +uint32_t +GetTickms(void) +{ + uint32_t ui32RetVal, ui32Saved; + + ui32RetVal = g_ui32TickCount; + ui32Saved = ui32RetVal; + + if(ui32Saved > g_ui32LastTick) + { + ui32RetVal = ui32Saved - g_ui32LastTick; + } + else + { + ui32RetVal = g_ui32LastTick - ui32Saved; + } + + // + // This could miss a few milliseconds but the timings here are on a + // much larger scale. + // + g_ui32LastTick = ui32Saved; + + // + // Return the number of milliseconds since the last time this was called. + // + return(ui32RetVal * MS_PER_SYSTICK); +} + +//***************************************************************************** +// +// Callback function for USB OTG mode changes. +// +//***************************************************************************** +static void +ModeCallback(uint32_t ui32Index, tUSBMode iMode) +{ + // + // Save the new mode. + // + g_iCurrentUSBMode = iMode; + + // + // Mode-specific handling code could go here. + // + switch(iMode) + { + case eUSBModeHost: + { + break; + } + case eUSBModeDevice: + { + break; + } + case eUSBModeNone: + { + break; + } + default: + { + break; + } + } +} + +//***************************************************************************** +// +// Gets the logger configuration from battery backed memory. +// The configuration is read from the memory in the Hibernate module. +// It is checked for validity. If found to be valid the function returns a +// 0. If not valid, then it returns non-zero. +// +//***************************************************************************** +static int32_t +GetSavedState(tConfigState *psState) +{ + uint32_t ui32StateLen; + uint16_t ui16Crc16; + + // + // Check the arguments + // + ASSERT(psState); + if(!psState) + { + return(1); + } + + // + // Initialize locals. + // + ui32StateLen = sizeof(tConfigState) / 4; + + // + // Read a block from hibernation memory into the application state + // structure. + // + HibernateDataGet((uint32_t *)psState, ui32StateLen); + + // + // Check first to see if the "cookie" value is correct. + // + if(psState->ui32Cookie != STATE_COOKIE) + { + return(1); + } + + // + // Find the 16-bit CRC of the block. The CRC is stored in the last + // location, so subtract 1 word from the count. + // + ui16Crc16 = ROM_Crc16Array(ui32StateLen - 1, (const uint32_t *)psState); + + // + // If the CRC does not match, then the block is not good. + // + if(psState->ui32Crc16 != (uint32_t)ui16Crc16) + { + return(1); + } + + // + // At this point the state structure that was retrieved from the + // battery backed memory has been validated, so return it as a valid + // logger state configuration. + // + return(0); +} + +//***************************************************************************** +// +// Stores the logger configuration to battery backed memory in the +// Hibernation module. The configuration is saved with a cookie value and +// a CRC in order to ensure validity. +// +//***************************************************************************** +static void +SetSavedState(tConfigState *psState) +{ + uint32_t ui32StateLen; + uint16_t ui16Crc16; + + // + // Check the arguments. + // + ASSERT(psState); + + // + // Initialize locals. + // + ui32StateLen = sizeof(tConfigState) / 4; + + if(psState) + { + // + // Write the cookie value to the block + // + psState->ui32Cookie = STATE_COOKIE; + + // + // Find the 16-bit CRC of the block. The CRC is stored in the last + // location, so subtract 1 word from the count. + // + ui16Crc16 = ROM_Crc16Array(ui32StateLen - 1, + (const uint32_t *)psState); + + // + // Save the computed CRC into the structure. + // + psState->ui32Crc16 = (uint32_t)ui16Crc16; + + // + // Now write the entire block to the Hibernate memory. + // + HibernateDataSet((uint32_t *)psState, ui32StateLen); + } +} + +//***************************************************************************** +// +// Populate the application configuration with default values. +// +//***************************************************************************** +static void +GetDefaultState(tConfigState *psState) +{ + // + // Check the arguments + // + ASSERT(psState); + if(psState) + { + // + // get the default values from the menu system + // + MenuGetDefaultState(psState); + + // + // Set the filename to a null string + // + psState->pcFilename[0] = 0; + + // + // Set bogus address for flash storage + // + psState->ui32FlashStore = 0; + + // + // Turn off sleep logging + // + psState->ui32SleepLogging = 0; + } +} + +//***************************************************************************** +// +// Sends a button press message to whichever widget has the button focus. +// +//***************************************************************************** +static void +SendWidgetKeyMessage(uint32_t ui32Msg) +{ + WidgetMessageQueueAdd(WIDGET_ROOT, ui32Msg, g_ui32KeyFocusWidgetHandle, 0, + 1, 1); +} + +//***************************************************************************** +// +// Callback function from the menu widget. This function is called whenever +// the menu is used to activate a child widget that is associated with the +// menu. It is also called when the widget is deactivated and control is +// returned to the menu widget. It can be used to trigger different actions +// depending on which menus are chosen, and to track the state of the +// application and control focus for the user interface. +// +// This function is called in the context of widget tree message processing +// so care should be taken if doing any operation that affects the display +// or widget tree. +// +//***************************************************************************** +static void +WidgetActivated(tWidget *psWidget, tSlideMenuItem *psMenuItem, bool bActivated) +{ + char *pcMenuText; + uint32_t ui32RTC; + + // + // Handle the activation or deactivation of the strip chart. The strip + // chart widget is activated when the user selects the START menu. + // + if(psWidget == &g_sStripChart.sBase) + { + // + // If the strip chart is activated, start the logger running. + // + if(bActivated) + { + // + // Get the current state of the menus + // + MenuGetState(&g_sConfigState); + + // + // Save the state in battery backed memory + // + SetSavedState(&g_sConfigState); + + // + // Start logger and update the logger state + // + AcquireStart(&g_sConfigState); + g_iLoggerState = eSTATE_LOGGING; + } + else + { + // + // If the strip chart is deactivated, stop the logger. + // + AcquireStop(); + g_iLoggerState = eSTATE_IDLE; + } + } + else if((psWidget == &g_sAINContainerCanvas.sBase) || + (psWidget == &g_sAccelContainerCanvas.sBase) || + (psWidget == &g_sCurrentContainerCanvas.sBase) || + (psWidget == &g_sClockContainerCanvas.sBase) || + (psWidget == &g_sTempContainerCanvas.sBase)) + { + // + // Handle the activation or deactivation of any of the container + // canvas that is used for showing the acquired data as a numerical + // display. This happens when the VIEW menu is used. + // + // A viewer has been activated. + // + if(bActivated) + { + static tConfigState sLocalState; + + // + // Get the current menu configuration state and save it in a local + // storage. + // + MenuGetState(&sLocalState); + + // + // Modify the state to set values that are suitable for using + // with the viewer. The acquisition rate is set to 1/2 second + // and all channels are selected. The storage medium is set to + // "viewer" so the acquistion module will write the value of + // acquired data to the appropriate viewing canvas. + // + sLocalState.ui8Storage = CONFIG_STORAGE_VIEWER; + sLocalState.ui32Period = 0x00000040; + sLocalState.ui16SelectedMask = 0x3ff; + + // + // Start the acquisition module running. + // + AcquireStart(&sLocalState); + g_iLoggerState = eSTATE_VIEWING; + } + else + { + // + // The viewer has been deactivated so turn off the acquisition + // module. + // + AcquireStop(); + g_iLoggerState = eSTATE_IDLE; + } + } + else if(psWidget == &g_sStatusContainerCanvas.sBase) + { + // + // Handle the case when a status display has been activated. This can + // occur when any of several menu items are selected. + // + // Get pointer to the text of the current menu item. + // + if(psMenuItem) + { + pcMenuText = psMenuItem->pcText; + } + else + { + return; + } + + // + // If activated from the SAVE menu, then the flash data needs to be + // saved to USB stick. Enter the saving state. + // + if(!strcmp(pcMenuText, "SAVE")) + { + if(bActivated) + { + g_iLoggerState = eSTATE_SAVING; + } + else + { + g_iLoggerState = eSTATE_IDLE; + } + } + else if(!strcmp(pcMenuText, "ERASE DATA?")) + { + // + // If activated from the ERASE menu, then the flash data needs to + // be erased. Enter the erasing state. + // + if(bActivated) + { + g_iLoggerState = eSTATE_ERASING; + } + else + { + g_iLoggerState = eSTATE_IDLE; + } + } + else if(!strcmp(pcMenuText, "FLASH SPACE")) + { + // + // If activated from the FLASH SPACE menu, then the user will be + // shown a report on the amount of free space in flash. Enter the + // reporting state. + // + if(bActivated) + { + g_iLoggerState = eSTATE_FREEFLASH; + } + else + { + g_iLoggerState = eSTATE_IDLE; + } + } + } + else if(psWidget == &g_sClockSetter.sBase) + { + // + // Handle the activation of the clock setting widget. Deactivation is + // handled through a separate callback. + // + // If the clock setter is activated, load the time structure fields. + // + if(bActivated) + { + // + // Get the current time in seconds from the RTC. + // + ui32RTC = HibernateRTCGet(); + + // + // Convert the RTC time to a time structure. + // + ulocaltime(ui32RTC, &g_sTimeClock); + + // + // Set the callback that will be called when the clock setting + // widget is deactivated. Since the clock setting widget needs + // to take over the focus for button events, it uses a separate + // callback when it is finsihed. + // + ClockSetCallbackSet((tClockSetWidget *)psWidget, + ClockSetOkCallback); + + // + // Give the clock setter widget focus for the button events + // + g_ui32KeyFocusWidgetHandle = (uint32_t)psWidget; + g_iLoggerState = eSTATE_CLOCKSET; + } + } +} + +//***************************************************************************** +// +// This function is called when the user clicks OK or CANCEL in the clock +// setting widget. +// +//***************************************************************************** +static void +ClockSetOkCallback(tWidget *psWidget, bool bOk) +{ + uint32_t ui32RTC; + + // + // Only update the RTC if the OK button was selected. + // + if(bOk) + { + // + // Convert the time structure that was altered by the clock setting + // widget into seconds. + // + ui32RTC = umktime(&g_sTimeClock); + + // + // If the conversion was valid, then write the updated clock to the + // Hibernate RTC. + // + if(ui32RTC != (uint32_t)(-1)) + { + HibernateRTCSet(ui32RTC); + } + } + + // + // Set the state to clock exit so some cleanup can be done from the + // main loop. + // + g_iLoggerState = eSTATE_CLOCKEXIT; +} + +//***************************************************************************** +// +// Initialize and operate the data logger. +// +//***************************************************************************** +int +main(void) +{ + tContext sDisplayContext, sBufferContext; + uint32_t ui32HibIntStatus, ui32SysClock, ui32LastTickCount; + bool bSkipSplash; + uint8_t ui8ButtonState, ui8ButtonChanged; + uint_fast8_t ui8X, ui8Y; + + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + MAP_FPULazyStackingEnable(); + + // + // Set the clocking to run at 50 MHz. + // + MAP_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | + SYSCTL_OSC_MAIN); + ui32SysClock = MAP_SysCtlClockGet(); + + // + // Initialize locals. + // + bSkipSplash = false; + ui32LastTickCount = 0; + + // + // Initialize the data acquisition module. This initializes the ADC + // hardware. + // + AcquireInit(); + + // + // Enable access to the hibernate peripheral. If the hibernate peripheral + // was already running then this will have no effect. + // + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE); + + // + // Check to see if the hiberate module is already active and if so then + // read the saved configuration state. If both are okay, then proceed + // to check and see if we are logging data using sleep mode. + // + if(HibernateIsActive() && !GetSavedState(&g_sConfigState)) + { + // + // Read the status of the hibernate module. + // + ui32HibIntStatus = HibernateIntStatus(1); + + // + // If this is a pin wake, that means the user pressed the select + // button and we should terminate the sleep logging. In this case + // we will fall out of this conditional section, and go through the + // normal startup below, but skipping the splash screen so the user + // gets immediate response. + // + if(ui32HibIntStatus & HIBERNATE_INT_PIN_WAKE) + { + // + // Clear the interrupt flag so it is not seen again until another + // wake. + // + HibernateIntClear(HIBERNATE_INT_PIN_WAKE); + bSkipSplash = true; + } + + // + // Otherwise if we are waking from hibernate and it was not a pin + // wake, then it must be from RTC match. Check to see if we are + // sleep logging and if so then go through an abbreviated startup + // in order to collect the data and go back to sleep. + // + else if(g_sConfigState.ui32SleepLogging && + (ui32HibIntStatus & HIBERNATE_INT_RTC_MATCH_0)) + { + // + // Start logger and pass the configuration. The logger should + // configure itself to take one sample. + // + AcquireStart(&g_sConfigState); + g_iLoggerState = eSTATE_LOGGING; + + // + // Enter a forever loop to run the acquisition. This will run + // until a new sample has been taken and stored. + // + while(!AcquireRun()) + { + } + + // + // Getting here means that a data acquisition was performed and we + // can now go back to sleep. Save the configuration and then + // activate the hibernate. + // + SetSavedState(&g_sConfigState); + + // + // Set wake condition on pin-wake or RTC match. Then put the + // processor in hibernation. + // + HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC); + HibernateRequest(); + + // + // Hibernating takes a finite amount of time to occur, so wait + // here forever until hibernate activates and the processor + // power is removed. + // + for(;;) + { + } + } + + // + // Otherwise, this was not a pin wake, and we were not sleep logging, + // so just fall out of this conditional and go through the normal + // startup below. + // + } + else + { + // + // In this case, either the hibernate module was not already active, or + // the saved configuration was not valid. Initialize the configuration + // to the default state and then go through the normal startup below. + // + GetDefaultState(&g_sConfigState); + } + + // + // Enable the Hibernate module to run. + // + HibernateEnableExpClk(SysCtlClockGet()); + + // + // The hibernate peripheral trim register must be set per silicon + // erratum 2.1 + // + HibernateRTCTrimSet(0x7FFF); + + // + // Start the RTC running. If it was already running then this will have + // no effect. + // + HibernateRTCEnable(); + + // + // In case we were sleep logging and are now finished (due to user + // pressing select button), then disable sleep logging so it doesnt + // try to start up again. + // + g_sConfigState.ui32SleepLogging = 0; + SetSavedState(&g_sConfigState); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the buttons driver. + // + ButtonsInit(); + + // + // Pass the restored state to the menu system. + // + MenuSetState(&g_sConfigState); + + // + // Enable the USB peripheral + // + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); + + // + // Configure the required pins for USB operation. + // + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + MAP_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + MAP_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + MAP_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + MAP_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Erratum workaround for silicon revision A1. VBUS must have pull-down. + // + if(CLASS_IS_TM4C123 && REVISION_IS_A1) + { + HWREG(GPIO_PORTB_BASE + GPIO_O_PDR) |= GPIO_PIN_1; + } + + // + // Initialize the USB stack mode and pass in a mode callback. + // + USBStackModeSet(0, eUSBModeOTG, ModeCallback); + + // + // Initialize the stack to be used with USB stick. + // + USBStickInit(); + + // + // Initialize the stack to be used as a serial device. + // + USBSerialInit(); + + // + // Initialize the USB controller for dual mode operation with a 2ms polling + // rate. + // + USBOTGModeInit(0, 2000, g_pui8HCDPool, HCD_MEMORY_SIZE); + + // + // Initialize the menus module. This module will control the user + // interface menuing system. + // + MenuInit(WidgetActivated); + + // + // Configure SysTick to periodically interrupt. + // + g_ui32TickCount = 0; + MAP_SysTickPeriodSet(ui32SysClock / CLOCK_RATE); + MAP_SysTickIntEnable(); + MAP_SysTickEnable(); + + // + // Initialize the display context and another context that is used + // as an offscreen drawing buffer for display animation effect + // + GrContextInit(&sDisplayContext, &g_sCFAL96x64x16); + GrContextInit(&sBufferContext, &g_sOffscreenDisplayA); + + // + // Show the splash screen if we are not skipping it. The only reason to + // skip it is if the application was in sleep-logging mode and the user + // just waked it up with the select button. + // + if(!bSkipSplash) + { + const uint8_t *pui8SplashLogo = g_pui8Image_TI_Black; + + // + // Draw the TI logo on the display. Use an animation effect where the + // logo will "slide" onto the screen. Allow select button to break + // out of animation. + // + for(ui8X = 0; ui8X < 96; ui8X++) + { + if(ButtonsPoll(0, 0) & SELECT_BUTTON) + { + break; + } + GrImageDraw(&sDisplayContext, pui8SplashLogo, 95 - ui8X, 0); + } + + // + // Leave the logo on the screen for a long duration. Monitor the + // buttons so that if the user presses the select button, the logo + // display is terminated and the application starts immediately. + // + while(g_ui32TickCount < 400) + { + if(ButtonsPoll(0, 0) & SELECT_BUTTON) + { + break; + } + } + + // + // Extended splash sequence + // + if(ButtonsPoll(0, 0) & UP_BUTTON) + { + for(ui8X = 0; ui8X < 96; ui8X += 4) + { + GrImageDraw(&sDisplayContext, + g_ppui8Image_Splash[(ui8X / 4) & 3], + (int32_t)ui8X - 96L, 0); + GrImageDraw(&sDisplayContext, pui8SplashLogo, ui8X, 0); + MAP_SysCtlDelay(ui32SysClock / 12); + } + MAP_SysCtlDelay(ui32SysClock / 3); + pui8SplashLogo = g_ppui8Image_Splash[4]; + GrImageDraw(&sDisplayContext, pui8SplashLogo, 0, 0); + MAP_SysCtlDelay(ui32SysClock / 12); + } + + // + // Draw the initial menu into the offscreen buffer. + // + SlideMenuDraw(&g_sMenuWidget, &sBufferContext, 0); + + // + // Now, draw both the TI logo splash screen (from above) and the initial + // menu on the screen at the same time, moving the coordinates so that + // the logo "slides" off the display and the menu "slides" onto the + // display. + // + for(ui8Y = 0; ui8Y < 64; ui8Y++) + { + GrImageDraw(&sDisplayContext, pui8SplashLogo, 0, -ui8Y); + GrImageDraw(&sDisplayContext, g_pui8OffscreenBufA, 0, 63 - ui8Y); + } + } + + // + // Add the menu widget to the widget tree and send an initial paint + // request. + // + WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sMenuWidget); + WidgetPaint(WIDGET_ROOT); + + // + // Set the focus handle to the menu widget. Any button events will be + // sent to this widget + // + g_ui32KeyFocusWidgetHandle = (uint32_t)&g_sMenuWidget; + + // + // Forever loop to run the application + // + while(1) + { + + // + // Each time the timer tick occurs, process any button events. + // + if(g_ui32TickCount != ui32LastTickCount) + { + // + // Remember last tick count + // + ui32LastTickCount = g_ui32TickCount; + + // + // Read the debounced state of the buttons. + // + ui8ButtonState = ButtonsPoll(&ui8ButtonChanged, 0); + + // + // Pass any button presses through to the widget message + // processing mechanism. The widget that has the button event + // focus (probably the menu widget) will catch these button events. + // + if(BUTTON_PRESSED(SELECT_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_SELECT); + } + if(BUTTON_PRESSED(UP_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_UP); + } + if(BUTTON_PRESSED(DOWN_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_DOWN); + } + if(BUTTON_PRESSED(LEFT_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_LEFT); + } + if(BUTTON_PRESSED(RIGHT_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_RIGHT); + } + } + + // + // Tell the OTG library code how much time has passed in milliseconds + // since the last call. + // + USBOTGMain(GetTickms()); + + // + // Call functions as needed to keep the host or device mode running. + // + if(g_iCurrentUSBMode == eUSBModeDevice) + { + USBSerialRun(); + } + else if(g_iCurrentUSBMode == eUSBModeHost) + { + USBStickRun(); + } + + // + // If in the logging state, then call the logger run function. This + // keeps the data acquisition running. + // + if((g_iLoggerState == eSTATE_LOGGING) || + (g_iLoggerState == eSTATE_VIEWING)) + { + if(AcquireRun() && g_sConfigState.ui32SleepLogging) + { + // + // If sleep logging is enabled, then at this point we have + // stored the first data item, now save the state and start + // hibernation. Wait for the power to be cut. + // + SetSavedState(&g_sConfigState); + HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC); + HibernateRequest(); + for(;;) + { + } + } + + // + // If viewing instead of logging then request a repaint to keep + // the viewing window updated. + // + if(g_iLoggerState == eSTATE_VIEWING) + { + WidgetPaint(WIDGET_ROOT); + } + } + + // + // If in the saving state, then save data from flash storage to + // USB stick. + // + if(g_iLoggerState == eSTATE_SAVING) + { + // + // Save data from flash to USB + // + FlashStoreSave(); + + // + // Return to idle state + // + g_iLoggerState = eSTATE_IDLE; + } + + // + // If in the erasing state, then erase the data stored in flash. + // + if(g_iLoggerState == eSTATE_ERASING) + { + // + // Save data from flash to USB + // + FlashStoreErase(); + + // + // Return to idle state + // + g_iLoggerState = eSTATE_IDLE; + } + + // + // If in the flash reporting state, then show the report of the amount + // of used and free flash memory. + // + if(g_iLoggerState == eSTATE_FREEFLASH) + { + // + // Report free flash space + // + FlashStoreReport(); + + // + // Return to idle state + // + g_iLoggerState = eSTATE_IDLE; + } + + // + // If we are exiting the clock setting widget, that means that control + // needs to be given back to the menu system. + // + if(g_iLoggerState == eSTATE_CLOCKEXIT) + { + // + // Give the button event focus back to the menu system + // + g_ui32KeyFocusWidgetHandle = (uint32_t)&g_sMenuWidget; + + // + // Send a button event to the menu widget that means the left + // key was pressed. This signals the menu widget to deactivate + // the current child widget (which was the clock setting wigdet). + // This will cause the menu widget to slide the clock set widget + // off the screen and resume control of the display. + // + SendWidgetKeyMessage(WIDGET_MSG_KEY_LEFT); + g_iLoggerState = eSTATE_IDLE; + } + + // + // Process any new messages that are in the widget queue. This keeps + // the user interface running. + // + WidgetMessageQueueProcess(); + } +} diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.ewd b/boards/ek-lm4f232/qs-logger/qs-logger.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.ewp b/boards/ek-lm4f232/qs-logger/qs-logger.ewp new file mode 100644 index 0000000..7250522 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.ewp @@ -0,0 +1,845 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\acquire.c + + + $PROJ_DIR$\..\drivers\buttons.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\clocksetwidget.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\src\ff.c + + + $PROJ_DIR$\flashstore.c + + + $PROJ_DIR$\images.c + + + $PROJ_DIR$\menus.c + + + $PROJ_DIR$\qs-logger.c + + + $PROJ_DIR$\..\drivers\slidemenuwidget.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\stripchartmanager.c + + + $PROJ_DIR$\..\drivers\stripchartwidget.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_serial_structs.c + + + $PROJ_DIR$\usbserial.c + + + $PROJ_DIR$\usbstick.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.h b/boards/ek-lm4f232/qs-logger/qs-logger.h new file mode 100644 index 0000000..a8d7878 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.h @@ -0,0 +1,180 @@ +//***************************************************************************** +// +// qs-logger.h - Defines data types used in the data logger application. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __QS_LOGGER_H__ +#define __QS_LOGGER_H__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// The following defines the order of data items to log. It must match the +// order that they appear in the "CHANNELS" menu (see menus.c), and also +// the order they are stored in the ADC data buffer (see acquire.c). +// +//***************************************************************************** +#define LOG_ITEM_USER0 0 +#define LOG_ITEM_USER1 1 +#define LOG_ITEM_USER2 2 +#define LOG_ITEM_USER3 3 +#define LOG_ITEM_ACCELX 4 +#define LOG_ITEM_ACCELY 5 +#define LOG_ITEM_ACCELZ 6 +#define LOG_ITEM_EXTTEMP 7 +#define LOG_ITEM_INTTEMP 8 +#define LOG_ITEM_CURRENT 9 +#define NUM_LOG_ITEMS 10 + +//***************************************************************************** +// +// These are additional definitions of items that may be displayed on the +// screen that are not acquired data. These are used for updating dynamic +// text screens on the display. +// +//***************************************************************************** +#define TEXT_ITEM_STATUS1 10 +#define TEXT_ITEM_STATUS2 11 +#define TEXT_ITEM_STATUS3 12 +#define TEXT_ITEM_STATUS_TITLE 13 +#define TEXT_ITEM_DATE 14 +#define TEXT_ITEM_TIME 15 +#define NUM_TEXT_ITEMS 16 + +//***************************************************************************** +// +// A structure that defines a data record. This is the binary format of the +// acquired data that will be stored. +// +//***************************************************************************** +typedef struct +{ + uint32_t ui32Seconds; // 32 bits of seconds + uint16_t ui16Subseconds; // 15 bits of subseconds + uint16_t ui16ItemMask; // 16 bits means maximum 16 items + int16_t pi16Items[]; +} +tLogRecord; + +//***************************************************************************** +// +// This structure defines a container to hold the state of all the +// configuration items. It is used both for passing configuration +// between modules and for persistent storage of the configuration. +// +//***************************************************************************** +typedef struct +{ + // + // A value used to identify this structure + // + uint32_t ui32Cookie; + + // + // A flag to indicate if the data logger is current logging data + // using the sleep mode. The data logger uses this to determine if + // it needs to continue taking samples once it wakes from hibernate. + // This is a 32-bit type just to keep the entire struct 32-bit aligned. + // + uint32_t ui32SleepLogging; + + // + // The period for sampling data. It is stored as a 24.8 seconds.frac + // format. The lower 8 bits represent power-of-2 fractional seconds + // with a resolution of 1/128 seconds (only lower 7 bits are used). + // + uint32_t ui32Period; + + // + // Saved location for writing records to flash. + // + uint32_t ui32FlashStore; + + // + // The name of the USB file currently opened for logging + // + char pcFilename[8]; + + // + // The bit mask of the channels selected for logging. + // + uint16_t ui16SelectedMask; + + // + // A flag indicating whether the data logger should sleep between samples. + // + bool bSleep; + + // + // A value that is used to select the storage medium. + // + uint8_t ui8Storage; + + // + // A checksum for the structure + // + uint32_t ui32Crc16; +} +tConfigState; + +#define STATE_COOKIE 0x0355AAC0 + +//***************************************************************************** +// +// The values indicating which storage medium is to be used for logging data. +// +//***************************************************************************** +#define CONFIG_STORAGE_NONE 0 +#define CONFIG_STORAGE_USB 1 +#define CONFIG_STORAGE_HOSTPC 2 +#define CONFIG_STORAGE_FLASH 3 +#define CONFIG_STORAGE_VIEWER 4 +#define CONFIG_STORAGE_CHOICES 5 + +//***************************************************************************** +// +// Function prototypes. +// +//***************************************************************************** +extern void SetStatusText(const char *pcTitle, const char *pcLine1, + const char *pcLine2, const char *pcLine3); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif // __QS_LOGGER_H__ diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.icf b/boards/ek-lm4f232/qs-logger/qs-logger.icf new file mode 100644 index 0000000..50dc88b --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// qs-logger.icf - Linker configuration file for qs-logger. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.ld b/boards/ek-lm4f232/qs-logger/qs-logger.ld new file mode 100644 index 0000000..d76e251 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * qs-logger.ld - Linker configuration file for qs-logger. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.sct b/boards/ek-lm4f232/qs-logger/qs-logger.sct new file mode 100644 index 0000000..198f208 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; qs-logger.sct - Linker configuration file for qs-logger. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.uvopt b/boards/ek-lm4f232/qs-logger/qs-logger.uvopt new file mode 100644 index 0000000..e848d39 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.uvopt @@ -0,0 +1,555 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + qs-logger + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\acquire.c + acquire.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\buttons.c + buttons.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\clocksetwidget.c + clocksetwidget.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + fat_usbmsc.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\src\ff.c + ff.c + + + 1 + 7 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\flashstore.c + flashstore.c + + + 1 + 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\images.c + images.c + + + 1 + 9 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\menus.c + menus.c + + + 1 + 10 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\qs-logger.c + qs-logger.c + + + 1 + 11 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\slidemenuwidget.c + slidemenuwidget.c + + + 1 + 12 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 13 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\stripchartmanager.c + stripchartmanager.c + + + 1 + 14 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\stripchartwidget.c + stripchartwidget.c + + + 1 + 15 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 16 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_serial_structs.c + usb_serial_structs.c + + + 1 + 17 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usbserial.c + usbserial.c + + + 1 + 18 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usbstick.c + usbstick.c + + + 1 + 19 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 20 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 21 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 22 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 23 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/qs-logger/qs-logger.uvproj b/boards/ek-lm4f232/qs-logger/qs-logger.uvproj new file mode 100644 index 0000000..a3150d8 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger.uvproj @@ -0,0 +1,519 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + qs-logger + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + qs-logger + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\qs-logger.bin .\rvmdk\qs-logger.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..;..\..\..\..\third_party; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + qs-logger.sct + + + --entry Reset_Handler + + + + + + + + Source + + + acquire.c + 1 + .\acquire.c + + + buttons.c + 1 + ..\drivers\buttons.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + clocksetwidget.c + 1 + .\clocksetwidget.c + + + fat_usbmsc.c + 1 + ..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + + + ff.c + 1 + ..\..\..\..\third_party\fatfs\src\ff.c + + + flashstore.c + 1 + .\flashstore.c + + + images.c + 1 + .\images.c + + + menus.c + 1 + .\menus.c + + + qs-logger.c + 1 + .\qs-logger.c + + + slidemenuwidget.c + 1 + ..\drivers\slidemenuwidget.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + stripchartmanager.c + 1 + .\stripchartmanager.c + + + stripchartwidget.c + 1 + ..\drivers\stripchartwidget.c + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_serial_structs.c + 1 + .\usb_serial_structs.c + + + usbserial.c + 1 + .\usbserial.c + + + usbstick.c + 1 + .\usbstick.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/qs-logger/qs-logger_ccs.cmd b/boards/ek-lm4f232/qs-logger/qs-logger_ccs.cmd new file mode 100644 index 0000000..f64402c --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/qs-logger_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * qs-logger_ccs.cmd - CCS linker configuration file for qs-logger. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/qs-logger/readme.txt b/boards/ek-lm4f232/qs-logger/readme.txt new file mode 100644 index 0000000..1877536 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/readme.txt @@ -0,0 +1,93 @@ +Data Logger + +This example application is a data logger. It can be configured to collect +data from up to 10 data sources. The possible data sources are: +- 4 analog inputs, 0-20V +- 3-axis accelerometer +- internal and external temperature sensors +- processor current consumption + +The data logger provides a menu navigation that is operated by the buttons +on the EK-LM4F232 board (up, down, left, right, select). The data logger +can be configured by using the menus. The following items can be +configured: +- data sources to be logged +- sample rate +- storage location +- sleep modes +- clock + +Using the data logger: + +Use the CONFIG menu to configure the data logger. The following choices +are provided: + +- CHANNELS - enable specific channels of data that will be logged +- PERIOD - select the sample period +- STORAGE - select where the collected data will be stored: + - FLASH - stored in the internal flash memory + - USB - stored on a connected USB memory stick + - HOST PC - transmitted to a host PC via USB OTG virtual serial port + - NONE - the data will only be displayed and not stored +- SLEEP - select whether or not the board sleeps between samples. Sleep +mode is allowed when storing to flash at with a period of 1 second or +longer. +- CLOCK - allows setting of internal time-of-day clock that is used for +time stamping of the sampled data + +Use the START menu to start the data logger running. It will begin +collecting and storing the data. It will continue to collect data until +stopped by pressing the left button or select button. + +While the data logger is collecting data and it is not configured to +sleep, a simple strip chart showing the collected data will appear on the +display. If the data logger is configured to sleep, then no strip chart +will be shown. + +If the data logger is storing to internal flash memory, it will overwrite +the oldest data. If storing to a USB memory device it will store data +until the device is full. + +The VIEW menu allows viewing the values of the data sources in numerical +format. When viewed this way the data is not stored. + +The SAVE menu allows saving data that was stored in internal flash memory +to a USB stick. The data will be saved in a text file in CSV format. + +The ERASE menu is used to erase the internal memory so more data can be +saved. + +When the EK-LM4F232 board running qs-logger is connected to a host PC via +the USB OTG connection for the first time, Windows will prompt for a device +driver for the board. +This can be found in /ti/TivaWare_C_Series-x.x/windows_drivers +assuming you installed the software in the default folder. + +A companion Windows application, logger, can be found in the +/ti/TivaWare_C_Series-x.x/tools/bin directory. When the data logger's + STORAGE option is set to "HOST PC" and the board is connected to a PC +via the USB OTG connection, captured data will be transfered back to the PC +using the virtual serial port that the EK board offers. When the logger +application is run, it will search for the first connected EK-LM4F232 board +and display any sample data received. The application also offers the +option to log the data to a file on the PC. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.axf b/boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.axf new file mode 100644 index 0000000..975cc12 Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.axf differ diff --git a/boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.bin b/boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.bin new file mode 100644 index 0000000..7c7687b Binary files /dev/null and b/boards/ek-lm4f232/qs-logger/rvmdk/qs-logger.bin differ diff --git a/boards/ek-lm4f232/qs-logger/startup_ccs.c b/boards/ek-lm4f232/qs-logger/startup_ccs.c new file mode 100644 index 0000000..ae2a97c --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/startup_ccs.c @@ -0,0 +1,305 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void ADC0SS0Handler(void); +extern void RTCHandler(void); +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + ADC0SS0Handler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + RTCHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/qs-logger/startup_ewarm.c b/boards/ek-lm4f232/qs-logger/startup_ewarm.c new file mode 100644 index 0000000..d95fb5e --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/startup_ewarm.c @@ -0,0 +1,336 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void ADC0SS0Handler(void); +extern void RTCHandler(void); +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + ADC0SS0Handler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + RTCHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/qs-logger/startup_gcc.c b/boards/ek-lm4f232/qs-logger/startup_gcc.c new file mode 100644 index 0000000..ca5b4d7 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/startup_gcc.c @@ -0,0 +1,352 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void ADC0SS0Handler(void); +extern void RTCHandler(void); +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + ADC0SS0Handler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + RTCHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/qs-logger/startup_rvmdk.S b/boards/ek-lm4f232/qs-logger/startup_rvmdk.S new file mode 100644 index 0000000..25f6000 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/startup_rvmdk.S @@ -0,0 +1,361 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN ADC0SS0Handler + EXTERN RTCHandler + EXTERN SysTickIntHandler + EXTERN USB0OTGModeIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickIntHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD ADC0SS0Handler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD RTCHandler ; Hibernate + DCD USB0OTGModeIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/qs-logger/stripchartmanager.c b/boards/ek-lm4f232/qs-logger/stripchartmanager.c new file mode 100644 index 0000000..bab6d94 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/stripchartmanager.c @@ -0,0 +1,445 @@ +//***************************************************************************** +// +// stripchartmanager.c - Manages a strip chart widget for the data logger. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_types.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "grlib/canvas.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/slidemenuwidget.h" +#include "drivers/stripchartwidget.h" +#include "stripchartmanager.h" +#include "clocksetwidget.h" +#include "qs-logger.h" +#include "menus.h" +#include "utils/ustdlib.h" + +//***************************************************************************** +// +// This module manages a strip chart widget for the data logger application. +// It provides functions to make it easy to configure a strip chart for the +// user-selected data series, and to add new data to the strip chart. The +// functions in this module maintain buffers that hold the data for each data +// series that is selected for display on the strip chart. +// +//***************************************************************************** + +//***************************************************************************** +// +// Define a scaling range for each data series. Since multiple kinds of data +// will be shown on the strip chart, no one particular set of units can be +// selected. Instead the strip chart Y axis will just be maintained in units +// of pixels, and the table below maps the Y axis range to min and max values +// for each data series. +// +//***************************************************************************** +typedef struct +{ + int16_t i16Min; + int16_t i16Max; +} tDisplayScaling; + +tDisplayScaling g_psScaling[] = +{ + { 0, 20000 }, // analog channel inputs, + { 0, 20000 }, // 0-20V (20000 mV) + { 0, 20000 }, + { 0, 20000 }, + { -200, 200 }, // accelerometer axes, -2 - 2g + { -200, 200 }, // (units of 1/100g) + { -200, 200 }, + { 0, 500 }, // temperature, 0 - 50C (units of + { 0, 500 }, // 1/10C) + { 0, 400 }, // current, 0 - 40mA (units of + // 100uA) +}; + +//***************************************************************************** +// +// Defines the maximum number of items that are stored in a data series. This +// matches the width of the strip chart in pixels. +// +//***************************************************************************** +#define SERIES_LENGTH 96 + +//***************************************************************************** +// +// Create an array of strip chart data series, one for each channel of data +// that the data logger can acquire. Fields that are unchanging, such as +// the name of each series, are pre-populated here, while other fields that +// may change are updated by functions. These are the data series that get +// added to the strip chart for each item that is selected for logging. +// +//***************************************************************************** +static tStripChartSeries g_psSeries[] = +{ + { 0, "CH0", 0x000040, 1, 1, 0, 0 }, + { 0, "CH1", ClrLime, 1, 1, 0, 0 }, + { 0, "CH2", ClrAqua, 1, 1, 0, 0 }, + { 0, "CH3", ClrRed, 1, 1, 0, 0 }, + { 0, "ACCELX", ClrBlue, 1, 1, 0, 0 }, + { 0, "ACCELY", 0x00A000, 1, 1, 0, 0 }, + { 0, "ACCELZ", ClrFuchsia, 1, 1, 0, 0 }, + { 0, "CURRENT", ClrYellow, 1, 1, 0, 0 }, + { 0, "EXT TEMP", 0xC00040, 1, 1, 0, 0 }, + { 0, "INT TEMP", 0x60E080, 1, 1, 0, 0 }, +}; +#define MAX_NUM_SERIES (sizeof(g_psSeries) / \ + sizeof(tStripChartSeries)) + +//***************************************************************************** +// +// Defines the X-axis for the strip chart. +// +//***************************************************************************** +static tStripChartAxis g_sAxisX = +{ + "X-AXIS", // title of axis + 0, // label for minimum of axis + 0, // label for maximum of axis + 0, // minimum value for the axis + 95, // maximum value for the axis + 10 // grid interval for the axis +}; + +//***************************************************************************** +// +// Defines the Y-axis for the strip chart. +// +//***************************************************************************** +static tStripChartAxis g_sAxisY = +{ + 0, // title of the axis + 0, // label for minimum of axis + 0, // label for maximum of axis + 0, // minimum value for the axis + 63, // maximum value for the axis + 16 // grid interval for the axis +}; + +//***************************************************************************** +// +// Defines the strip chart widget. This structure must be fully initialized +// by calling the function StripChartMgrInit(). +// +//***************************************************************************** +StripChart(g_sStripChart, 0, 0, 0, 0, 0, 0, 96, 64, 0, g_psFontFixed6x8, + ClrBlack, ClrWhite, ClrWhite, ClrDarkGreen, &g_sAxisX, + &g_sAxisY, 0); + +//***************************************************************************** +// +// Creates a buffer space for the values in the data series. The buffer +// must be large enough to hold all of the data for the maximum possible +// number of data items that are selected. If less than the maximum number +// are selected then some of the buffer space will be unused. +// +//***************************************************************************** +static uint8_t g_pui8SeriesData[MAX_NUM_SERIES * SERIES_LENGTH]; + +//***************************************************************************** +// +// The count of data series that are selected for showing on the strip chart. +// This value is set when the client calls the function StripChartConfigure(). +// +//***************************************************************************** +static uint32_t g_ui32SelectedCount; + +//***************************************************************************** +// +// The number of items (per series) that have been added to the strip chart. +// +//***************************************************************************** +static uint32_t g_ui32ItemCount; + +//***************************************************************************** +// +// A bit mask of the specific data items that have been selected for logging. +// +//***************************************************************************** +static uint32_t g_ui32SelectedMask; + +//***************************************************************************** +// +// Configure the strip chart for a selected set of data series. The selected +// series is passed in as a bit mask. Each bit that is set in the bit mask +// represents a selected series. This function will go through the possible +// set of data series and for each that is selected it will be initialized +// and added to the strip chart. +// +//***************************************************************************** +void +StripChartMgrConfigure(uint32_t ui32SelectedMask) +{ + uint32_t ui32Idx, ui32ItemIdx; + tStripChartSeries *psSeries; + + // + // Save the channel mask for later use + // + g_ui32SelectedMask = ui32SelectedMask; + + // + // Determine how many series are to appear in the strip chart. + // + g_ui32SelectedCount = 0; + ui32Idx = ui32SelectedMask; + while(ui32Idx) + { + if(ui32Idx & 1) + { + g_ui32SelectedCount++; + } + ui32Idx >>= 1; + } + + // + // Reset the number of items that have been stored in the series buffers. + // + g_ui32ItemCount = 0; + + // + // Remove any series that were already added to the strip chart. + // + g_sStripChart.psSeries = 0; + + // + // Loop through all series, and configure the selected series and add + // them to the strip chart. + // + ui32ItemIdx = 0; + for(ui32Idx = 0; ui32Idx < MAX_NUM_SERIES; ui32Idx++) + { + // + // Check to see if this series is selected + // + if((1 << ui32Idx) & ui32SelectedMask) + { + // + // Get a pointer to this series. + // + psSeries = &g_psSeries[ui32Idx]; + + // + // Set the stride for this series. It will be the same as the + // number of enabled data items. + // + psSeries->ui8Stride = g_ui32SelectedCount; + + // + // Set the series data pointer to start at the first location + // in the series buffer where this data item will appear. + // + psSeries->pvData = &g_pui8SeriesData[ui32ItemIdx]; + + // + // Add the series to the strip chart. + // + StripChartSeriesAdd(&g_sStripChart, psSeries); + + // + // Increment the index of selected series. + // + ui32ItemIdx++; + } + } +} + +//***************************************************************************** +// +// Scales the input data value to a Y pixel range according to the scaling +// table at the top of this file. +// +//***************************************************************************** +static uint8_t +ScaleDataToPixelY(int16_t i16Data, int16_t i16Min, int16_t i16Max) +{ + int32_t i32Y; + int16_t i16Range; + + // + // Adjust the input value so that the min will be the bottom of display. + // + i16Data -= i16Min; + + // + // Compute the range of the input that will appear on the display + // + i16Range = i16Max - i16Min; + + // + // Scale the input to the Y pixel range of the display + // + i32Y = (int32_t)i16Data * 63L; + + // + // Add in half of divisor to get proper rounding + // + i32Y += (int32_t)i16Range / 2L; + + // + // Apply final divisor to get Y pixel value on display + // + i32Y /= (int32_t)i16Range; + + // + // If the Y coordinate is out of the range of the display, force the + // value to be just off the display, in order to avoid aliasing to a + // bogus Y pixel value when the return value is converted to a smaller + // data type. + // + if((i32Y < 0) || (i32Y > 63)) + { + i32Y = 64; + } + + // + // Return the Y pixel value + // + return((uint8_t)i32Y); +} + +//***************************************************************************** +// +// Add data items to the strip chart and advance the strip chart position. +// This function will add the items pointed to by the parameter to the data +// series buffer and the strip chart will be updated to reflect the newly +// added data items. +// This function will assume that the number of items passed by the pointer +// is the same as was selected by the function StripChartMgrConfigure(). +// up to the caller to ensure that the amount of data passed matches the +// number of items that were selected when the strip chart was configured. +// +//***************************************************************************** +void +StripChartMgrAddItems(int16_t *pi16DataItems) +{ + uint32_t ui32Idx, ui32SelectedMask = g_ui32SelectedMask; + uint8_t *pui8NewData; + + // + // Check for valid input data pointer + // + if(!pi16DataItems) + { + return; + } + + // + // If the number count of items in the strip chart is at the maximum, then + // the items need to "slide down" and new data added to the end of the + // buffer. + // + if(g_ui32ItemCount == SERIES_LENGTH) + { + memmove(&g_pui8SeriesData[0], &g_pui8SeriesData[g_ui32SelectedCount], + SERIES_LENGTH * g_ui32SelectedCount); + + // + // Set the pointer for newly added data to be the end of the series + // buffer. + // + pui8NewData = &g_pui8SeriesData[(SERIES_LENGTH - 1) * + g_ui32SelectedCount]; + } + else + { + + // + // Otherwise, the series data buffer is less than full so compute the + // correct location in the buffer for the new data to be added. + // + pui8NewData = &g_pui8SeriesData[g_ui32ItemCount * + g_ui32SelectedCount]; + + // + // Increment the number of items that have been added to the strip + // chart series data buffer. + // + g_ui32ItemCount++; + + // + // Since the count of data items has changed, it must be updated for + // each series. + // + for(ui32Idx = 0; ui32Idx < MAX_NUM_SERIES; ui32Idx++) + { + g_psSeries[ui32Idx].ui16NumItems = g_ui32ItemCount; + } + } + + // + // Convert each of the input data items being added to the strip chart + // to a scaled Y pixel value. + // + ui32Idx = 0; + while(ui32SelectedMask) + { + // + // Is this data item being added to the chart? + // + if(ui32SelectedMask & 1) + { + // + // Scale the data item and add it to the series buffer + // + *pui8NewData = ScaleDataToPixelY(*pi16DataItems, + g_psScaling[ui32Idx].i16Min, + g_psScaling[ui32Idx].i16Max); + + // + // Increment the from/to pointers + // + pui8NewData++; + pi16DataItems++; + } + ui32Idx++; + ui32SelectedMask >>= 1; + } + + // + // Now that data has been added to the strip chart series buffers, either + // at the end or in the middle, advance the strip chart position by 1. + // Add a request for painting the strip chart widget. + // + StripChartAdvance(&g_sStripChart, 1); + WidgetPaint(WIDGET_ROOT); +} + +//***************************************************************************** +// +// Initializes the strip chart manager. The strip chart needs an on-screen +// and off-screen display for drawing. These are passed using the init +// function. +// +//***************************************************************************** +void +StripChartMgrInit(void) +{ + g_sStripChart.sBase.psDisplay = &g_sCFAL96x64x16; + g_sStripChart.psOffscreenDisplay = &g_sOffscreenDisplayA; +} diff --git a/boards/ek-lm4f232/qs-logger/stripchartmanager.h b/boards/ek-lm4f232/qs-logger/stripchartmanager.h new file mode 100644 index 0000000..11a1c16 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/stripchartmanager.h @@ -0,0 +1,63 @@ +//***************************************************************************** +// +// stripchartmanager.h - Header for data logger strip chart manager. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** +#ifndef __STRIPCHARTMANAGER_H__ +#define __STRIPCHARTMANAGER_H__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Public data. +// +//***************************************************************************** +extern tStripChartWidget g_sStripChart; + +//***************************************************************************** +// +// Function prototypes. +// +//***************************************************************************** +extern void StripChartMgrConfigure(uint32_t ui32SelectedMask); +extern void StripChartMgrAddItems(int16_t *pi16DataItems); +extern void StripChartMgrInit(void); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif // __STRIPCHARTMANAGER_H__ diff --git a/boards/ek-lm4f232/qs-logger/usb_serial_structs.c b/boards/ek-lm4f232/qs-logger/usb_serial_structs.c new file mode 100644 index 0000000..f899ce1 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/usb_serial_structs.c @@ -0,0 +1,217 @@ +//***************************************************************************** +// +// usb_serial_structs.c - Data structures defining this CDC USB device. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "driverlib/usb.h" +#include "usblib/usblib.h" +#include "usblib/usbcdc.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdcdc.h" +#include "usb_serial_structs.h" + +//***************************************************************************** +// +// The languages supported by this device. +// +//***************************************************************************** +const uint8_t g_pui8LangDescriptor[] = +{ + 4, + USB_DTYPE_STRING, + USBShort(USB_LANG_EN_US) +}; + +//***************************************************************************** +// +// The manufacturer string. +// +//***************************************************************************** +const uint8_t g_pui8ManufacturerString[] = +{ + (17 + 1) * 2, + USB_DTYPE_STRING, + 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0, + 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0, +}; + +//***************************************************************************** +// +// The product string. +// +//***************************************************************************** +const uint8_t g_pui8ProductString[] = +{ + 2 + (30 * 2), + USB_DTYPE_STRING, + 'S', 0, 't', 0, 'e', 0, 'l', 0, 'l', 0, 'a', 0, 'r', 0, 'i', 0, + 's', 0, ' ', 0, 'D', 0, 'a', 0, 't', 0, 'a', 0, ' ', 0, 'L', 0, + 'o', 0, 'g', 0, 'g', 0, 'e', 0, 'r', 0, ' ', 0, 'C', 0, 'O', 0, + 'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0 +}; + +//***************************************************************************** +// +// The serial number string. +// +//***************************************************************************** +const uint8_t g_pui8SerialNumberString[] = +{ + 2 + (8 * 2), + USB_DTYPE_STRING, + '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0 +}; + +//***************************************************************************** +// +// The control interface description string. +// +//***************************************************************************** +const uint8_t g_pui8ControlInterfaceString[] = +{ + 2 + (21 * 2), + USB_DTYPE_STRING, + 'A', 0, 'C', 0, 'M', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, 't', 0, + 'r', 0, 'o', 0, 'l', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, 'e', 0, + 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0 +}; + +//***************************************************************************** +// +// The configuration description string. +// +//***************************************************************************** +const uint8_t g_pui8ConfigString[] = +{ + 2 + (26 * 2), + USB_DTYPE_STRING, + 'S', 0, 'e', 0, 'l', 0, 'f', 0, ' ', 0, 'P', 0, 'o', 0, 'w', 0, + 'e', 0, 'r', 0, 'e', 0, 'd', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, + 'f', 0, 'i', 0, 'g', 0, 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0, + 'o', 0, 'n', 0 +}; + +//***************************************************************************** +// +// The descriptor string table. +// +//***************************************************************************** +const uint8_t * const g_pui8StringDescriptors[] = +{ + g_pui8LangDescriptor, + g_pui8ManufacturerString, + g_pui8ProductString, + g_pui8SerialNumberString, + g_pui8ControlInterfaceString, + g_pui8ConfigString +}; + +#define NUM_STRING_DESCRIPTORS (sizeof(g_pui8StringDescriptors) / \ + sizeof(uint8_t *)) + +//***************************************************************************** +// +// CDC device callback function prototypes. +// +//***************************************************************************** +uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData); +uint32_t TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData); +uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); + +//***************************************************************************** +// +// The CDC device initialization and customization structures. In this case, +// we are using USBBuffers between the CDC device class driver and the +// application code. The function pointers and callback data values are set +// to insert a buffer in each of the data channels, transmit and receive. +// +// With the buffer in place, the CDC channel callback is set to the relevant +// channel function and the callback data is set to point to the channel +// instance data. The buffer, in turn, has its callback set to the application +// function and the callback data set to our CDC instance structure. +// +//***************************************************************************** +extern const tUSBBuffer g_sTxBuffer; +extern const tUSBBuffer g_sRxBuffer; + +tUSBDCDCDevice g_sCDCDevice = +{ + USB_VID_TI_1CBE, + USB_PID_DATA_LOGGER, + 0, + USB_CONF_ATTR_SELF_PWR, + ControlHandler, + (void *)&g_sCDCDevice, + USBBufferEventCallback, + (void *)&g_sRxBuffer, + USBBufferEventCallback, + (void *)&g_sTxBuffer, + g_pui8StringDescriptors, + NUM_STRING_DESCRIPTORS +}; + +//***************************************************************************** +// +// Receive buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pui8USBRxBuffer[UART_BUFFER_SIZE]; +uint8_t g_pui8RxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE]; +const tUSBBuffer g_sRxBuffer = +{ + false, // This is a receive buffer. + RxHandler, // pfnCallback + (void *)&g_sCDCDevice, // Callback data is our device ptr. + USBDCDCPacketRead, // pfnTransfer + USBDCDCRxPacketAvailable, // pfnAvailable + (void *)&g_sCDCDevice, // pvHandle + g_pui8USBRxBuffer, // pui8Buffer + UART_BUFFER_SIZE, // ui32BufferSize + g_pui8RxBufferWorkspace // pvWorkspace +}; + +//***************************************************************************** +// +// Transmit buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pui8USBTxBuffer[UART_BUFFER_SIZE]; +uint8_t g_pui8TxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE]; +const tUSBBuffer g_sTxBuffer = +{ + true, // This is a transmit buffer. + TxHandler, // pfnCallback + (void *)&g_sCDCDevice, // Callback data is our device ptr. + USBDCDCPacketWrite, // pfnTransfer + USBDCDCTxPacketAvailable, // pfnAvailable + (void *)&g_sCDCDevice, // pvHandle + g_pui8USBTxBuffer, // pi8Buffer + UART_BUFFER_SIZE, // ui32BufferSize + g_pui8TxBufferWorkspace // pvWorkspace +}; diff --git a/boards/ek-lm4f232/qs-logger/usb_serial_structs.h b/boards/ek-lm4f232/qs-logger/usb_serial_structs.h new file mode 100644 index 0000000..6960a45 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/usb_serial_structs.h @@ -0,0 +1,49 @@ +//***************************************************************************** +// +// usb_serial_structs.h - Data structures defining this USB CDC device. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef _USB_SERIAL_STRUCTS_H_ +#define _USB_SERIAL_STRUCTS_H_ + +//***************************************************************************** +// +// The size of the transmit and receive buffers used for the redirected UART. +// This number should be a power of 2 for best performance. 256 is chosen +// pretty much at random though the buffer should be at least twice the size of +// a maxmum-sized USB packet. +// +//***************************************************************************** +#define UART_BUFFER_SIZE 256 + +extern uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); +extern uint32_t TxHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); + +extern const tUSBBuffer g_sTxBuffer; +extern const tUSBBuffer g_sRxBuffer; +extern tUSBDCDCDevice g_sCDCDevice; +extern uint8_t g_pui8USBTxBuffer[]; +extern uint8_t g_pui8USBRxBuffer[]; + +#endif diff --git a/boards/ek-lm4f232/qs-logger/usbserial.c b/boards/ek-lm4f232/qs-logger/usbserial.c new file mode 100644 index 0000000..9125626 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/usbserial.c @@ -0,0 +1,459 @@ +//***************************************************************************** +// +// usbserial.c - Data logger module to handle serial device functions. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "driverlib/debug.h" +#include "usblib/usblib.h" +#include "usblib/usbcdc.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdcdc.h" +#include "usb_serial_structs.h" +#include "qs-logger.h" + +//***************************************************************************** +// +// This module manages the USB serial device function. It is used when the +// eval board is connected to a host PC as a serial device, and can transmit +// data log records to the host PC through a virtual serial port. +// +//***************************************************************************** + +//***************************************************************************** +// +// Global flag indicating that a USB device configuration is made. +// +//***************************************************************************** +static volatile bool g_bUSBDevConnected = false; + +//***************************************************************************** +// +// The line coding parameters for the virtual serial port. Since there is +// no physical port this does not have any real effect, but we have a default +// set of values to report if asked, and will remember whatever the host +// configures. +// +//***************************************************************************** +static tLineCoding g_sLineCoding = +{ + 115200, USB_CDC_STOP_BITS_1, USB_CDC_PARITY_NONE, 8 +}; + +//***************************************************************************** +// +// Set the communication parameters for the virtual serial port. +// +//***************************************************************************** +static bool +SetLineCoding(tLineCoding *psLineCoding) +{ + // + // Copy whatever the host passes into our copy of line parameters. + // + memcpy(&g_sLineCoding, psLineCoding, sizeof(tLineCoding)); + + // + // ALways return success + // + return(true); +} + +//***************************************************************************** +// +// Get the communication parameters in use on the UART. +// +//***************************************************************************** +static void +GetLineCoding(tLineCoding *psLineCoding) +{ + // + // Copy whatever we have stored as the line parameter to the host. + // + memcpy(psLineCoding, &g_sLineCoding, sizeof(tLineCoding)); +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to control and setup of the device. +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to perform control-related +// operations on behalf of the USB host. These functions include setting +// and querying the serial communication parameters, setting handshake line +// states and sending break conditions. +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +ControlHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData) +{ + // + // Which event are we being asked to process? + // + switch(ui32Event) + { + // + // We are connected to a host and communication is now possible. + // + case USB_EVENT_CONNECTED: + { + g_bUSBDevConnected = true; + + // + // Flush our buffers. + // + USBBufferFlush(&g_sTxBuffer); + USBBufferFlush(&g_sRxBuffer); + break; + } + + // + // The host has disconnected. + // + case USB_EVENT_DISCONNECTED: + { + g_bUSBDevConnected = false; + break; + } + + // + // Return the current serial communication parameters. + // + case USBD_CDC_EVENT_GET_LINE_CODING: + { + GetLineCoding(pvMsgData); + break; + } + + // + // Set the current serial communication parameters. + // + case USBD_CDC_EVENT_SET_LINE_CODING: + { + SetLineCoding(pvMsgData); + break; + } + + // + // The following line control events can be ignored because there is + // no physical serial port to manage. + // + case USBD_CDC_EVENT_SET_CONTROL_LINE_STATE: + case USBD_CDC_EVENT_SEND_BREAK: + case USBD_CDC_EVENT_CLEAR_BREAK: + { + break; + } + + // + // Ignore SUSPEND and RESUME for now. + // + case USB_EVENT_SUSPEND: + case USB_EVENT_RESUME: + { + break; + } + + // + // An unknown event occurred. + // + default: + { + break; + } + } + + // + // Return control to USB stack + // + return(0); +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to the transmit channel (data to +// the USB host). +// +// \param ui32CBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to notify us of any events +// related to operation of the transmit data channel (the IN channel carrying +// data to the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData) +{ + // + // Which event have we been sent? + // + switch(ui32Event) + { + case USB_EVENT_TX_COMPLETE: + { + // + // Since we are using the USBBuffer, we don't need to do anything + // here. + // + break; + } + + // + // We don't expect to receive any other events. + // + default: + { + break; + } + } + return(0); +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to the receive channel (data from +// the USB host). +// +// \param ui32CBData is the client-supplied callback data value for this +// channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to notify us of any events +// related to operation of the receive data channel (the OUT channel carrying +// data from the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData) +{ + // + // Which event are we being sent? + // + switch(ui32Event) + { + // + // A new packet has been received. + // + case USB_EVENT_RX_AVAILABLE: + { + // + // We do not ever expect to receive serial data, so just flush + // the RX buffer if any data actually comes in. + // + USBBufferFlush(&g_sRxBuffer); + break; + } + + // + // We are being asked how much unprocessed data we have still to + // process. Since there is no actual serial port and we are not + // processing any RX data, just return 0. + // + case USB_EVENT_DATA_REMAINING: + { + return(0); + } + + // + // We are being asked to provide a buffer into which the next packet + // can be read. We do not support this mode of receiving data so let + // the driver know by returning 0. The CDC driver should not be sending + // this message but this is included just for illustration and + // completeness. + // + case USB_EVENT_REQUEST_BUFFER: + { + return(0); + } + + // + // We don't expect to receive any other events. + // + default: + { + break; + } + } + return(0); +} + +//***************************************************************************** +// +// Initializes the USB serial device. +// +//***************************************************************************** +void +USBSerialInit(void) +{ + // + // Initialize the transmit and receive buffers. + // + USBBufferInit((tUSBBuffer *)&g_sTxBuffer); + USBBufferInit((tUSBBuffer *)&g_sRxBuffer); + + // + // Initialize the USB library CDC device function. + // + USBDCDCInit(0, (tUSBDCDCDevice *)&g_sCDCDevice); +} + +//***************************************************************************** +// +// This is called by the application main loop to perform regular processing. +// This is just a stub here because everything is event or interrupt driven. +// +//***************************************************************************** +void +USBSerialRun(void) +{ +} + +//***************************************************************************** +// +// Write a data record to the serial port. An acquired data record is passed +// in and is composed into a binary packet and sent on the serial port. The +// host PC, if connected will receive this packet via the virtual serial port, +// and can decode and display the data. +// +// The binary packet has the following format: +// - 16-bit header, value 0x5351 +// - 32-bit seconds time stamp +// - 16-bit fractional seconds time stamp (1/32768 resolution) +// - 16-bit data item selection mask (which items are included in the record) +// - multiple 16-bit data item values, per selection mask +// - 16-bit checksum which when added to the 16-bit sum of the entire packet +// will result in 0. +// +// The entire packet is transmitted bytewise over the virtual serial port, +// little-endian format. +// +//***************************************************************************** +int32_t +USBSerialWriteRecord(tLogRecord *psRecord) +{ + uint32_t ui32Idx; + uint16_t ui16Checksum; + uint32_t ui32ItemCount; + uint16_t *pui16Buf; + + // + // Check the arguments + // + ASSERT(psRecord); + if(!psRecord) + { + return(1); + } + + // + // Check state for ready device + // + if(!g_bUSBDevConnected) + { + return(1); + } + + // + // Determine how many channels are to be logged + // + ui32Idx = psRecord->ui16ItemMask; + ui32ItemCount = 0; + while(ui32Idx) + { + if(ui32Idx & 1) + { + ui32ItemCount++; + } + ui32Idx >>= 1; + } + + // + // Add to item count the equivalent number of 16-bit words for timestamp + // and selection mask. + // + ui32ItemCount += 4; + + // + // Put the header word in the USB buffer + // + ui16Checksum = 0x5351; + USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, (uint8_t *)&ui16Checksum, 2); + + // + // Compute the checksum over the entire record + // + pui16Buf = (uint16_t *)psRecord; + for(ui32Idx = 0; ui32Idx < ui32ItemCount; ui32Idx++) + { + ui16Checksum += pui16Buf[ui32Idx]; + } + + // + // Convert item count to bytes. This now represents the entire record + // size in bytes, not including the checksum. The header has already + // been sent + // + ui32ItemCount *= 2; + + // + // Transmit the record, which includes the time stamp, selection mask + // and all selected data item, to the USB buffer + // + USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, (uint8_t *)pui16Buf, + ui32ItemCount); + + // + // Adjust the checksum so that when added (as uint16_t) to the sum of the + // rest of the packet, the result will be 0 + // + ui16Checksum = (uint16_t)(0x10000L - (uint32_t)ui16Checksum); + + // + // Transmit the checksum which is the end of the packet + // + USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, (uint8_t *)&ui16Checksum, 2); + + // + // Return success to the caller + // + return(0); +} diff --git a/boards/ek-lm4f232/qs-logger/usbserial.h b/boards/ek-lm4f232/qs-logger/usbserial.h new file mode 100644 index 0000000..8db33e4 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/usbserial.h @@ -0,0 +1,56 @@ +//***************************************************************************** +// +// usbserial.h - Prototypes and definitions for USB serial module. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** +#ifndef __USBSERIAL_H__ +#define __USBSERIAL_H__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Module function prototypes. +// +//***************************************************************************** +extern void USBSerialInit(void); +extern void USBSerialRun(void); +extern int USBSerialWriteRecord(tLogRecord *psRecord); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif // __USBSERIAL_H__ diff --git a/boards/ek-lm4f232/qs-logger/usbstick.c b/boards/ek-lm4f232/qs-logger/usbstick.c new file mode 100644 index 0000000..c0c4427 --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/usbstick.c @@ -0,0 +1,814 @@ +//***************************************************************************** +// +// usbstick.c - Data logger module to handle USB mass storage. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "driverlib/debug.h" +#include "driverlib/rom_map.h" +#include "driverlib/sysctl.h" +#include "driverlib/udma.h" +#include "usblib/usblib.h" +#include "usblib/usbmsc.h" +#include "usblib/host/usbhost.h" +#include "usblib/host/usbhmsc.h" +#include "utils/ustdlib.h" +#include "third_party/fatfs/src/ff.h" +#include "qs-logger.h" +#include "usbstick.h" + +//***************************************************************************** +// +// This module manages the USB host mass storage function. It is used when +// there is a USB memory stick attached to the evaluation board. It manages +// the USB connection and stores data log records to the attached mass +// storage device. +// +//***************************************************************************** + +//***************************************************************************** +// +// A line of text that is written to the start of a CSV file, to provide +// column headings. +// +//***************************************************************************** +static const char g_pcCSVHeaderLine[] = + "Time(s),Frac. seconds," \ + "CH0(mV),CH1(mV),CH2(mV),CH3(mV)," \ + "AccelX(.01g),AccelY(.01g),AccelZ(.01g)," \ + "Ext. Temp(.1C),Int. Temp(.1C),Current(100uA)\r\n"; + +//***************************************************************************** +// +// The following are data structures used by FatFs. +// +//***************************************************************************** +static FATFS g_sFatFs; +static FIL g_sFileObject; + +//***************************************************************************** +// +// Holds global flags for the system. +// +//***************************************************************************** +static volatile uint32_t g_ui32Flags = 0; + +//***************************************************************************** +// +// Flag indicating that some USB device is connected. +// +//***************************************************************************** +#define FLAGS_DEVICE_PRESENT 0x00000001 +#define FLAGS_FILE_OPENED 0x00000002 + +//***************************************************************************** +// +// Hold the current state for the application. +// +//***************************************************************************** +volatile enum +{ + // + // No device is present. + // + eSTATE_NO_DEVICE, + + // + // Mass storage device is being enumerated. + // + eSTATE_DEVICE_ENUM, + + // + // Mass storage device is ready. + // + eSTATE_DEVICE_READY, + + // + // An unsupported device has been attached. + // + eSTATE_UNKNOWN_DEVICE, + + // + // A power fault has occurred. + // + eSTATE_POWER_FAULT +} +g_iState; + +//***************************************************************************** +// +// The instance data for the MSC driver. +// +//***************************************************************************** +tUSBHMSCInstance *g_psMSCInstance = 0; + +//***************************************************************************** +// +// Declare the USB Events driver interface. +// +//***************************************************************************** +DECLARE_EVENT_DRIVER(g_sUSBEventDriver, 0, 0, USBHCDEvents); + +//***************************************************************************** +// +// The global that holds all of the host drivers in use in the application. +// In this case, only the MSC class is loaded. +// +//***************************************************************************** +static tUSBHostClassDriver const * const g_ppHostClassDrivers[] = +{ + &g_sUSBHostMSCClassDriver, + &g_sUSBEventDriver +}; + +//***************************************************************************** +// +// This global holds the number of class drivers in the g_ppHostClassDrivers +// list. +// +//***************************************************************************** +static const uint32_t g_ui32NumHostClassDrivers = + sizeof(g_ppHostClassDrivers) / sizeof(tUSBHostClassDriver *); + +//***************************************************************************** +// +// The control table used by the uDMA controller. This table must be aligned +// to a 1024 byte boundary. In this application uDMA is only used for USB, +// so only the first 6 channels are needed. +// +//***************************************************************************** +#if defined(ewarm) +#pragma data_alignment=1024 +tDMAControlTable g_psDMAControlTable[6]; +#elif defined(ccs) +#pragma DATA_ALIGN(g_psDMAControlTable, 1024) +tDMAControlTable g_psDMAControlTable[6]; +#else +tDMAControlTable g_psDMAControlTable[6] __attribute__ ((aligned(1024))); +#endif + +//***************************************************************************** +// +// Initializes the file system module. +// +// \param None. +// +// This function initializes the third party FAT implementation. +// +// \return Returns \e true on success or \e false on failure. +// +//***************************************************************************** +static bool +FileInit(void) +{ + // + // Mount the file system, using logical disk 0. + // + if(f_mount(0, &g_sFatFs) != FR_OK) + { + return(false); + } + return(true); +} + +//***************************************************************************** +// +// This is the callback from the MSC driver. +// +// \param ui32Instance is the driver instance which is needed when +// communicating with the driver. +// \param ui32Event is one of the events defined by the driver. +// \param pvData is a pointer to data passed into the initial call to register +// the callback. +// +// This function handles callback events from the MSC driver. The only events +// currently handled are the MSC_EVENT_OPEN and MSC_EVENT_CLOSE. This allows +// the main routine to know when an MSC device has been detected and +// enumerated and when an MSC device has been removed from the system. +// +// \return None +// +//***************************************************************************** +static void +MSCCallback(tUSBHMSCInstance *psMSCInstance, uint32_t ui32Event, void *pvData) +{ + // + // Determine the event. + // + switch(ui32Event) + { + // + // Called when the device driver has successfully enumerated an MSC + // device. + // + case MSC_EVENT_OPEN: + { + // + // Proceed to the enumeration state. + // + g_iState = eSTATE_DEVICE_ENUM; + + break; + } + + // + // Called when the device driver has been unloaded due to error or + // the device is no longer present. + // + case MSC_EVENT_CLOSE: + { + // + // Go back to the "no device" state and wait for a new connection. + // + g_iState = eSTATE_NO_DEVICE; + + // + // Re-initialize the file system. + // + FileInit(); + + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// This is the generic callback from host stack. +// +// pvData is actually a pointer to a tEventInfo structure. +// +// This function will be called to inform the application when a USB event has +// occurred that is outside those related to the mass storage device. At this +// point this is used to detect unsupported devices being inserted and removed. +// It is also used to inform the application when a power fault has occurred. +// This function is required when the g_USBGenericEventDriver is included in +// the host controller driver array that is passed in to the +// USBHCDRegisterDrivers() function. +// +// +//***************************************************************************** +void +USBHCDEvents(void *pvData) +{ + tEventInfo *psEventInfo; + + // + // Cast this pointer to its actual type. + // + psEventInfo = (tEventInfo *)pvData; + + // + // Process each kind of event + // + switch(psEventInfo->ui32Event) + { + // + // An unknown device has been connected. + // + case USB_EVENT_UNKNOWN_CONNECTED: + { + // + // An unknown device was detected. + // + g_iState = eSTATE_UNKNOWN_DEVICE; + break; + } + + // + // The unknown device has been been unplugged. + // + case USB_EVENT_DISCONNECTED: + { + // + // Unknown device has been removed. + // + g_iState = eSTATE_NO_DEVICE; + break; + } + + // + // A bus power fault was detected. + // + case USB_EVENT_POWER_FAULT: + { + // + // No power means no device is present. + // + g_iState = eSTATE_POWER_FAULT; + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// Initializes the USB stack for mass storage. +// +//***************************************************************************** +void +USBStickInit(void) +{ + // + // Enable the uDMA controller and set up the control table base. + // The uDMA controller is used by the USB library. + // + MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); + MAP_uDMAEnable(); + MAP_uDMAControlBaseSet(g_psDMAControlTable); + + // + // Initially wait for device connection. + // + g_iState = eSTATE_NO_DEVICE; + + // + // Register the host class drivers. + // + USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); + + // + // Open an instance of the mass storage class driver. + // + g_psMSCInstance = USBHMSCDriveOpen(0, MSCCallback); + + // + // Initialize the power configuration. This sets the power enable signal + // to be active high and does not enable the power fault. + // + USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); + + // + // Run initial pass through USB host stack. + // + USBHCDMain(); + + // + // Initialize the file system. + // + FileInit(); +} + +//***************************************************************************** +// +// This is called by the application main loop to perform regular processing. +// It keeps the USB host stack running and tracks the state of the attached +// device. +// +//***************************************************************************** +void +USBStickRun(void) +{ + // + // Call the USB stack to keep it running. + // + USBHCDMain(); + + // + // Take action based on the application state. + // + switch(g_iState) + { + // + // A device has enumerated. + // + case eSTATE_DEVICE_ENUM: + { + // + // Check to see if the device is ready. If not then stay + // in this state and we will check it again on the next pass. + // + if(USBHMSCDriveReady(g_psMSCInstance) != 0) + { + // + // Wait about 500ms before attempting to check if the + // device is ready again. + // + MAP_SysCtlDelay(MAP_SysCtlClockGet()/3); + break; + } + + // + // If there were no errors reported, we are ready for + // MSC operation. + // + g_iState = eSTATE_DEVICE_READY; + + // + // Set the Device Present flag. + // + g_ui32Flags = FLAGS_DEVICE_PRESENT; + + break; + } + + // + // If there is no device then just wait for one. + // + case eSTATE_NO_DEVICE: + { + if(g_ui32Flags == FLAGS_DEVICE_PRESENT) + { + // + // Clear the Device Present flag. + // + g_ui32Flags &= ~(FLAGS_DEVICE_PRESENT | FLAGS_FILE_OPENED); + } + break; + } + + // + // An unknown device was connected. + // + case eSTATE_UNKNOWN_DEVICE: + { + // + // If this is a new device then change the status. + // + if((g_ui32Flags & FLAGS_DEVICE_PRESENT) == 0) + { + // + // Unknown device is present + // + } + + // + // Set the Device Present flag even though the unknown device + // is not useful to us. + // + g_ui32Flags = FLAGS_DEVICE_PRESENT; + break; + } + + // + // The device is ready and in use. + // + case eSTATE_DEVICE_READY: + { + break; + } + + // + // Something has caused a power fault. + // + case eSTATE_POWER_FAULT: + { + break; + } + + // + // Unexpected USB state. Set back to default. + // + default: + { + g_iState = eSTATE_NO_DEVICE; + g_ui32Flags &= ~(FLAGS_DEVICE_PRESENT | FLAGS_FILE_OPENED); + break; + } + } +} + +//***************************************************************************** +// +// This is called when the data logging is stopped. It performs a sync +// to the file system which should flush any buffered data to the storage +// device. +// +//***************************************************************************** +void +USBStickCloseFile(void) +{ + f_close(&g_sFileObject); + g_ui32Flags &= ~FLAGS_FILE_OPENED; +} + +//***************************************************************************** +// +// Create a file name for the file to be saved on the memory stick. +// This function uses an incrementing numerical search scheme to determine +// an available file name. It tries opening file names in succession until +// it finds a file that does not yet exist. +// The file name will be of the form LOGnnnn.CSV. +// The caller supplies storage for the file name through the pcFilename +// parameter. +// The function will return 0 if successful and non-zero if a file name could +// not be found. +// +//***************************************************************************** +static int32_t +CreateFileName(char *pcFilename, uint32_t ui32Len) +{ + FRESULT iFResult; + uint32_t ui32FileNum = 0; + + // + // Enter loop to search for available file name + // + do + { + // + // Prepare a numerical based file name and attempt to open it + // + usnprintf(pcFilename, ui32Len, "LOG%04d.CSV", ui32FileNum); + iFResult = f_open(&g_sFileObject, pcFilename, FA_OPEN_EXISTING); + + // + // If file does not exist, then we have found a useable file name + // + if(iFResult == FR_NO_FILE) + { + // + // Return to caller, indicating that a file name has been found. + // + return(0); + } + + // + // Otherwise, advance to the next number in the file name sequence. + // + ui32FileNum++; + + } while(ui32FileNum < 1000); + + // + // If we reach this point, it means that no useable file name was found + // after attempting 10000 file names. + // + return(1); +} + +//***************************************************************************** +// +// This is called at the start of logging to open a file on the storage +// device in preparation for saving data. If no file name is specified, then +// a new file will be created. +// +// If a file name is specified, then that will be used instead of searching +// for an available file. The file name that is passed in must be a maximum +// of 8 characters (9 including trailing 0) and represents the first part of +// the file name not including the extension. +// +// The function returns a pointer to the first part of the file name +// (without file extension). It can be up to 8 characters (9 including the +// trailing 0). If there is any error then a NULL pointer is returned. +// +//***************************************************************************** +char * +USBStickOpenLogFile(char *pcFilename8) +{ + FRESULT iFResult; + uint32_t ui32BytesWritten; + static char pcFilename[16]; + uint32_t ui32Len; + + // + // Check state for ready device + // + g_ui32Flags &= ~FLAGS_FILE_OPENED; + if(g_iState == eSTATE_DEVICE_READY) + { + // + // If a file name is specified then open that file + // + if(pcFilename8 && pcFilename8[0]) + { + // + // Copy the filename into local storage and cap at 8 characters + // length. + // + memcpy(pcFilename, pcFilename8, 8); + pcFilename[8] = 0; + + // + // Find the actual length of the string (8 chars or less) so we + // know where to add the extension. + // + ui32Len = strlen(pcFilename); + + // + // Add the extension to the file name. + // + usnprintf(&pcFilename[ui32Len], 5, ".CSV"); + } + + // + // Otherwise no file name was specified so create a new one. + // + else + { + if(CreateFileName(pcFilename, sizeof(pcFilename))) + { + // + // There was a problem creating a file name so return an error + // + return(0); + } + } + + // + // Open the file by name that was determined above. If the file exists + // it will be opened, and if not it will be created. + // + iFResult = f_open(&g_sFileObject, pcFilename, (FA_OPEN_ALWAYS | + FA_WRITE)); + if(iFResult != FR_OK) + { + return(0); + } + + // + // Since it is possible that the file already existed when opened, + // seek to the end of the file so new data will be appended. If this + // is a new file then this will just be the beginning of the file. + // + iFResult = f_lseek(&g_sFileObject, g_sFileObject.fsize); + if(iFResult != FR_OK) + { + return(0); + } + + // + // Set flag to indicate file is now opened. + // + g_ui32Flags |= FLAGS_FILE_OPENED; + + // + // If no file name was specified, then this is a new file so write a + // header line with column titles to the CSV file. + // + if(!pcFilename8 || !pcFilename8[0]) + { + // + // Write a header line to the CSV file + // + iFResult = f_write(&g_sFileObject, g_pcCSVHeaderLine, + sizeof(g_pcCSVHeaderLine), &ui32BytesWritten); + if(iFResult != FR_OK) + { + g_ui32Flags &= ~FLAGS_FILE_OPENED; + return(0); + } + + // + // Since no file name was specified that means a file name was + // created. Terminate the new file name at the '.' separator + // and return it to the caller. We know that created file names + // are always 7 characters. Return the newly created file name + // (the part before the '.') + // + pcFilename[7] = 0; + return(pcFilename); + } + + // + // Otherwise, a file name was specified, so no need to write a + // header row. The caller's file name is unchanged so return the + // same value back. + // + else + { + return(pcFilename8); + } + } + + else + { + // + // Device not ready so return NULL. + // + return(0); + } +} + +//***************************************************************************** +// +// This is called each time there is a new data record to log to the storage +// device. A line of text in CSV format will be written to the file. +// +//***************************************************************************** +int32_t +USBStickWriteRecord(tLogRecord *psRecord) +{ + static char pcBuf[256]; + uint32_t ui32Idx, ui32BufIdx = 0, ui32RecordIdx, ui32Selected; + FRESULT iFResult; + uint32_t ui32BytesWritten; + + // + // Check the arguments + // + ASSERT(psRecord); + if(!psRecord) + { + return(1); + } + + // + // Check state for ready device and opened file + // + if((g_iState != eSTATE_DEVICE_READY) || !(g_ui32Flags & FLAGS_FILE_OPENED)) + { + return(1); + } + + // + // Print time stamp columns + // + ui32BufIdx += usnprintf(&pcBuf[ui32BufIdx], sizeof(pcBuf) - ui32BufIdx, + "%u,%u", psRecord->ui32Seconds, + psRecord->ui16Subseconds); + + // + // Iterate through selected data items and print to CSV buffer + // + ui32RecordIdx = 0; + ui32Selected = psRecord->ui16ItemMask; + for(ui32Idx = 0; ui32Idx < NUM_LOG_ITEMS; ui32Idx++) + { + // + // If this data item is selected, then print a value to the CSV buffer + // + if(ui32Selected & 1) + { + ui32BufIdx += usnprintf(&pcBuf[ui32BufIdx], + (sizeof(pcBuf) - ui32BufIdx), ",%d", + psRecord->pi16Items[ui32RecordIdx]); + ui32RecordIdx++; + } + else + { + // + // Otherwise, this column of data is not selected so emit just a + // comma + // + ui32BufIdx += usnprintf(&pcBuf[ui32BufIdx], + (sizeof(pcBuf) - ui32BufIdx), ","); + } + + // + // Next selected item ... + // + ui32Selected >>= 1; + } + + // + // Append a CRLF to the end + // + ui32BufIdx += usnprintf(&pcBuf[ui32BufIdx], (sizeof(pcBuf) - ui32BufIdx), + "\r\n"); + + // + // Now write the entire buffer to the USB stick file + // + iFResult = f_write(&g_sFileObject, pcBuf, ui32BufIdx, &ui32BytesWritten); + + // + // Check for errors + // + if((iFResult != FR_OK) || (ui32BytesWritten != ui32BufIdx)) + { + // + // Some error occurred + // + g_ui32Flags &= ~FLAGS_FILE_OPENED; + return(1); + } + else + { + // + // No errors occurred, return success + // + return(0); + } +} diff --git a/boards/ek-lm4f232/qs-logger/usbstick.h b/boards/ek-lm4f232/qs-logger/usbstick.h new file mode 100644 index 0000000..d05459a --- /dev/null +++ b/boards/ek-lm4f232/qs-logger/usbstick.h @@ -0,0 +1,58 @@ +//***************************************************************************** +// +// usbstick.h - Prototypes and definitions for USB mass storage module. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** +#ifndef __USBSTICK_H__ +#define __USBSTICK_H__ + +//***************************************************************************** +// +// If building with a C++ compiler, make all of the definitions in this header +// have a C binding. +// +//***************************************************************************** +#ifdef __cplusplus +extern "C" +{ +#endif + +//***************************************************************************** +// +// Module function prototypes. +// +//***************************************************************************** +extern void USBStickInit(void); +extern void USBStickRun(void); +extern void USBStickCloseFile(void); +extern char *USBStickOpenLogFile(char *pcFilename); +extern int32_t USBStickWriteRecord(tLogRecord *psRecord); + +//***************************************************************************** +// +// Mark the end of the C bindings section for C++ compilers. +// +//***************************************************************************** +#ifdef __cplusplus +} +#endif + +#endif // __USBSTICK_H__ diff --git a/boards/ek-lm4f232/sd_card/Makefile b/boards/ek-lm4f232/sd_card/Makefile new file mode 100644 index 0000000..e178347 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/Makefile @@ -0,0 +1,97 @@ +#****************************************************************************** +# +# Makefile - Rules for building the SD card example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../third_party/fatfs/src/option +VPATH+=../../../../third_party/fatfs/port +VPATH+=../../../../third_party/fatfs/src +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. +IPATH+=../../../../third_party + +# +# The default rule, which causes the SD card example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/sd_card.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the SD card example. +# +${COMPILER}/sd_card.axf: ${COMPILER}/cc932.o +${COMPILER}/sd_card.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/sd_card.axf: ${COMPILER}/cmdline.o +${COMPILER}/sd_card.axf: ${COMPILER}/ff.o +${COMPILER}/sd_card.axf: ${COMPILER}/mmc-ek-lm4f232.o +${COMPILER}/sd_card.axf: ${COMPILER}/sd_card.o +${COMPILER}/sd_card.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/sd_card.axf: ${COMPILER}/uartstdio.o +${COMPILER}/sd_card.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/sd_card.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/sd_card.axf: sd_card.ld +SCATTERgcc_sd_card=sd_card.ld +ENTRY_sd_card=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 -DENABLE_LFN + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/sd_card/ccs/.ccsimportspec b/boards/ek-lm4f232/sd_card/ccs/.ccsimportspec new file mode 100644 index 0000000..67417bd --- /dev/null +++ b/boards/ek-lm4f232/sd_card/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/sd_card/ccs/.ccsproject b/boards/ek-lm4f232/sd_card/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/sd_card/ccs/.cproject b/boards/ek-lm4f232/sd_card/ccs/.cproject new file mode 100644 index 0000000..857982b --- /dev/null +++ b/boards/ek-lm4f232/sd_card/ccs/.cproject @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/sd_card/ccs/.project b/boards/ek-lm4f232/sd_card/ccs/.project new file mode 100644 index 0000000..a9e260b --- /dev/null +++ b/boards/ek-lm4f232/sd_card/ccs/.project @@ -0,0 +1,80 @@ + + + sd_card + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + sd_card.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/sd_card/sd_card.c + + + sd_card_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/sd_card/sd_card_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/sd_card/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/cmdline.c + 1 + SW_ROOT/utils/cmdline.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + third_party/fatfs/port/mmc-ek-lm4f232.c + 1 + SW_ROOT/third_party/fatfs/port/mmc-ek-lm4f232.c + + + third_party/fatfs/src/ff.c + 1 + SW_ROOT/third_party/fatfs/src/ff.c + + + third_party/fatfs/src/option/cc932.c + 1 + SW_ROOT/third_party/fatfs/src/option/cc932.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/sd_card/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/sd_card/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.bin b/boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.bin new file mode 100644 index 0000000..9cd26be Binary files /dev/null and b/boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.bin differ diff --git a/boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.out b/boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.out new file mode 100644 index 0000000..e62e155 Binary files /dev/null and b/boards/ek-lm4f232/sd_card/ccs/Debug/sd_card.out differ diff --git a/boards/ek-lm4f232/sd_card/ccs/macros.ini_initial b/boards/ek-lm4f232/sd_card/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/sd_card/ccs/target_config.ccxml b/boards/ek-lm4f232/sd_card/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/sd_card/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.bin b/boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.bin new file mode 100644 index 0000000..7d63e1e Binary files /dev/null and b/boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.bin differ diff --git a/boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.out b/boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.out new file mode 100644 index 0000000..e8ceff5 Binary files /dev/null and b/boards/ek-lm4f232/sd_card/ewarm/Exe/sd_card.out differ diff --git a/boards/ek-lm4f232/sd_card/gcc/sd_card.axf b/boards/ek-lm4f232/sd_card/gcc/sd_card.axf new file mode 100644 index 0000000..3f12774 Binary files /dev/null and b/boards/ek-lm4f232/sd_card/gcc/sd_card.axf differ diff --git a/boards/ek-lm4f232/sd_card/gcc/sd_card.bin b/boards/ek-lm4f232/sd_card/gcc/sd_card.bin new file mode 100644 index 0000000..18422e2 Binary files /dev/null and b/boards/ek-lm4f232/sd_card/gcc/sd_card.bin differ diff --git a/boards/ek-lm4f232/sd_card/readme.txt b/boards/ek-lm4f232/sd_card/readme.txt new file mode 100644 index 0000000..a672140 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/readme.txt @@ -0,0 +1,34 @@ +SD card using FAT file system + +This example application demonstrates reading a file system from an SD +card. It makes use of FatFs, a FAT file system driver. It provides a +simple command console via a serial port for issuing commands to view and +navigate the file system on the SD card. + +The first UART, which is connected to the USB debug virtual serial port on +the evaluation board, is configured for 115,200 bits per second, and 8-N-1 +mode. When the program is started a message will be printed to the +terminal. Type ``help'' for command help. + +For additional details about FatFs, see the following site: +http://elm-chan.org/fsw/ff/00index_e.html + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/sd_card/rvmdk/sd_card.axf b/boards/ek-lm4f232/sd_card/rvmdk/sd_card.axf new file mode 100644 index 0000000..f85bc5b Binary files /dev/null and b/boards/ek-lm4f232/sd_card/rvmdk/sd_card.axf differ diff --git a/boards/ek-lm4f232/sd_card/rvmdk/sd_card.bin b/boards/ek-lm4f232/sd_card/rvmdk/sd_card.bin new file mode 100644 index 0000000..c17ea46 Binary files /dev/null and b/boards/ek-lm4f232/sd_card/rvmdk/sd_card.bin differ diff --git a/boards/ek-lm4f232/sd_card/sd_card.c b/boards/ek-lm4f232/sd_card/sd_card.c new file mode 100644 index 0000000..7c67934 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.c @@ -0,0 +1,915 @@ +//***************************************************************************** +// +// sd_card.c - Example program for reading files from an SD card. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_memmap.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/uart.h" +#include "grlib/grlib.h" +#include "utils/cmdline.h" +#include "utils/uartstdio.h" +#include "fatfs/src/ff.h" +#include "fatfs/src/diskio.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

SD card using FAT file system (sd_card)

+//! +//! This example application demonstrates reading a file system from an SD +//! card. It makes use of FatFs, a FAT file system driver. It provides a +//! simple command console via a serial port for issuing commands to view and +//! navigate the file system on the SD card. +//! +//! The first UART, which is connected to the USB debug virtual serial port on +//! the evaluation board, is configured for 115,200 bits per second, and 8-N-1 +//! mode. When the program is started a message will be printed to the +//! terminal. Type ``help'' for command help. +//! +//! For additional details about FatFs, see the following site: +//! http://elm-chan.org/fsw/ff/00index_e.html +// +//***************************************************************************** + +//***************************************************************************** +// +// Defines the size of the buffers that hold the path, or temporary data from +// the SD card. There are two buffers allocated of this size. The buffer size +// must be large enough to hold the longest expected full path name, including +// the file name, and a trailing null character. +// +//***************************************************************************** +#define PATH_BUF_SIZE 80 + +//***************************************************************************** +// +// Defines the size of the buffer that holds the command line. +// +//***************************************************************************** +#define CMD_BUF_SIZE 64 + +//***************************************************************************** +// +// This buffer holds the full path to the current working directory. Initially +// it is root ("/"). +// +//***************************************************************************** +static char g_pcCwdBuf[PATH_BUF_SIZE] = "/"; + +//***************************************************************************** +// +// A temporary data buffer used when manipulating file paths, or reading data +// from the SD card. +// +//***************************************************************************** +static char g_pcTmpBuf[PATH_BUF_SIZE]; + +//***************************************************************************** +// +// The buffer that holds the command line. +// +//***************************************************************************** +static char g_pcCmdBuf[CMD_BUF_SIZE]; + +//***************************************************************************** +// +// The following are data structures used by FatFs. +// +//***************************************************************************** +static FATFS g_sFatFs; +static DIR g_sDirObject; +static FILINFO g_sFileInfo; +static FIL g_sFileObject; + +//***************************************************************************** +// +// A structure that holds a mapping between an FRESULT numerical code, and a +// string representation. FRESULT codes are returned from the FatFs FAT file +// system driver. +// +//***************************************************************************** +typedef struct +{ + FRESULT iFResult; + char *pcResultStr; +} +tFResultString; + +//***************************************************************************** +// +// A macro to make it easy to add result codes to the table. +// +//***************************************************************************** +#define FRESULT_ENTRY(f) { (f), (#f) } + +//***************************************************************************** +// +// A table that holds a mapping between the numerical FRESULT code and it's +// name as a string. This is used for looking up error codes for printing to +// the console. +// +//***************************************************************************** +tFResultString g_psFResultStrings[] = +{ + FRESULT_ENTRY(FR_OK), + FRESULT_ENTRY(FR_DISK_ERR), + FRESULT_ENTRY(FR_INT_ERR), + FRESULT_ENTRY(FR_NOT_READY), + FRESULT_ENTRY(FR_NO_FILE), + FRESULT_ENTRY(FR_NO_PATH), + FRESULT_ENTRY(FR_INVALID_NAME), + FRESULT_ENTRY(FR_DENIED), + FRESULT_ENTRY(FR_EXIST), + FRESULT_ENTRY(FR_INVALID_OBJECT), + FRESULT_ENTRY(FR_WRITE_PROTECTED), + FRESULT_ENTRY(FR_INVALID_DRIVE), + FRESULT_ENTRY(FR_NOT_ENABLED), + FRESULT_ENTRY(FR_NO_FILESYSTEM), + FRESULT_ENTRY(FR_MKFS_ABORTED), + FRESULT_ENTRY(FR_TIMEOUT), + FRESULT_ENTRY(FR_LOCKED), + FRESULT_ENTRY(FR_NOT_ENOUGH_CORE), + FRESULT_ENTRY(FR_TOO_MANY_OPEN_FILES), + FRESULT_ENTRY(FR_INVALID_PARAMETER), +}; + +//***************************************************************************** +// +// A macro that holds the number of result codes. +// +//***************************************************************************** +#define NUM_FRESULT_CODES (sizeof(g_psFResultStrings) / \ + sizeof(tFResultString)) + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// This function returns a string representation of an error code that was +// returned from a function call to FatFs. It can be used for printing human +// readable error messages. +// +//***************************************************************************** +const char * +StringFromFResult(FRESULT iFResult) +{ + uint_fast8_t ui8Idx; + + // + // Enter a loop to search the error code table for a matching error code. + // + for(ui8Idx = 0; ui8Idx < NUM_FRESULT_CODES; ui8Idx++) + { + // + // If a match is found, then return the string name of the error code. + // + if(g_psFResultStrings[ui8Idx].iFResult == iFResult) + { + return(g_psFResultStrings[ui8Idx].pcResultStr); + } + } + + // + // At this point no matching code was found, so return a string indicating + // an unknown error. + // + return("UNKNOWN ERROR CODE"); +} + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. FatFs requires a timer tick +// every 10 ms for internal timing purposes. +// +//***************************************************************************** +void +SysTickHandler(void) +{ + // + // Call the FatFs tick timer. + // + disk_timerproc(); +} + +//***************************************************************************** +// +// This function implements the "ls" command. It opens the current directory +// and enumerates through the contents, and prints a line for each item it +// finds. It shows details such as file attributes, time and date, and the +// file size, along with the name. It shows a summary of file sizes at the end +// along with free space. +// +//***************************************************************************** +int +Cmd_ls(int argc, char *argv[]) +{ + uint32_t ui32TotalSize; + uint32_t ui32FileCount; + uint32_t ui32DirCount; + FRESULT iFResult; + FATFS *psFatFs; + char *pcFileName; +#if _USE_LFN + char pucLfn[_MAX_LFN + 1]; + g_sFileInfo.lfname = pucLfn; + g_sFileInfo.lfsize = sizeof(pucLfn); +#endif + + + // + // Open the current directory for access. + // + iFResult = f_opendir(&g_sDirObject, g_pcCwdBuf); + + // + // Check for error and return if there is a problem. + // + if(iFResult != FR_OK) + { + return((int)iFResult); + } + + ui32TotalSize = 0; + ui32FileCount = 0; + ui32DirCount = 0; + + // + // Give an extra blank line before the listing. + // + UARTprintf("\n"); + + // + // Enter loop to enumerate through all directory entries. + // + for(;;) + { + // + // Read an entry from the directory. + // + iFResult = f_readdir(&g_sDirObject, &g_sFileInfo); + + // + // Check for error and return if there is a problem. + // + if(iFResult != FR_OK) + { + return((int)iFResult); + } + + // + // If the file name is blank, then this is the end of the listing. + // + if(!g_sFileInfo.fname[0]) + { + break; + } + + // + // If the attribue is directory, then increment the directory count. + // + if(g_sFileInfo.fattrib & AM_DIR) + { + ui32DirCount++; + } + + // + // Otherwise, it is a file. Increment the file count, and add in the + // file size to the total. + // + else + { + ui32FileCount++; + ui32TotalSize += g_sFileInfo.fsize; + } + +#if _USE_LFN + pcFileName = ((*g_sFileInfo.lfname)?g_sFileInfo.lfname:g_sFileInfo.fname); +#else + pcFileName = g_sFileInfo.fname; +#endif + // + // Print the entry information on a single line with formatting to show + // the attributes, date, time, size, and name. + // + UARTprintf("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9u %s\n", + (g_sFileInfo.fattrib & AM_DIR) ? 'D' : '-', + (g_sFileInfo.fattrib & AM_RDO) ? 'R' : '-', + (g_sFileInfo.fattrib & AM_HID) ? 'H' : '-', + (g_sFileInfo.fattrib & AM_SYS) ? 'S' : '-', + (g_sFileInfo.fattrib & AM_ARC) ? 'A' : '-', + (g_sFileInfo.fdate >> 9) + 1980, + (g_sFileInfo.fdate >> 5) & 15, + g_sFileInfo.fdate & 31, + (g_sFileInfo.ftime >> 11), + (g_sFileInfo.ftime >> 5) & 63, + g_sFileInfo.fsize, + pcFileName); + } + + // + // Print summary lines showing the file, dir, and size totals. + // + UARTprintf("\n%4u File(s),%10u bytes total\n%4u Dir(s)", + ui32FileCount, ui32TotalSize, ui32DirCount); + + // + // Get the free space. + // + iFResult = f_getfree("/", (DWORD *)&ui32TotalSize, &psFatFs); + + // + // Check for error and return if there is a problem. + // + if(iFResult != FR_OK) + { + return((int)iFResult); + } + + // + // Display the amount of free space that was calculated. + // + UARTprintf(", %10uK bytes free\n", (ui32TotalSize * + psFatFs->free_clust / 2)); + + // + // Made it to here, return with no errors. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "cd" command. It takes an argument that +// specifies the directory to make the current working directory. Path +// separators must use a forward slash "/". The argument to cd can be one of +// the following: +// +// * root ("/") +// * a fully specified path ("/my/path/to/mydir") +// * a single directory name that is in the current directory ("mydir") +// * parent directory ("..") +// +// It does not understand relative paths, so dont try something like this: +// ("../my/new/path") +// +// Once the new directory is specified, it attempts to open the directory to +// make sure it exists. If the new path is opened successfully, then the +// current working directory (cwd) is changed to the new path. +// +//***************************************************************************** +int +Cmd_cd(int argc, char *argv[]) +{ + uint_fast8_t ui8Idx; + FRESULT iFResult; + + // + // Copy the current working path into a temporary buffer so it can be + // manipulated. + // + strcpy(g_pcTmpBuf, g_pcCwdBuf); + + // + // If the first character is /, then this is a fully specified path, and it + // should just be used as-is. + // + if(argv[1][0] == '/') + { + // + // Make sure the new path is not bigger than the cwd buffer. + // + if(strlen(argv[1]) + 1 > sizeof(g_pcCwdBuf)) + { + UARTprintf("Resulting path name is too long\n"); + return(0); + } + + // + // If the new path name (in argv[1]) is not too long, then copy it + // into the temporary buffer so it can be checked. + // + else + { + strncpy(g_pcTmpBuf, argv[1], sizeof(g_pcTmpBuf)); + } + } + + // + // If the argument is .. then attempt to remove the lowest level on the + // CWD. + // + else if(!strcmp(argv[1], "..")) + { + // + // Get the index to the last character in the current path. + // + ui8Idx = strlen(g_pcTmpBuf) - 1; + + // + // Back up from the end of the path name until a separator (/) is + // found, or until we bump up to the start of the path. + // + while((g_pcTmpBuf[ui8Idx] != '/') && (ui8Idx > 1)) + { + // + // Back up one character. + // + ui8Idx--; + } + + // + // Now we are either at the lowest level separator in the current path, + // or at the beginning of the string (root). So set the new end of + // string here, effectively removing that last part of the path. + // + g_pcTmpBuf[ui8Idx] = 0; + } + + // + // Otherwise this is just a normal path name from the current directory, + // and it needs to be appended to the current path. + // + else + { + // + // Test to make sure that when the new additional path is added on to + // the current path, there is room in the buffer for the full new path. + // It needs to include a new separator, and a trailing null character. + // + if(strlen(g_pcTmpBuf) + strlen(argv[1]) + 1 + 1 > sizeof(g_pcCwdBuf)) + { + UARTprintf("Resulting path name is too long\n"); + return(0); + } + + // + // The new path is okay, so add the separator and then append the new + // directory to the path. + // + else + { + // + // If not already at the root level, then append a / + // + if(strcmp(g_pcTmpBuf, "/")) + { + strcat(g_pcTmpBuf, "/"); + } + + // + // Append the new directory to the path. + // + strcat(g_pcTmpBuf, argv[1]); + } + } + + // + // At this point, a candidate new directory path is in chTmpBuf. Try to + // open it to make sure it is valid. + // + iFResult = f_opendir(&g_sDirObject, g_pcTmpBuf); + + // + // If it can't be opened, then it is a bad path. Inform the user and + // return. + // + if(iFResult != FR_OK) + { + UARTprintf("cd: %s\n", g_pcTmpBuf); + return((int)iFResult); + } + + // + // Otherwise, it is a valid new path, so copy it into the CWD. + // + else + { + strncpy(g_pcCwdBuf, g_pcTmpBuf, sizeof(g_pcCwdBuf)); + } + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "pwd" command. It simply prints the current +// working directory. +// +//***************************************************************************** +int +Cmd_pwd(int argc, char *argv[]) +{ + // + // Print the CWD to the console. + // + UARTprintf("%s\n", g_pcCwdBuf); + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "cat" command. It reads the contents of a file +// and prints it to the console. This should only be used on text files. If +// it is used on a binary file, then a bunch of garbage is likely to printed on +// the console. +// +//***************************************************************************** +int +Cmd_cat(int argc, char *argv[]) +{ + FRESULT iFResult; + uint32_t ui32BytesRead; + + // + // First, check to make sure that the current path (CWD), plus the file + // name, plus a separator and trailing null, will all fit in the temporary + // buffer that will be used to hold the file name. The file name must be + // fully specified, with path, to FatFs. + // + if(strlen(g_pcCwdBuf) + strlen(argv[1]) + 1 + 1 > sizeof(g_pcTmpBuf)) + { + UARTprintf("Resulting path name is too long\n"); + return(0); + } + + // + // Copy the current path to the temporary buffer so it can be manipulated. + // + strcpy(g_pcTmpBuf, g_pcCwdBuf); + + // + // If not already at the root level, then append a separator. + // + if(strcmp("/", g_pcCwdBuf)) + { + strcat(g_pcTmpBuf, "/"); + } + + // + // Now finally, append the file name to result in a fully specified file. + // + strcat(g_pcTmpBuf, argv[1]); + + // + // Open the file for reading. + // + iFResult = f_open(&g_sFileObject, g_pcTmpBuf, FA_READ); + + // + // If there was some problem opening the file, then return an error. + // + if(iFResult != FR_OK) + { + return((int)iFResult); + } + + // + // Enter a loop to repeatedly read data from the file and display it, until + // the end of the file is reached. + // + do + { + // + // Read a block of data from the file. Read as much as can fit in the + // temporary buffer, including a space for the trailing null. + // + iFResult = f_read(&g_sFileObject, g_pcTmpBuf, sizeof(g_pcTmpBuf) - 1, + (UINT *)&ui32BytesRead); + + // + // If there was an error reading, then print a newline and return the + // error to the user. + // + if(iFResult != FR_OK) + { + UARTprintf("\n"); + return((int)iFResult); + } + + // + // Null terminate the last block that was read to make it a null + // terminated string that can be used with printf. + // + g_pcTmpBuf[ui32BytesRead] = 0; + + // + // Print the last chunk of the file that was received. + // + UARTprintf("%s", g_pcTmpBuf); + } + while(ui32BytesRead == sizeof(g_pcTmpBuf) - 1); + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This function implements the "help" command. It prints a simple list of the +// available commands with a brief description. +// +//***************************************************************************** +int +Cmd_help(int argc, char *argv[]) +{ + tCmdLineEntry *psEntry; + + // + // Print some header text. + // + UARTprintf("\nAvailable commands\n"); + UARTprintf("------------------\n"); + + // + // Point at the beginning of the command table. + // + psEntry = &g_psCmdTable[0]; + + // + // Enter a loop to read each entry from the command table. The end of the + // table has been reached when the command name is NULL. + // + while(psEntry->pcCmd) + { + // + // Print the command name and the brief description. + // + UARTprintf("%6s: %s\n", psEntry->pcCmd, psEntry->pcHelp); + + // + // Advance to the next entry in the table. + // + psEntry++; + } + + // + // Return success. + // + return(0); +} + +//***************************************************************************** +// +// This is the table that holds the command names, implementing functions, and +// brief description. +// +//***************************************************************************** +tCmdLineEntry g_psCmdTable[] = +{ + { "help", Cmd_help, "Display list of commands" }, + { "h", Cmd_help, "alias for help" }, + { "?", Cmd_help, "alias for help" }, + { "ls", Cmd_ls, "Display list of files" }, + { "chdir", Cmd_cd, "Change directory" }, + { "cd", Cmd_cd, "alias for chdir" }, + { "pwd", Cmd_pwd, "Show current working directory" }, + { "cat", Cmd_cat, "Show contents of a text file" }, + { 0, 0, 0 } +}; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Configure the UART and its pins. This must be called before UARTprintf(). +// +//***************************************************************************** +void +ConfigureUART(void) +{ + // + // Enable the GPIO Peripheral used by the UART. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Enable UART0 + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Configure GPIO Pins for UART mode. + // + ROM_GPIOPinConfigure(GPIO_PA0_U0RX); + ROM_GPIOPinConfigure(GPIO_PA1_U0TX); + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Initialize the UART for console I/O. + // + UARTStdioConfig(0, 115200, ROM_SysCtlClockGet()); +} + +//***************************************************************************** +// +// The program main function. It performs initialization, then runs a command +// processing loop to read commands from the console. +// +//***************************************************************************** +int +main(void) +{ + int nStatus; + FRESULT iFResult; + tRectangle sRect; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the system clock to run at 50MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Enable the peripherals used by this example. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); + + // + // Configure SysTick for a 100Hz interrupt. The FatFs driver wants a 10 ms + // tick. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Enable Interrupts + // + ROM_IntMasterEnable(); + + // + // Initialize the UART as a console for text I/O. + // + ConfigureUART(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "sd_card", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + + // + // Show some instructions on the display + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "Connect a", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 20, false); + GrStringDrawCentered(&g_sContext, "terminal", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 30, false); + GrStringDrawCentered(&g_sContext, "to UART0.", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 40, false); + GrStringDrawCentered(&g_sContext, "115000,N,8,1", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 50, false); + + // + // Print hello message to user. + // + UARTprintf("\n\nSD Card Example Program\n"); + UARTprintf("Type \'help\' for help.\n"); + + // + // Mount the file system, using logical disk 0. + // + iFResult = f_mount(0, &g_sFatFs); + if(iFResult != FR_OK) + { + UARTprintf("f_mount error: %s\n", StringFromFResult(iFResult)); + return(1); + } + + // + // Enter an infinite loop for reading and processing commands from the + // user. + // + while(1) + { + // + // Print a prompt to the console. Show the CWD. + // + UARTprintf("\n%s> ", g_pcCwdBuf); + + // + // Get a line of text from the user. + // + UARTgets(g_pcCmdBuf, sizeof(g_pcCmdBuf)); + + // + // Pass the line from the user to the command processor. It will be + // parsed and valid commands executed. + // + nStatus = CmdLineProcess(g_pcCmdBuf); + + // + // Handle the case of bad command. + // + if(nStatus == CMDLINE_BAD_CMD) + { + UARTprintf("Bad command!\n"); + } + + // + // Handle the case of too many arguments. + // + else if(nStatus == CMDLINE_TOO_MANY_ARGS) + { + UARTprintf("Too many arguments for command processor!\n"); + } + + // + // Otherwise the command was executed. Print the error code if one was + // returned. + // + else if(nStatus != 0) + { + UARTprintf("Command returned error code %s\n", + StringFromFResult((FRESULT)nStatus)); + } + } +} diff --git a/boards/ek-lm4f232/sd_card/sd_card.ewd b/boards/ek-lm4f232/sd_card/sd_card.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/sd_card/sd_card.ewp b/boards/ek-lm4f232/sd_card/sd_card.ewp new file mode 100644 index 0000000..0691074 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.ewp @@ -0,0 +1,810 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\src\option\cc932.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\..\..\..\..\utils\cmdline.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\src\ff.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + + + $PROJ_DIR$\sd_card.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + diff --git a/boards/ek-lm4f232/sd_card/sd_card.icf b/boards/ek-lm4f232/sd_card/sd_card.icf new file mode 100644 index 0000000..7dd2cc5 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// sd_card.icf - Linker configuration file for sd_card. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/sd_card/sd_card.ld b/boards/ek-lm4f232/sd_card/sd_card.ld new file mode 100644 index 0000000..184f7bd --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * sd_card.ld - Linker configuration file for sd_card. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/sd_card/sd_card.sct b/boards/ek-lm4f232/sd_card/sd_card.sct new file mode 100644 index 0000000..3a64d15 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; sd_card.sct - Linker configuration file for sd_card. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/sd_card/sd_card.uvopt b/boards/ek-lm4f232/sd_card/sd_card.uvopt new file mode 100644 index 0000000..1fd0949 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.uvopt @@ -0,0 +1,387 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + sd_card + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\src\option\cc932.c + cc932.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\cmdline.c + cmdline.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\src\ff.c + ff.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + mmc-ek-lm4f232.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\sd_card.c + sd_card.c + + + 1 + 7 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 9 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 10 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 11 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/sd_card/sd_card.uvproj b/boards/ek-lm4f232/sd_card/sd_card.uvproj new file mode 100644 index 0000000..53114e6 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card.uvproj @@ -0,0 +1,459 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + sd_card + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + sd_card + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\sd_card.bin .\rvmdk\sd_card.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 ENABLE_LFN + + ..;..\..\..\..;..\..\..\..\third_party; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + sd_card.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cc932.c + 1 + ..\..\..\..\third_party\fatfs\src\option\cc932.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + cmdline.c + 1 + ..\..\..\..\utils\cmdline.c + + + ff.c + 1 + ..\..\..\..\third_party\fatfs\src\ff.c + + + mmc-ek-lm4f232.c + 1 + ..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + + + sd_card.c + 1 + .\sd_card.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/sd_card/sd_card_ccs.cmd b/boards/ek-lm4f232/sd_card/sd_card_ccs.cmd new file mode 100644 index 0000000..9987cc4 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/sd_card_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * sd_card_ccs.cmd - CCS linker configuration file for sd_card. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/sd_card/startup_ccs.c b/boards/ek-lm4f232/sd_card/startup_ccs.c new file mode 100644 index 0000000..a8afdf3 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/startup_ccs.c @@ -0,0 +1,302 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/sd_card/startup_ewarm.c b/boards/ek-lm4f232/sd_card/startup_ewarm.c new file mode 100644 index 0000000..73304d6 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/startup_ewarm.c @@ -0,0 +1,333 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/sd_card/startup_gcc.c b/boards/ek-lm4f232/sd_card/startup_gcc.c new file mode 100644 index 0000000..301bae0 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/startup_gcc.c @@ -0,0 +1,349 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/sd_card/startup_rvmdk.S b/boards/ek-lm4f232/sd_card/startup_rvmdk.S new file mode 100644 index 0000000..fa6f713 --- /dev/null +++ b/boards/ek-lm4f232/sd_card/startup_rvmdk.S @@ -0,0 +1,358 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declaration for the interrupt handler used by the application. +; +;****************************************************************************** + EXTERN SysTickHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/sine_demo/Makefile b/boards/ek-lm4f232/sine_demo/Makefile new file mode 100644 index 0000000..5a605e5 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/Makefile @@ -0,0 +1,88 @@ +#****************************************************************************** +# +# Makefile - Rules for building the sine_demo example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the sine_demo example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/sine_demo.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the sine_demo example. +# +${COMPILER}/sine_demo.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/sine_demo.axf: ${COMPILER}/sine_demo.o +${COMPILER}/sine_demo.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/sine_demo.axf: ${COMPILER}/stripchartwidget.o +${COMPILER}/sine_demo.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/sine_demo.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/sine_demo.axf: sine_demo.ld +SCATTERgcc_sine_demo=sine_demo.ld +ENTRY_sine_demo=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/sine_demo/ccs/.ccsimportspec b/boards/ek-lm4f232/sine_demo/ccs/.ccsimportspec new file mode 100644 index 0000000..ca635fe --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/sine_demo/ccs/.ccsproject b/boards/ek-lm4f232/sine_demo/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/sine_demo/ccs/.cproject b/boards/ek-lm4f232/sine_demo/ccs/.cproject new file mode 100644 index 0000000..ed9c022 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/sine_demo/ccs/.project b/boards/ek-lm4f232/sine_demo/ccs/.project new file mode 100644 index 0000000..a53ff56 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/ccs/.project @@ -0,0 +1,60 @@ + + + sine_demo + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + sine_demo.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/sine_demo/sine_demo.c + + + sine_demo_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/sine_demo/sine_demo_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/sine_demo/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + drivers/stripchartwidget.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/stripchartwidget.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/sine_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/sine_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.bin b/boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.bin new file mode 100644 index 0000000..aee3ebd Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.bin differ diff --git a/boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.out b/boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.out new file mode 100644 index 0000000..6486150 Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/ccs/Debug/sine_demo.out differ diff --git a/boards/ek-lm4f232/sine_demo/ccs/macros.ini_initial b/boards/ek-lm4f232/sine_demo/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/sine_demo/ccs/target_config.ccxml b/boards/ek-lm4f232/sine_demo/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.bin b/boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.bin new file mode 100644 index 0000000..6205355 Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.bin differ diff --git a/boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.out b/boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.out new file mode 100644 index 0000000..9563c9b Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/ewarm/Exe/sine_demo.out differ diff --git a/boards/ek-lm4f232/sine_demo/gcc/sine_demo.axf b/boards/ek-lm4f232/sine_demo/gcc/sine_demo.axf new file mode 100644 index 0000000..b00bd8e Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/gcc/sine_demo.axf differ diff --git a/boards/ek-lm4f232/sine_demo/gcc/sine_demo.bin b/boards/ek-lm4f232/sine_demo/gcc/sine_demo.bin new file mode 100644 index 0000000..04c6797 Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/gcc/sine_demo.bin differ diff --git a/boards/ek-lm4f232/sine_demo/readme.txt b/boards/ek-lm4f232/sine_demo/readme.txt new file mode 100644 index 0000000..66990cd --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/readme.txt @@ -0,0 +1,24 @@ +Sine Demo + +This example uses the floating point capabilities of the Tiva C Series +processor to compute a sine wave and show it on the display. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.axf b/boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.axf new file mode 100644 index 0000000..1ceb0e3 Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.axf differ diff --git a/boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.bin b/boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.bin new file mode 100644 index 0000000..51c7b5b Binary files /dev/null and b/boards/ek-lm4f232/sine_demo/rvmdk/sine_demo.bin differ diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.c b/boards/ek-lm4f232/sine_demo/sine_demo.c new file mode 100644 index 0000000..cea2f7d --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.c @@ -0,0 +1,332 @@ +//***************************************************************************** +// +// sine_demo.c - Computes a sine wave and displays it on the screen. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include +#include "driverlib/fpu.h" +#include "driverlib/sysctl.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/stripchartwidget.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Sine Demo (sine_demo)

+//! +//! This example uses the floating point capabilities of the Tiva C Series +//! processor to compute a sine wave and show it on the display. +// +//***************************************************************************** + +//***************************************************************************** +// +// Provide a definition for M_PI, if it was not provided by math.h. +// +//***************************************************************************** +#ifndef M_PI +#define M_PI 3.14159265358979323846F +#endif + +//***************************************************************************** +// +// The number of SysTick ticks per second. +// +//***************************************************************************** +#define TICKS_PER_SECOND 20 +#define FSECONDS_PER_TICK (1.0F / (float)TICKS_PER_SECOND) + +//***************************************************************************** +// +// A counter for system clock ticks, used for tracking time. +// +//***************************************************************************** +static volatile uint32_t g_ui32TickCount; + +//***************************************************************************** +// +// Define an off-screen buffer and display structure. This is used by the +// strip chart widget for drawing a scrolling display. +// +//***************************************************************************** +#define OFFSCREEN_BUF_SIZE GrOffScreen4BPPSize(96, 64) +uint8_t g_pui8OffscreenBuf[OFFSCREEN_BUF_SIZE]; +tDisplay g_sOffscreenDisplay; + +//***************************************************************************** +// +// Create a palette for the off-screen buffer that is used by the strip chart. +// +//***************************************************************************** +uint32_t g_pui32Palette[] = +{ + ClrBlack, + ClrWhite, + ClrRed, + ClrDarkGreen, +}; +#define NUM_PALETTE_ENTRIES (sizeof(g_pui32Palette) / sizeof(uint32_t)) + +//***************************************************************************** +// +// Define the series for the strip chart. The SERIES_LENGTH is the maximum +// number of points that will be shown on the chart. +// +//***************************************************************************** +#define SERIES_LENGTH 96 +static tStripChartSeries g_sSeries = +{ + 0, "SINE", ClrRed, 1, 1, 0, 0 +}; + +//***************************************************************************** +// +// Defines the X-axis for the strip chart +// +//***************************************************************************** +static tStripChartAxis i16Axis16X = +{ + "TIME", // title of axis + 0, // label for minimum of axis + 0, // label for maximum of axis + 0, // minimum value for the axis + 95, // maximum value for the axis + TICKS_PER_SECOND // grid interval for the axis +}; + +//***************************************************************************** +// +// Defines the Y-axis for the strip chart. +// +//***************************************************************************** +static tStripChartAxis i16Axis16Y = +{ + "SIN(2pi*t/4)*0.5", // title of the axis + "-1", // label for minimum of axis + "+1", // label for maximum of axis + -32, // minimum value for the axis + 31, // maximum value for the axis + 16 // grid interval for the axis +}; + +//***************************************************************************** +// +// Defines the strip chart widget. This structure requires additional +// run-time initialization. +// +//***************************************************************************** +StripChart(g_sStripChart, WIDGET_ROOT, 0, 0, &g_sCFAL96x64x16, 0, 0, 96, 64, + 0, g_psFontFixed6x8, ClrBlack, ClrWhite, ClrWhite, ClrDarkGreen, + &i16Axis16X, &i16Axis16Y, &g_sOffscreenDisplay); + +//***************************************************************************** +// +// Creates a buffer for holding the values of the data series. It must be +// large enough to hold the maximum number of data points in the series that +// will be shown on the strip chart. +// +//***************************************************************************** +static int8_t g_i8SeriesData[SERIES_LENGTH]; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. It simply increments a +// counter that is used for timing. +// +//***************************************************************************** +void +SysTickHandler(void) +{ + // + // Update our tick counter. + // + g_ui32TickCount++; +} + +//***************************************************************************** +// +// Compute and display a sine wave. +// +//***************************************************************************** +int +main(void) +{ + uint_fast16_t ui16ItemCount = 0; + uint32_t ui32LastTickCount = 0; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly at 50 MHz. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | + SYSCTL_OSC_MAIN); + + // + // Configure SysTick to generate a periodic time tick interrupt. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize an offscreen display and assign the palette. This offscreen + // buffer is needed by the strip chart widget. + // + GrOffScreen4BPPInit(&g_sOffscreenDisplay, g_pui8OffscreenBuf, 96, 64); + GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplay, g_pui32Palette, 0, + NUM_PALETTE_ENTRIES); + + // + // Set the data series buffer pointer to point at the storage where the + // series data points will be stored. + // + g_sSeries.pvData = g_i8SeriesData; + + // + // Add the series to the strip chart + // + StripChartSeriesAdd(&g_sStripChart, &g_sSeries); + + // + // Add the strip chart to the widget tree. + // + WidgetAdd(WIDGET_ROOT, &g_sStripChart.sBase); + + // + // Enter a loop to continuously calculate a sine wave. + // + while(1) + { + float fElapsedTime; + float fRadians; + float fSine; + + // + // Wait for the next timer tick. + // + while(ui32LastTickCount == g_ui32TickCount) + { + } + ui32LastTickCount = g_ui32TickCount; + + // + // Preparing to add a new data point to the strip chart ... + // If the number count of items in the strip chart has reached the + // maximum value, then the data points need to "slide down" in the + // buffer so new data can be added at the end. + // + if(ui16ItemCount == SERIES_LENGTH) + { + memmove(&g_i8SeriesData[0], &g_i8SeriesData[1], SERIES_LENGTH - 1); + } + + // + // Otherwise, the series data buffer is less than full so just + // increment the count of data points. + // + else + { + // + // Increment the number of items that have been added to the strip + // chart series data buffer. + // + ui16ItemCount++; + + // + // Since the count of data items has changed, it must be updated in + // the data series. + // + g_sSeries.ui16NumItems = ui16ItemCount; + } + + // + // Compute the elapsed time in decimal seconds, in floating point + // format. + // + fElapsedTime = (float)g_ui32TickCount * FSECONDS_PER_TICK; + + // + // Convert the time to radians. + // + fRadians = fElapsedTime * 2.0 * (float)M_PI; + + // + // Adjust the period of the wave. This will give us a wave period + // of 4 seconds, or 0.25 Hz. This number was chosen arbitrarily to + // provide a nice looking wave on the display. + // + fRadians /= 4.0; + + // + // Compute the sine. Multiply by 0.5 to reduce the amplitude. + // + fSine = sinf(fRadians) * 0.5; + + // + // Finally, save the sine value into the last location in the series + // data point buffer. Convert the sine amplitude to display pixels. + // (Amplitude 1 = 32 pixels) + // + g_i8SeriesData[ui16ItemCount - 1] = (int8_t)(fSine * 32.0); + + // + // Now that a new data point has been added to the series, advance + // the strip chart. + // + StripChartAdvance(&g_sStripChart, 1); + + // + // Request a repaint and run the widget processing queue. + // + WidgetPaint(WIDGET_ROOT); + WidgetMessageQueueProcess(); + } +} diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.ewd b/boards/ek-lm4f232/sine_demo/sine_demo.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.ewp b/boards/ek-lm4f232/sine_demo/sine_demo.ewp new file mode 100644 index 0000000..2914c9a --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.ewp @@ -0,0 +1,795 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\sine_demo.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\drivers\stripchartwidget.c + + + diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.icf b/boards/ek-lm4f232/sine_demo/sine_demo.icf new file mode 100644 index 0000000..c8f6fda --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// sine_demo.icf - Linker configuration file for sine_demo. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.ld b/boards/ek-lm4f232/sine_demo/sine_demo.ld new file mode 100644 index 0000000..d9c4a58 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * sine_demo.ld - Linker configuration file for sine_demo. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.sct b/boards/ek-lm4f232/sine_demo/sine_demo.sct new file mode 100644 index 0000000..a994555 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; sine_demo.sct - Linker configuration file for sine_demo. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.uvopt b/boards/ek-lm4f232/sine_demo/sine_demo.uvopt new file mode 100644 index 0000000..999661b --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.uvopt @@ -0,0 +1,331 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + sine_demo + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\sine_demo.c + sine_demo.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\stripchartwidget.c + stripchartwidget.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 7 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/sine_demo/sine_demo.uvproj b/boards/ek-lm4f232/sine_demo/sine_demo.uvproj new file mode 100644 index 0000000..3073c84 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo.uvproj @@ -0,0 +1,439 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + sine_demo + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + sine_demo + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\sine_demo.bin .\rvmdk\sine_demo.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + sine_demo.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + sine_demo.c + 1 + .\sine_demo.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + stripchartwidget.c + 1 + ..\drivers\stripchartwidget.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/sine_demo/sine_demo_ccs.cmd b/boards/ek-lm4f232/sine_demo/sine_demo_ccs.cmd new file mode 100644 index 0000000..837e829 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/sine_demo_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * sine_demo_ccs.cmd - CCS linker configuration file for sine_demo. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/sine_demo/startup_ccs.c b/boards/ek-lm4f232/sine_demo/startup_ccs.c new file mode 100644 index 0000000..a8afdf3 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/startup_ccs.c @@ -0,0 +1,302 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/sine_demo/startup_ewarm.c b/boards/ek-lm4f232/sine_demo/startup_ewarm.c new file mode 100644 index 0000000..73304d6 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/startup_ewarm.c @@ -0,0 +1,333 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/sine_demo/startup_gcc.c b/boards/ek-lm4f232/sine_demo/startup_gcc.c new file mode 100644 index 0000000..301bae0 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/startup_gcc.c @@ -0,0 +1,349 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/sine_demo/startup_rvmdk.S b/boards/ek-lm4f232/sine_demo/startup_rvmdk.S new file mode 100644 index 0000000..fa6f713 --- /dev/null +++ b/boards/ek-lm4f232/sine_demo/startup_rvmdk.S @@ -0,0 +1,358 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declaration for the interrupt handler used by the application. +; +;****************************************************************************** + EXTERN SysTickHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/softuart_echo/Makefile b/boards/ek-lm4f232/softuart_echo/Makefile new file mode 100644 index 0000000..b44c14c --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/Makefile @@ -0,0 +1,89 @@ +#****************************************************************************** +# +# Makefile - Rules for building the softuart_echo example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the softuart_echo example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/softuart_echo.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the softuart_echo example. +# +${COMPILER}/softuart_echo.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/softuart_echo.axf: ${COMPILER}/softuart.o +${COMPILER}/softuart_echo.axf: ${COMPILER}/softuart_echo.o +${COMPILER}/softuart_echo.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/softuart_echo.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/softuart_echo.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/softuart_echo.axf: softuart_echo.ld +SCATTERgcc_softuart_echo=softuart_echo.ld +ENTRY_softuart_echo=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/softuart_echo/ccs/.ccsimportspec b/boards/ek-lm4f232/softuart_echo/ccs/.ccsimportspec new file mode 100644 index 0000000..d6f1e4d --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/softuart_echo/ccs/.ccsproject b/boards/ek-lm4f232/softuart_echo/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/softuart_echo/ccs/.cproject b/boards/ek-lm4f232/softuart_echo/ccs/.cproject new file mode 100644 index 0000000..033cc86 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/softuart_echo/ccs/.project b/boards/ek-lm4f232/softuart_echo/ccs/.project new file mode 100644 index 0000000..2f371ab --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/ccs/.project @@ -0,0 +1,60 @@ + + + softuart_echo + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + softuart_echo.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/softuart_echo/softuart_echo.c + + + softuart_echo_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/softuart_echo/softuart_echo_ccs.cmd + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/softuart_echo/startup_ccs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/softuart.c + 1 + SW_ROOT/utils/softuart.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/softuart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/softuart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.bin b/boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.bin new file mode 100644 index 0000000..343b1e3 Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.bin differ diff --git a/boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.out b/boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.out new file mode 100644 index 0000000..79e5e17 Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/ccs/Debug/softuart_echo.out differ diff --git a/boards/ek-lm4f232/softuart_echo/ccs/macros.ini_initial b/boards/ek-lm4f232/softuart_echo/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/softuart_echo/ccs/target_config.ccxml b/boards/ek-lm4f232/softuart_echo/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.bin b/boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.bin new file mode 100644 index 0000000..2c3aca4 Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.bin differ diff --git a/boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.out b/boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.out new file mode 100644 index 0000000..f8c7655 Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/ewarm/Exe/softuart_echo.out differ diff --git a/boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.axf b/boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.axf new file mode 100644 index 0000000..abb646f Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.axf differ diff --git a/boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.bin b/boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.bin new file mode 100644 index 0000000..cddbacf Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/gcc/softuart_echo.bin differ diff --git a/boards/ek-lm4f232/softuart_echo/readme.txt b/boards/ek-lm4f232/softuart_echo/readme.txt new file mode 100644 index 0000000..1f1aca0 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/readme.txt @@ -0,0 +1,27 @@ +SoftUART Echo + +This example application utilizes the SoftUART to echo text. The SoftUART +is configured to use the same pins as the first UART (connected to the FTDI +virtual serial port on the evaluation board), at 115,200 baud, 8-n-1 mode. +All characters received on the SoftUART are transmitted back to the +SoftUART. + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.axf b/boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.axf new file mode 100644 index 0000000..39e5863 Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.axf differ diff --git a/boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.bin b/boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.bin new file mode 100644 index 0000000..6ea4936 Binary files /dev/null and b/boards/ek-lm4f232/softuart_echo/rvmdk/softuart_echo.bin differ diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.c b/boards/ek-lm4f232/softuart_echo/softuart_echo.c new file mode 100644 index 0000000..25192a7 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.c @@ -0,0 +1,368 @@ +//***************************************************************************** +// +// softuart_echo.c - Example for reading data from and writing data to the +// SoftUART. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "driverlib/debug.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/rom.h" +#include "driverlib/sysctl.h" +#include "driverlib/timer.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" +#include "utils/softuart.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

SoftUART Echo (softuart_echo)

+//! +//! This example application utilizes the SoftUART to echo text. The SoftUART +//! is configured to use the same pins as the first UART (connected to the FTDI +//! virtual serial port on the evaluation board), at 115,200 baud, 8-n-1 mode. +//! All characters received on the SoftUART are transmitted back to the +//! SoftUART. +// +//***************************************************************************** + +//***************************************************************************** +// +// The instance data for the SoftUART module. +// +//***************************************************************************** +static tSoftUART g_sUART; + +//***************************************************************************** +// +// The buffer to be used for the SoftUART transmit buffer. +// +//***************************************************************************** +static uint8_t g_pui8TxBuffer[64]; + +//***************************************************************************** +// +// The buffer to be used for the SoftUART receive buffer. +// +//***************************************************************************** +static uint16_t g_pui16RxBuffer[64]; + +//***************************************************************************** +// +// The number of processor clocks in the time period of a single bit on the +// SoftUART interface. +// +//***************************************************************************** +static uint32_t g_ui32BitTime; + +//***************************************************************************** +// +// A flag that is set in the SoftUART "interrupt" handler when there are +// characters in the receive buffer that need to be read. +// +//***************************************************************************** +static volatile uint32_t g_ui32Flag = 0; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// The interrupt handler for the SoftUART transmit timer interrupt. +// +//***************************************************************************** +void +Timer0AIntHandler(void) +{ + // + // Clear the timer interrupt. + // + ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); + + // + // Call the SoftUART transmit timer tick function. + // + SoftUARTTxTimerTick(&g_sUART); +} + +//***************************************************************************** +// +// The interrupt handler for the SoftUART receive timer interrupt. +// +//***************************************************************************** +void +Timer0BIntHandler(void) +{ + // + // Clear the timer interrupt. + // + ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT); + + // + // Call the SoftUART receive timer tick function, and see if the timer + // should be disabled. + // + if(SoftUARTRxTick(&g_sUART, false) == SOFTUART_RXTIMER_END) + { + // + // Disable the timer interrupt since the SoftUART doesn't need it any + // longer. + // + ROM_TimerDisable(TIMER0_BASE, TIMER_B); + } +} + +//***************************************************************************** +// +// The interrupt handler for the SoftUART GPIO edge interrupt. +// +//***************************************************************************** +void +GPIOAIntHandler(void) +{ + // + // Configure the SoftUART receive timer so that it will sample at the + // mid-bit time of this character. + // + ROM_TimerDisable(TIMER0_BASE, TIMER_B); + ROM_TimerLoadSet(TIMER0_BASE, TIMER_B, g_ui32BitTime); + ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT); + ROM_TimerEnable(TIMER0_BASE, TIMER_B); + + // + // Call the SoftUART receive timer tick function. + // + SoftUARTRxTick(&g_sUART, true); +} + +//***************************************************************************** +// +// The SoftUART "interrupt" handler. +// +//***************************************************************************** +void +SoftUARTIntHandler(void) +{ + uint32_t ui32Status; + + // + // Get the interrrupt status. + // + ui32Status = SoftUARTIntStatus(&g_sUART, true); + + // + // Clear the asserted interrupts. + // + SoftUARTIntClear(&g_sUART, ui32Status); + + // + // Set the flag indicating that there are characters to be read from the + // receive buffer. This is done instead of reading the characters here in + // order to minimize the amount of time spent in the "interrupt" handler + // (which is important at higher baud rates). + // + g_ui32Flag = 1; +} + +//***************************************************************************** +// +// Send a string to the UART. +// +//***************************************************************************** +void +UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count) +{ + // + // Loop while there are more characters to send. + // + while(ui32Count--) + { + // + // Write the next character to the UART. + // + SoftUARTCharPut(&g_sUART, *pui8Buffer++); + } +} + +//***************************************************************************** +// +// This example demonstrates how to send a string of data to the UART. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + tContext sContext; + + // + // Set the clocking to run at 50 MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "softuart-echo", -1, + GrContextDpyWidthGet(&sContext) / 2, 4, 0); + + // + // Initialize the display and write some instructions. + // + GrStringDrawCentered(&sContext, "Connect a", -1, + GrContextDpyWidthGet(&sContext) / 2, 20, false); + GrStringDrawCentered(&sContext, "terminal", -1, + GrContextDpyWidthGet(&sContext) / 2, 30, false); + GrStringDrawCentered(&sContext, "to UART0.", -1, + GrContextDpyWidthGet(&sContext) / 2, 40, false); + GrStringDrawCentered(&sContext, "115000,N,8,1", -1, + GrContextDpyWidthGet(&sContext) / 2, 50, false); + + // + // Enable the peripherals used by this example. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); + + // + // Compute the bit time for 115,200 baud. + // + g_ui32BitTime = (ROM_SysCtlClockGet() / 115200) - 1; + + // + // Configure the SoftUART for 8-N-1 operation. + // + SoftUARTInit(&g_sUART); + SoftUARTRxGPIOSet(&g_sUART, GPIO_PORTA_BASE, GPIO_PIN_0); + SoftUARTTxGPIOSet(&g_sUART, GPIO_PORTA_BASE, GPIO_PIN_1); + SoftUARTRxBufferSet(&g_sUART, g_pui16RxBuffer, + sizeof(g_pui16RxBuffer) / sizeof(g_pui16RxBuffer[0])); + SoftUARTTxBufferSet(&g_sUART, g_pui8TxBuffer, sizeof(g_pui8TxBuffer)); + SoftUARTCallbackSet(&g_sUART, SoftUARTIntHandler); + SoftUARTConfigSet(&g_sUART, + (SOFTUART_CONFIG_WLEN_8 | SOFTUART_CONFIG_STOP_ONE | + SOFTUART_CONFIG_PAR_NONE)); + + // + // Configure the timer for the SoftUART transmitter. + // + ROM_TimerConfigure(TIMER0_BASE, + (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PERIODIC | + TIMER_CFG_B_PERIODIC)); + ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, g_ui32BitTime); + ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT | TIMER_TIMB_TIMEOUT); + ROM_TimerEnable(TIMER0_BASE, TIMER_A); + + // + // Set the priorities of the interrupts associated with the SoftUART. The + // receiver is higher priority than the transmitter, and the receiver edge + // interrupt is higher priority than the receiver timer interrupt. + // + ROM_IntPrioritySet(INT_GPIOA, 0x00); + ROM_IntPrioritySet(INT_TIMER0B, 0x40); + ROM_IntPrioritySet(INT_TIMER0A, 0x80); + + // + // Enable the interrupts associated with the SoftUART. + // + ROM_IntEnable(INT_TIMER0A); + ROM_IntEnable(INT_TIMER0B); + ROM_IntEnable(INT_GPIOA); + + // + // Prompt for text to be entered. + // + UARTSend((uint8_t *)"\033[2JEnter text: ", 16); + + // + // Enable the SoftUART interrupt. + // + SoftUARTIntEnable(&g_sUART, SOFTUART_INT_RX | SOFTUART_INT_RT); + + // + // Loop forever echoing data through the UART. + // + while(1) + { + // + // Wait until there are characters available in the receive buffer. + // + while(g_ui32Flag == 0) + { + } + g_ui32Flag = 0; + + // + // Loop while there are characters in the receive buffer. + // + while(SoftUARTCharsAvail(&g_sUART)) + { + // + // Read the next character from the UART and write it back to the + // UART. + // + SoftUARTCharPutNonBlocking(&g_sUART, + SoftUARTCharGetNonBlocking(&g_sUART)); + } + } +} diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.ewd b/boards/ek-lm4f232/softuart_echo/softuart_echo.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.ewp b/boards/ek-lm4f232/softuart_echo/softuart_echo.ewp new file mode 100644 index 0000000..977191a --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.ewp @@ -0,0 +1,795 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\..\..\..\..\utils\softuart.c + + + $PROJ_DIR$\softuart_echo.c + + + $PROJ_DIR$\startup_ewarm.c + + + diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.icf b/boards/ek-lm4f232/softuart_echo/softuart_echo.icf new file mode 100644 index 0000000..1eb5dd1 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// softuart_echo.icf - Linker configuration file for softuart_echo. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.ld b/boards/ek-lm4f232/softuart_echo/softuart_echo.ld new file mode 100644 index 0000000..bb5e1fb --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * softuart_echo.ld - Linker configuration file for softuart_echo. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.sct b/boards/ek-lm4f232/softuart_echo/softuart_echo.sct new file mode 100644 index 0000000..0f3ccc5 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; softuart_echo.sct - Linker configuration file for softuart_echo. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.uvopt b/boards/ek-lm4f232/softuart_echo/softuart_echo.uvopt new file mode 100644 index 0000000..469d637 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.uvopt @@ -0,0 +1,331 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + softuart_echo + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\softuart.c + softuart.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\softuart_echo.c + softuart_echo.c + + + 1 + 4 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + + + Libraries + 1 + 0 + 0 + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 7 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo.uvproj b/boards/ek-lm4f232/softuart_echo/softuart_echo.uvproj new file mode 100644 index 0000000..88f3806 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo.uvproj @@ -0,0 +1,439 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + softuart_echo + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + softuart_echo + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\softuart_echo.bin .\rvmdk\softuart_echo.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + softuart_echo.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + softuart.c + 1 + ..\..\..\..\utils\softuart.c + + + softuart_echo.c + 1 + .\softuart_echo.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/softuart_echo/softuart_echo_ccs.cmd b/boards/ek-lm4f232/softuart_echo/softuart_echo_ccs.cmd new file mode 100644 index 0000000..c8bf4bd --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/softuart_echo_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * softuart_echo_ccs.cmd - CCS linker configuration file for softuart_echo. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; diff --git a/boards/ek-lm4f232/softuart_echo/startup_ccs.c b/boards/ek-lm4f232/softuart_echo/startup_ccs.c new file mode 100644 index 0000000..23b6c06 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/startup_ccs.c @@ -0,0 +1,304 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void GPIOAIntHandler(void); +extern void Timer0AIntHandler(void); +extern void Timer0BIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + GPIOAIntHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + Timer0AIntHandler, // Timer 0 subtimer A + Timer0BIntHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/softuart_echo/startup_ewarm.c b/boards/ek-lm4f232/softuart_echo/startup_ewarm.c new file mode 100644 index 0000000..56f8a74 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/startup_ewarm.c @@ -0,0 +1,335 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void GPIOAIntHandler(void); +extern void Timer0AIntHandler(void); +extern void Timer0BIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + GPIOAIntHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + Timer0AIntHandler, // Timer 0 subtimer A + Timer0BIntHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/softuart_echo/startup_gcc.c b/boards/ek-lm4f232/softuart_echo/startup_gcc.c new file mode 100644 index 0000000..e5f3327 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/startup_gcc.c @@ -0,0 +1,351 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void GPIOAIntHandler(void); +extern void Timer0AIntHandler(void); +extern void Timer0BIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + GPIOAIntHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + Timer0AIntHandler, // Timer 0 subtimer A + Timer0BIntHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/softuart_echo/startup_rvmdk.S b/boards/ek-lm4f232/softuart_echo/startup_rvmdk.S new file mode 100644 index 0000000..488f1a6 --- /dev/null +++ b/boards/ek-lm4f232/softuart_echo/startup_rvmdk.S @@ -0,0 +1,360 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN GPIOAIntHandler + EXTERN Timer0AIntHandler + EXTERN Timer0BIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD GPIOAIntHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD Timer0AIntHandler ; Timer 0 subtimer A + DCD Timer0BIntHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/timers/Makefile b/boards/ek-lm4f232/timers/Makefile new file mode 100644 index 0000000..3d0d9b6 --- /dev/null +++ b/boards/ek-lm4f232/timers/Makefile @@ -0,0 +1,87 @@ +#****************************************************************************** +# +# Makefile - Rules for building the timers example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the timers example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/timers.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the timers example. +# +${COMPILER}/timers.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/timers.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/timers.axf: ${COMPILER}/timers.o +${COMPILER}/timers.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/timers.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/timers.axf: timers.ld +SCATTERgcc_timers=timers.ld +ENTRY_timers=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/timers/ccs/.ccsimportspec b/boards/ek-lm4f232/timers/ccs/.ccsimportspec new file mode 100644 index 0000000..e61983c --- /dev/null +++ b/boards/ek-lm4f232/timers/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/timers/ccs/.ccsproject b/boards/ek-lm4f232/timers/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/timers/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/timers/ccs/.cproject b/boards/ek-lm4f232/timers/ccs/.cproject new file mode 100644 index 0000000..e743744 --- /dev/null +++ b/boards/ek-lm4f232/timers/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/timers/ccs/.project b/boards/ek-lm4f232/timers/ccs/.project new file mode 100644 index 0000000..a9fe743 --- /dev/null +++ b/boards/ek-lm4f232/timers/ccs/.project @@ -0,0 +1,55 @@ + + + timers + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/timers/startup_ccs.c + + + timers.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/timers/timers.c + + + timers_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/timers/timers_ccs.cmd + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/timers/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/timers/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/timers/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/timers/ccs/Debug/timers.bin b/boards/ek-lm4f232/timers/ccs/Debug/timers.bin new file mode 100644 index 0000000..e16aed5 Binary files /dev/null and b/boards/ek-lm4f232/timers/ccs/Debug/timers.bin differ diff --git a/boards/ek-lm4f232/timers/ccs/Debug/timers.out b/boards/ek-lm4f232/timers/ccs/Debug/timers.out new file mode 100644 index 0000000..665163c Binary files /dev/null and b/boards/ek-lm4f232/timers/ccs/Debug/timers.out differ diff --git a/boards/ek-lm4f232/timers/ccs/macros.ini_initial b/boards/ek-lm4f232/timers/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/timers/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/timers/ccs/target_config.ccxml b/boards/ek-lm4f232/timers/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/timers/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/timers/ewarm/Exe/timers.bin b/boards/ek-lm4f232/timers/ewarm/Exe/timers.bin new file mode 100644 index 0000000..33de757 Binary files /dev/null and b/boards/ek-lm4f232/timers/ewarm/Exe/timers.bin differ diff --git a/boards/ek-lm4f232/timers/ewarm/Exe/timers.out b/boards/ek-lm4f232/timers/ewarm/Exe/timers.out new file mode 100644 index 0000000..0fb5e38 Binary files /dev/null and b/boards/ek-lm4f232/timers/ewarm/Exe/timers.out differ diff --git a/boards/ek-lm4f232/timers/gcc/timers.axf b/boards/ek-lm4f232/timers/gcc/timers.axf new file mode 100644 index 0000000..fe81ee2 Binary files /dev/null and b/boards/ek-lm4f232/timers/gcc/timers.axf differ diff --git a/boards/ek-lm4f232/timers/gcc/timers.bin b/boards/ek-lm4f232/timers/gcc/timers.bin new file mode 100644 index 0000000..9705675 Binary files /dev/null and b/boards/ek-lm4f232/timers/gcc/timers.bin differ diff --git a/boards/ek-lm4f232/timers/readme.txt b/boards/ek-lm4f232/timers/readme.txt new file mode 100644 index 0000000..5ca01a2 --- /dev/null +++ b/boards/ek-lm4f232/timers/readme.txt @@ -0,0 +1,26 @@ +Timer + +This example application demonstrates the use of the timers to generate +periodic interrupts. One timer is set up to interrupt once per second and +the other to interrupt twice per second; each interrupt handler will toggle +its own indicator on the display. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/timers/rvmdk/timers.axf b/boards/ek-lm4f232/timers/rvmdk/timers.axf new file mode 100644 index 0000000..5728bd9 Binary files /dev/null and b/boards/ek-lm4f232/timers/rvmdk/timers.axf differ diff --git a/boards/ek-lm4f232/timers/rvmdk/timers.bin b/boards/ek-lm4f232/timers/rvmdk/timers.bin new file mode 100644 index 0000000..d15d0cc Binary files /dev/null and b/boards/ek-lm4f232/timers/rvmdk/timers.bin differ diff --git a/boards/ek-lm4f232/timers/startup_ccs.c b/boards/ek-lm4f232/timers/startup_ccs.c new file mode 100644 index 0000000..f5f23e1 --- /dev/null +++ b/boards/ek-lm4f232/timers/startup_ccs.c @@ -0,0 +1,303 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void Timer0IntHandler(void); +extern void Timer1IntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + Timer0IntHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + Timer1IntHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/timers/startup_ewarm.c b/boards/ek-lm4f232/timers/startup_ewarm.c new file mode 100644 index 0000000..58e9648 --- /dev/null +++ b/boards/ek-lm4f232/timers/startup_ewarm.c @@ -0,0 +1,334 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void Timer0IntHandler(void); +extern void Timer1IntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + Timer0IntHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + Timer1IntHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/timers/startup_gcc.c b/boards/ek-lm4f232/timers/startup_gcc.c new file mode 100644 index 0000000..3237b94 --- /dev/null +++ b/boards/ek-lm4f232/timers/startup_gcc.c @@ -0,0 +1,350 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void Timer0IntHandler(void); +extern void Timer1IntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + Timer0IntHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + Timer1IntHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/timers/startup_rvmdk.S b/boards/ek-lm4f232/timers/startup_rvmdk.S new file mode 100644 index 0000000..94cd075 --- /dev/null +++ b/boards/ek-lm4f232/timers/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN Timer0IntHandler + EXTERN Timer1IntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD Timer0IntHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD Timer1IntHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/timers/timers.c b/boards/ek-lm4f232/timers/timers.c new file mode 100644 index 0000000..15c0f58 --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.c @@ -0,0 +1,234 @@ +//***************************************************************************** +// +// timers.c - Timers example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/timer.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Timer (timers)

+//! +//! This example application demonstrates the use of the timers to generate +//! periodic interrupts. One timer is set up to interrupt once per second and +//! the other to interrupt twice per second; each interrupt handler will toggle +//! its own indicator on the display. +// +//***************************************************************************** + +//***************************************************************************** +// +// Flags that contain the current value of the interrupt indicator as displayed +// on the CSTN display. +// +//***************************************************************************** +uint32_t g_ui32Flags; + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// The interrupt handler for the first timer interrupt. +// +//***************************************************************************** +void +Timer0IntHandler(void) +{ + // + // Clear the timer interrupt. + // + ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); + + // + // Toggle the flag for the first timer. + // + HWREGBITW(&g_ui32Flags, 0) ^= 1; + + // + // Update the interrupt status on the display. + // + ROM_IntMasterDisable(); + GrStringDraw(&g_sContext, (HWREGBITW(&g_ui32Flags, 0) ? "1" : "0"), -1, 68, + 26, 1); + ROM_IntMasterEnable(); +} + +//***************************************************************************** +// +// The interrupt handler for the second timer interrupt. +// +//***************************************************************************** +void +Timer1IntHandler(void) +{ + // + // Clear the timer interrupt. + // + ROM_TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); + + // + // Toggle the flag for the second timer. + // + HWREGBITW(&g_ui32Flags, 1) ^= 1; + + // + // Update the interrupt status on the display. + // + ROM_IntMasterDisable(); + GrStringDraw(&g_sContext, (HWREGBITW(&g_ui32Flags, 1) ? "1" : "0"), -1, 68, + 36, 1); + ROM_IntMasterEnable(); +} + +//***************************************************************************** +// +// This example application demonstrates the use of the timers to generate +// periodic interrupts. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context and find the middle X coordinate. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "timers", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + + // + // Initialize timer status display. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDraw(&g_sContext, "Timer 0:", -1, 16, 26, 0); + GrStringDraw(&g_sContext, "Timer 1:", -1, 16, 36, 0); + + // + // Enable the peripherals used by this example. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1); + + // + // Enable processor interrupts. + // + ROM_IntMasterEnable(); + + // + // Configure the two 32-bit periodic timers. + // + ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); + ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC); + ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet()); + ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, ROM_SysCtlClockGet() / 2); + + // + // Setup the interrupts for the timer timeouts. + // + ROM_IntEnable(INT_TIMER0A); + ROM_IntEnable(INT_TIMER1A); + ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); + ROM_TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT); + + // + // Enable the timers. + // + ROM_TimerEnable(TIMER0_BASE, TIMER_A); + ROM_TimerEnable(TIMER1_BASE, TIMER_A); + + // + // Loop forever while the timers run. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/timers/timers.ewd b/boards/ek-lm4f232/timers/timers.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/timers/timers.ewp b/boards/ek-lm4f232/timers/timers.ewp new file mode 100644 index 0000000..edbbbc2 --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.ewp @@ -0,0 +1,792 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\timers.c + + + diff --git a/boards/ek-lm4f232/timers/timers.icf b/boards/ek-lm4f232/timers/timers.icf new file mode 100644 index 0000000..1d5a75f --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// timers.icf - Linker configuration file for timers. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/timers/timers.ld b/boards/ek-lm4f232/timers/timers.ld new file mode 100644 index 0000000..be7699c --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * timers.ld - Linker configuration file for timers. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/timers/timers.sct b/boards/ek-lm4f232/timers/timers.sct new file mode 100644 index 0000000..2e5c1d9 --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; timers.sct - Linker configuration file for timers. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/timers/timers.uvopt b/boards/ek-lm4f232/timers/timers.uvopt new file mode 100644 index 0000000..6f4178e --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.uvopt @@ -0,0 +1,317 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + timers + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\timers.c + timers.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 6 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/timers/timers.uvproj b/boards/ek-lm4f232/timers/timers.uvproj new file mode 100644 index 0000000..880ed60 --- /dev/null +++ b/boards/ek-lm4f232/timers/timers.uvproj @@ -0,0 +1,434 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + timers + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + timers + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\timers.bin .\rvmdk\timers.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + timers.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + timers.c + 1 + .\timers.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/timers/timers_ccs.cmd b/boards/ek-lm4f232/timers/timers_ccs.cmd new file mode 100644 index 0000000..be987c1 --- /dev/null +++ b/boards/ek-lm4f232/timers/timers_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * timers_ccs.cmd - CCS linker configuration file for timers. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/uart_echo/Makefile b/boards/ek-lm4f232/uart_echo/Makefile new file mode 100644 index 0000000..ecaebab --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/Makefile @@ -0,0 +1,87 @@ +#****************************************************************************** +# +# Makefile - Rules for building the uart_echo example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the uart_echo example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/uart_echo.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the uart_echo example. +# +${COMPILER}/uart_echo.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/uart_echo.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/uart_echo.axf: ${COMPILER}/uart_echo.o +${COMPILER}/uart_echo.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/uart_echo.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/uart_echo.axf: uart_echo.ld +SCATTERgcc_uart_echo=uart_echo.ld +ENTRY_uart_echo=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/uart_echo/ccs/.ccsimportspec b/boards/ek-lm4f232/uart_echo/ccs/.ccsimportspec new file mode 100644 index 0000000..9a02fa9 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/uart_echo/ccs/.ccsproject b/boards/ek-lm4f232/uart_echo/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/uart_echo/ccs/.cproject b/boards/ek-lm4f232/uart_echo/ccs/.cproject new file mode 100644 index 0000000..62209c1 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/uart_echo/ccs/.project b/boards/ek-lm4f232/uart_echo/ccs/.project new file mode 100644 index 0000000..199fcf9 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/ccs/.project @@ -0,0 +1,55 @@ + + + uart_echo + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/uart_echo/startup_ccs.c + + + uart_echo.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/uart_echo/uart_echo.c + + + uart_echo_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/uart_echo/uart_echo_ccs.cmd + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/uart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/uart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.bin b/boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.bin new file mode 100644 index 0000000..a2161a8 Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.bin differ diff --git a/boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.out b/boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.out new file mode 100644 index 0000000..b1010e2 Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/ccs/Debug/uart_echo.out differ diff --git a/boards/ek-lm4f232/uart_echo/ccs/macros.ini_initial b/boards/ek-lm4f232/uart_echo/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/uart_echo/ccs/target_config.ccxml b/boards/ek-lm4f232/uart_echo/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.bin b/boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.bin new file mode 100644 index 0000000..b6d467d Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.bin differ diff --git a/boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.out b/boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.out new file mode 100644 index 0000000..4f5dab7 Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/ewarm/Exe/uart_echo.out differ diff --git a/boards/ek-lm4f232/uart_echo/gcc/uart_echo.axf b/boards/ek-lm4f232/uart_echo/gcc/uart_echo.axf new file mode 100644 index 0000000..7364fec Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/gcc/uart_echo.axf differ diff --git a/boards/ek-lm4f232/uart_echo/gcc/uart_echo.bin b/boards/ek-lm4f232/uart_echo/gcc/uart_echo.bin new file mode 100644 index 0000000..168e164 Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/gcc/uart_echo.bin differ diff --git a/boards/ek-lm4f232/uart_echo/readme.txt b/boards/ek-lm4f232/uart_echo/readme.txt new file mode 100644 index 0000000..a134456 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/readme.txt @@ -0,0 +1,26 @@ +UART Echo + +This example application utilizes the UART to echo text. The first UART +(connected to the USB debug virtual serial port on the evaluation board) +will be configured in 115,200 baud, 8-n-1 mode. All characters received on +the UART are transmitted back to the UART. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.axf b/boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.axf new file mode 100644 index 0000000..3a3328b Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.axf differ diff --git a/boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.bin b/boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.bin new file mode 100644 index 0000000..994d35f Binary files /dev/null and b/boards/ek-lm4f232/uart_echo/rvmdk/uart_echo.bin differ diff --git a/boards/ek-lm4f232/uart_echo/startup_ccs.c b/boards/ek-lm4f232/uart_echo/startup_ccs.c new file mode 100644 index 0000000..b19b529 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/startup_ccs.c @@ -0,0 +1,302 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void UARTIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/uart_echo/startup_ewarm.c b/boards/ek-lm4f232/uart_echo/startup_ewarm.c new file mode 100644 index 0000000..fcb4026 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/startup_ewarm.c @@ -0,0 +1,333 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void UARTIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/uart_echo/startup_gcc.c b/boards/ek-lm4f232/uart_echo/startup_gcc.c new file mode 100644 index 0000000..228abab --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/startup_gcc.c @@ -0,0 +1,349 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void UARTIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/uart_echo/startup_rvmdk.S b/boards/ek-lm4f232/uart_echo/startup_rvmdk.S new file mode 100644 index 0000000..790e74f --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/startup_rvmdk.S @@ -0,0 +1,358 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declaration for the interrupt handler used by the application. +; +;****************************************************************************** + EXTERN UARTIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD UARTIntHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.c b/boards/ek-lm4f232/uart_echo/uart_echo.c new file mode 100644 index 0000000..97a641e --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.c @@ -0,0 +1,226 @@ +//***************************************************************************** +// +// uart_echo.c - Example for reading data from and writing data to the UART in +// an interrupt driven fashion. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +//#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/uart.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

UART Echo (uart_echo)

+//! +//! This example application utilizes the UART to echo text. The first UART +//! (connected to the USB debug virtual serial port on the evaluation board) +//! will be configured in 115,200 baud, 8-n-1 mode. All characters received on +//! the UART are transmitted back to the UART. +// +//***************************************************************************** + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// The UART interrupt handler. +// +//***************************************************************************** +void +UARTIntHandler(void) +{ + uint32_t ui32Status; + + // + // Get the interrrupt status. + // + ui32Status = ROM_UARTIntStatus(UART0_BASE, true); + + // + // Clear the asserted interrupts. + // + ROM_UARTIntClear(UART0_BASE, ui32Status); + + // + // Loop while there are characters in the receive FIFO. + // + while(ROM_UARTCharsAvail(UART0_BASE)) + { + // + // Read the next character from the UART and write it back to the UART. + // + ROM_UARTCharPutNonBlocking(UART0_BASE, + ROM_UARTCharGetNonBlocking(UART0_BASE)); + } +} + +//***************************************************************************** +// +// Send a string to the UART. +// +//***************************************************************************** +void +UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count) +{ + // + // Loop while there are more characters to send. + // + while(ui32Count--) + { + // + // Write the next character to the UART. + // + ROM_UARTCharPutNonBlocking(UART0_BASE, *pui8Buffer++); + } +} + +//***************************************************************************** +// +// This example demonstrates how to send a string of data to the UART. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + tContext sContext; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "uart-echo", -1, + GrContextDpyWidthGet(&sContext) / 2, 4, 0); + + // + // Initialize the display and write some instructions. + // + GrStringDrawCentered(&sContext, "Connect a", -1, + GrContextDpyWidthGet(&sContext) / 2, 20, false); + GrStringDrawCentered(&sContext, "terminal", -1, + GrContextDpyWidthGet(&sContext) / 2, 30, false); + GrStringDrawCentered(&sContext, "to UART0.", -1, + GrContextDpyWidthGet(&sContext) / 2, 40, false); + GrStringDrawCentered(&sContext, "115000,N,8,1", -1, + GrContextDpyWidthGet(&sContext) / 2, 50, false); + + // + // Enable the peripherals used by this example. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Enable processor interrupts. + // + ROM_IntMasterEnable(); + + // + // Set GPIO A0 and A1 as UART pins. + // + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Configure the UART for 115,200, 8-N-1 operation. + // + ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200, + (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | + UART_CONFIG_PAR_NONE)); + + // + // Enable the UART interrupt. + // + ROM_IntEnable(INT_UART0); + ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); + + // + // Prompt for text to be entered. + // + UARTSend((uint8_t *)"Enter text: ", 12); + + // + // Loop forever echoing data through the UART. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.ewd b/boards/ek-lm4f232/uart_echo/uart_echo.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.ewp b/boards/ek-lm4f232/uart_echo/uart_echo.ewp new file mode 100644 index 0000000..4216345 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.ewp @@ -0,0 +1,792 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\uart_echo.c + + + diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.icf b/boards/ek-lm4f232/uart_echo/uart_echo.icf new file mode 100644 index 0000000..a451eb3 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// uart_echo.icf - Linker configuration file for uart_echo. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.ld b/boards/ek-lm4f232/uart_echo/uart_echo.ld new file mode 100644 index 0000000..3560828 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * uart_echo.ld - Linker configuration file for uart_echo. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.sct b/boards/ek-lm4f232/uart_echo/uart_echo.sct new file mode 100644 index 0000000..33901a8 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; uart_echo.sct - Linker configuration file for uart_echo. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.uvopt b/boards/ek-lm4f232/uart_echo/uart_echo.uvopt new file mode 100644 index 0000000..ad57975 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.uvopt @@ -0,0 +1,317 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + uart_echo + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\uart_echo.c + uart_echo.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 6 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/uart_echo/uart_echo.uvproj b/boards/ek-lm4f232/uart_echo/uart_echo.uvproj new file mode 100644 index 0000000..f961c97 --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo.uvproj @@ -0,0 +1,434 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + uart_echo + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + uart_echo + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\uart_echo.bin .\rvmdk\uart_echo.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + uart_echo.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uart_echo.c + 1 + .\uart_echo.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/uart_echo/uart_echo_ccs.cmd b/boards/ek-lm4f232/uart_echo/uart_echo_ccs.cmd new file mode 100644 index 0000000..dfd4e9c --- /dev/null +++ b/boards/ek-lm4f232/uart_echo/uart_echo_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * uart_echo_ccs.cmd - CCS linker configuration file for uart_echo. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; diff --git a/boards/ek-lm4f232/udma_demo/Makefile b/boards/ek-lm4f232/udma_demo/Makefile new file mode 100644 index 0000000..234fd7b --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/Makefile @@ -0,0 +1,90 @@ +#****************************************************************************** +# +# Makefile - Rules for building the uDMA example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the uDMA example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/udma_demo.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the uDMA example. +# +${COMPILER}/udma_demo.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/udma_demo.axf: ${COMPILER}/cpu_usage.o +${COMPILER}/udma_demo.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/udma_demo.axf: ${COMPILER}/udma_demo.o +${COMPILER}/udma_demo.axf: ${COMPILER}/ustdlib.o +${COMPILER}/udma_demo.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/udma_demo.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/udma_demo.axf: udma_demo.ld +SCATTERgcc_udma_demo=udma_demo.ld +ENTRY_udma_demo=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/udma_demo/ccs/.ccsimportspec b/boards/ek-lm4f232/udma_demo/ccs/.ccsimportspec new file mode 100644 index 0000000..aea8941 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/udma_demo/ccs/.ccsproject b/boards/ek-lm4f232/udma_demo/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/udma_demo/ccs/.cproject b/boards/ek-lm4f232/udma_demo/ccs/.cproject new file mode 100644 index 0000000..ac845e4 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/udma_demo/ccs/.project b/boards/ek-lm4f232/udma_demo/ccs/.project new file mode 100644 index 0000000..57d9244 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/ccs/.project @@ -0,0 +1,65 @@ + + + udma_demo + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/udma_demo/startup_ccs.c + + + udma_demo.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/udma_demo/udma_demo.c + + + udma_demo_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/udma_demo/udma_demo_ccs.cmd + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/cpu_usage.c + 1 + SW_ROOT/utils/cpu_usage.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/udma_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/udma_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.bin b/boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.bin new file mode 100644 index 0000000..92f7302 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.bin differ diff --git a/boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.out b/boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.out new file mode 100644 index 0000000..e8c82c9 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/ccs/Debug/udma_demo.out differ diff --git a/boards/ek-lm4f232/udma_demo/ccs/macros.ini_initial b/boards/ek-lm4f232/udma_demo/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/udma_demo/ccs/target_config.ccxml b/boards/ek-lm4f232/udma_demo/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.bin b/boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.bin new file mode 100644 index 0000000..1393334 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.bin differ diff --git a/boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.out b/boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.out new file mode 100644 index 0000000..8c33180 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/ewarm/Exe/udma_demo.out differ diff --git a/boards/ek-lm4f232/udma_demo/gcc/udma_demo.axf b/boards/ek-lm4f232/udma_demo/gcc/udma_demo.axf new file mode 100644 index 0000000..1a7fe58 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/gcc/udma_demo.axf differ diff --git a/boards/ek-lm4f232/udma_demo/gcc/udma_demo.bin b/boards/ek-lm4f232/udma_demo/gcc/udma_demo.bin new file mode 100644 index 0000000..393a4f2 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/gcc/udma_demo.bin differ diff --git a/boards/ek-lm4f232/udma_demo/readme.txt b/boards/ek-lm4f232/udma_demo/readme.txt new file mode 100644 index 0000000..afc3b34 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/readme.txt @@ -0,0 +1,25 @@ +uDMA + +This example application demonstrates the use of the uDMA controller to +transfer data between memory buffers, and to transfer data to and from a +UART. The test runs for 10 seconds before exiting. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.axf b/boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.axf new file mode 100644 index 0000000..71df423 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.axf differ diff --git a/boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.bin b/boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.bin new file mode 100644 index 0000000..731dd23 Binary files /dev/null and b/boards/ek-lm4f232/udma_demo/rvmdk/udma_demo.bin differ diff --git a/boards/ek-lm4f232/udma_demo/startup_ccs.c b/boards/ek-lm4f232/udma_demo/startup_ccs.c new file mode 100644 index 0000000..8f96b8e --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/startup_ccs.c @@ -0,0 +1,305 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void UART0IntHandler(void); +extern void uDMAIntHandler(void); +extern void uDMAErrorHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UART0IntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + uDMAIntHandler, // uDMA Software Transfer + uDMAErrorHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/udma_demo/startup_ewarm.c b/boards/ek-lm4f232/udma_demo/startup_ewarm.c new file mode 100644 index 0000000..420cdcd --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/startup_ewarm.c @@ -0,0 +1,336 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void UART0IntHandler(void); +extern void uDMAIntHandler(void); +extern void uDMAErrorHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UART0IntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + uDMAIntHandler, // uDMA Software Transfer + uDMAErrorHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/udma_demo/startup_gcc.c b/boards/ek-lm4f232/udma_demo/startup_gcc.c new file mode 100644 index 0000000..6ce8b25 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/startup_gcc.c @@ -0,0 +1,352 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void UART0IntHandler(void); +extern void uDMAIntHandler(void); +extern void uDMAErrorHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UART0IntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + uDMAIntHandler, // uDMA Software Transfer + uDMAErrorHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/udma_demo/startup_rvmdk.S b/boards/ek-lm4f232/udma_demo/startup_rvmdk.S new file mode 100644 index 0000000..ea4d1a3 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/startup_rvmdk.S @@ -0,0 +1,361 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickHandler + EXTERN UART0IntHandler + EXTERN uDMAIntHandler + EXTERN uDMAErrorHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD UART0IntHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD uDMAIntHandler ; uDMA Software Transfer + DCD uDMAErrorHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.c b/boards/ek-lm4f232/udma_demo/udma_demo.c new file mode 100644 index 0000000..9e25a4f --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.c @@ -0,0 +1,916 @@ +//***************************************************************************** +// +// udma_demo.c - uDMA example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_uart.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/uart.h" +#include "driverlib/udma.h" +#include "driverlib/interrupt.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "utils/cpu_usage.h" +#include "utils/ustdlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

uDMA (udma_demo)

+//! +//! This example application demonstrates the use of the uDMA controller to +//! transfer data between memory buffers, and to transfer data to and from a +//! UART. The test runs for 10 seconds before exiting. +// +//***************************************************************************** + +//***************************************************************************** +// +// The number of SysTick ticks per second used for the SysTick interrupt. +// +//***************************************************************************** +#define SYSTICKS_PER_SECOND 100 + +//***************************************************************************** +// +// The size of the memory transfer source and destination buffers (in words). +// +//***************************************************************************** +#define MEM_BUFFER_SIZE 1024 + +//***************************************************************************** +// +// The size of the UART transmit and receive buffers. They do not need to be +// the same size. +// +//***************************************************************************** +#define UART_TXBUF_SIZE 256 +#define UART_RXBUF_SIZE 256 + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +static tContext g_sContext; + +//***************************************************************************** +// +// The source and destination buffers used for memory transfers. +// +//***************************************************************************** +static uint32_t g_ui32SrcBuf[MEM_BUFFER_SIZE]; +static uint32_t g_ui32DstBuf[MEM_BUFFER_SIZE]; + +//***************************************************************************** +// +// The transmit and receive buffers used for the UART transfers. There is one +// transmit buffer and a pair of recieve ping-pong buffers. +// +//***************************************************************************** +static uint8_t g_ui8TxBuf[UART_TXBUF_SIZE]; +static uint8_t g_ui8RxBufA[UART_RXBUF_SIZE]; +static uint8_t g_ui8RxBufB[UART_RXBUF_SIZE]; + +//***************************************************************************** +// +// The count of uDMA errors. This value is incremented by the uDMA error +// handler. +// +//***************************************************************************** +static uint32_t g_ui32uDMAErrCount = 0; + +//***************************************************************************** +// +// The count of times the uDMA interrupt occurred but the uDMA transfer was not +// complete. This should remain 0. +// +//***************************************************************************** +static uint32_t g_ui32BadISR = 0; + +//***************************************************************************** +// +// The count of UART buffers filled, one for each ping-pong buffer. +// +//***************************************************************************** +static uint32_t g_ui32RxBufACount = 0; +static uint32_t g_ui32RxBufBCount = 0; + +//***************************************************************************** +// +// The count of memory uDMA transfer blocks. This value is incremented by the +// uDMA interrupt handler whenever a memory block transfer is completed. +// +//***************************************************************************** +static uint32_t g_ui32MemXferCount = 0; + +//***************************************************************************** +// +// The CPU usage in percent, in 16.16 fixed point format. +// +//***************************************************************************** +static uint32_t g_ui32CPUUsage; + +//***************************************************************************** +// +// The number of seconds elapsed since the start of the program. This value is +// maintained by the SysTick interrupt handler. +// +//***************************************************************************** +static uint32_t g_ui32Seconds = 0; + +//***************************************************************************** +// +// The number of ticks elapsed since the start of the program. This value is +// maintained by the SysTick interrupt handler. +// +//***************************************************************************** +static uint32_t g_ui32TickCount = 0; + +//***************************************************************************** +// +// The control table used by the uDMA controller. This table must be aligned +// to a 1024 byte boundary. +// +//***************************************************************************** +#if defined(ewarm) +#pragma data_alignment=1024 +uint8_t ui8ControlTable[1024]; +#elif defined(ccs) +#pragma DATA_ALIGN(ui8ControlTable, 1024) +uint8_t ui8ControlTable[1024]; +#else +uint8_t ui8ControlTable[1024] __attribute__ ((aligned(1024))); +#endif + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// The interrupt handler for the SysTick timer. This handler will increment a +// seconds counter whenever the appropriate number of ticks has occurred. It +// will also call the CPU usage tick function to find the CPU usage percent. +// +//***************************************************************************** +void +SysTickHandler(void) +{ + // + // Increment the tick counter. + // + g_ui32TickCount++; + + // + // If the number of ticks per second has occurred, then increment the + // seconds counter. + // + if(!(g_ui32TickCount % SYSTICKS_PER_SECOND)) + { + g_ui32Seconds++; + } + + // + // Call the CPU usage tick function. This function will compute the amount + // of cycles used by the CPU since the last call and return the result in + // percent in fixed point 16.16 format. + // + g_ui32CPUUsage = CPUUsageTick(); +} + +//***************************************************************************** +// +// The interrupt handler for uDMA errors. This interrupt will occur if the +// uDMA encounters a bus error while trying to perform a transfer. This +// handler just increments a counter if an error occurs. +// +//***************************************************************************** +void +uDMAErrorHandler(void) +{ + uint32_t ui32Status; + + // + // Check for uDMA error bit + // + ui32Status = ROM_uDMAErrorStatusGet(); + + // + // If there is a uDMA error, then clear the error and increment + // the error counter. + // + if(ui32Status) + { + ROM_uDMAErrorStatusClear(); + g_ui32uDMAErrCount++; + } +} + +//***************************************************************************** +// +// The interrupt handler for uDMA interrupts from the memory channel. This +// interrupt will increment a counter, and then restart another memory +// transfer. +// +//***************************************************************************** +void +uDMAIntHandler(void) +{ + uint32_t ui32Mode; + + // + // Check for the primary control structure to indicate complete. + // + ui32Mode = ROM_uDMAChannelModeGet(UDMA_CHANNEL_SW); + if(ui32Mode == UDMA_MODE_STOP) + { + // + // Increment the count of completed transfers. + // + g_ui32MemXferCount++; + + // + // Configure it for another transfer. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_SW, UDMA_MODE_AUTO, + g_ui32SrcBuf, g_ui32DstBuf, + MEM_BUFFER_SIZE); + + // + // Initiate another transfer. + // + ROM_uDMAChannelEnable(UDMA_CHANNEL_SW); + ROM_uDMAChannelRequest(UDMA_CHANNEL_SW); + } + + // + // If the channel is not stopped, then something is wrong. + // + else + { + g_ui32BadISR++; + } +} + +//***************************************************************************** +// +// The interrupt handler for UART0. This interrupt will occur when a DMA +// transfer is complete using the UART0 uDMA channel. It will also be +// triggered if the peripheral signals an error. This interrupt handler will +// switch between receive ping-pong buffers A and B. It will also restart a TX +// uDMA transfer if the prior transfer is complete. This will keep the UART +// running continuously (looping TX data back to RX). +// +//***************************************************************************** +void +UART0IntHandler(void) +{ + uint32_t ui32Status; + uint32_t ui32Mode; + + // + // Read the interrupt status of the UART. + // + ui32Status = ROM_UARTIntStatus(UART0_BASE, 1); + + // + // Clear any pending status, even though there should be none since no UART + // interrupts were enabled. If UART error interrupts were enabled, then + // those interrupts could occur here and should be handled. Since uDMA is + // used for both the RX and TX, then neither of those interrupts should be + // enabled. + // + ROM_UARTIntClear(UART0_BASE, ui32Status); + + // + // Check the DMA control table to see if the ping-pong "A" transfer is + // complete. The "A" transfer uses receive buffer "A", and the primary + // control structure. + // + ui32Mode = ROM_uDMAChannelModeGet(UDMA_CHANNEL_UART0RX | UDMA_PRI_SELECT); + + // + // If the primary control structure indicates stop, that means the "A" + // receive buffer is done. The uDMA controller should still be receiving + // data into the "B" buffer. + // + if(ui32Mode == UDMA_MODE_STOP) + { + // + // Increment a counter to indicate data was received into buffer A. In + // a real application this would be used to signal the main thread that + // data was received so the main thread can process the data. + // + g_ui32RxBufACount++; + + // + // Set up the next transfer for the "A" buffer, using the primary + // control structure. When the ongoing receive into the "B" buffer is + // done, the uDMA controller will switch back to this one. This + // example re-uses buffer A, but a more sophisticated application could + // use a rotating set of buffers to increase the amount of time that + // the main thread has to process the data in the buffer before it is + // reused. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_UART0RX | UDMA_PRI_SELECT, + UDMA_MODE_PINGPONG, + (void *)(UART0_BASE + UART_O_DR), + g_ui8RxBufA, sizeof(g_ui8RxBufA)); + } + + // + // Check the DMA control table to see if the ping-pong "B" transfer is + // complete. The "B" transfer uses receive buffer "B", and the alternate + // control structure. + // + ui32Mode = ROM_uDMAChannelModeGet(UDMA_CHANNEL_UART0RX | UDMA_ALT_SELECT); + + // + // If the alternate control structure indicates stop, that means the "B" + // receive buffer is done. The uDMA controller should still be receiving + // data into the "A" buffer. + // + if(ui32Mode == UDMA_MODE_STOP) + { + // + // Increment a counter to indicate data was received into buffer A. In + // a real application this would be used to signal the main thread that + // data was received so the main thread can process the data. + // + g_ui32RxBufBCount++; + + // + // Set up the next transfer for the "B" buffer, using the alternate + // control structure. When the ongoing receive into the "A" buffer is + // done, the uDMA controller will switch back to this one. This + // example re-uses buffer B, but a more sophisticated application could + // use a rotating set of buffers to increase the amount of time that + // the main thread has to process the data in the buffer before it is + // reused. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_UART0RX | UDMA_ALT_SELECT, + UDMA_MODE_PINGPONG, + (void *)(UART0_BASE + UART_O_DR), + g_ui8RxBufB, sizeof(g_ui8RxBufB)); + } + + // + // If the UART0 DMA TX channel is disabled, that means the TX DMA transfer + // is done. + // + if(!ROM_uDMAChannelIsEnabled(UDMA_CHANNEL_UART0TX)) + { + // + // Start another DMA transfer to UART0 TX. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_UART0TX | UDMA_PRI_SELECT, + UDMA_MODE_BASIC, g_ui8TxBuf, + (void *)(UART0_BASE + UART_O_DR), + sizeof(g_ui8TxBuf)); + + // + // The uDMA TX channel must be re-enabled. + // + ROM_uDMAChannelEnable(UDMA_CHANNEL_UART0TX); + } +} + +//***************************************************************************** +// +// Initializes the UART0 peripheral and sets up the TX and RX uDMA channels. +// The UART is configured for loopback mode so that any data sent on TX will be +// received on RX. The uDMA channels are configured so that the TX channel +// will copy data from a buffer to the UART TX output. And the uDMA RX channel +// will receive any incoming data into a pair of buffers in ping-pong mode. +// +//***************************************************************************** +void +InitUART0Transfer(void) +{ + uint_fast16_t ui16Idx; + + // + // Fill the TX buffer with a simple data pattern. + // + for(ui16Idx = 0; ui16Idx < UART_TXBUF_SIZE; ui16Idx++) + { + g_ui8TxBuf[ui16Idx] = ui16Idx; + } + + // + // Enable the UART peripheral, and configure it to operate even if the CPU + // is in sleep. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART0); + + // + // Configure the UART communication parameters. + // + ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200, + UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | + UART_CONFIG_PAR_NONE); + + // + // Set both the TX and RX trigger thresholds to 4. This will be used by + // the uDMA controller to signal when more data should be transferred. The + // uDMA TX and RX channels will be configured so that it can transfer 4 + // bytes in a burst when the UART is ready to transfer more data. + // + ROM_UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8); + + // + // Enable the UART for operation, and enable the uDMA interface for both TX + // and RX channels. + // + ROM_UARTEnable(UART0_BASE); + ROM_UARTDMAEnable(UART0_BASE, UART_DMA_RX | UART_DMA_TX); + + // + // This register write will set the UART to operate in loopback mode. Any + // data sent on the TX output will be received on the RX input. + // + HWREG(UART0_BASE + UART_O_CTL) |= UART_CTL_LBE; + + // + // Enable the UART peripheral interrupts. Note that no UART interrupts + // were enabled, but the uDMA controller will cause an interrupt on the + // UART interrupt signal when a uDMA transfer is complete. + // + ROM_IntEnable(INT_UART0); + + // + // Put the attributes in a known state for the uDMA UART0RX channel. These + // should already be disabled by default. + // + ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_UART0RX, + UDMA_ATTR_ALTSELECT | UDMA_ATTR_USEBURST | + UDMA_ATTR_HIGH_PRIORITY | + UDMA_ATTR_REQMASK); + + // + // Configure the control parameters for the primary control structure for + // the UART RX channel. The primary contol structure is used for the "A" + // part of the ping-pong receive. The transfer data size is 8 bits, the + // source address does not increment since it will be reading from a + // register. The destination address increment is byte 8-bit bytes. The + // arbitration size is set to 4 to match the RX FIFO trigger threshold. + // The uDMA controller will use a 4 byte burst transfer if possible. This + // will be somewhat more effecient that single byte transfers. + // + ROM_uDMAChannelControlSet(UDMA_CHANNEL_UART0RX | UDMA_PRI_SELECT, + UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 | + UDMA_ARB_4); + + // + // Configure the control parameters for the alternate control structure for + // the UART RX channel. The alternate contol structure is used for the "B" + // part of the ping-pong receive. The configuration is identical to the + // primary/A control structure. + // + ROM_uDMAChannelControlSet(UDMA_CHANNEL_UART0RX | UDMA_ALT_SELECT, + UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 | + UDMA_ARB_4); + + // + // Set up the transfer parameters for the UART RX primary control + // structure. The mode is set to ping-pong, the transfer source is the + // UART data register, and the destination is the receive "A" buffer. The + // transfer size is set to match the size of the buffer. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_UART0RX | UDMA_PRI_SELECT, + UDMA_MODE_PINGPONG, + (void *)(UART0_BASE + UART_O_DR), + g_ui8RxBufA, sizeof(g_ui8RxBufA)); + + // + // Set up the transfer parameters for the UART RX alternate control + // structure. The mode is set to ping-pong, the transfer source is the + // UART data register, and the destination is the receive "B" buffer. The + // transfer size is set to match the size of the buffer. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_UART0RX | UDMA_ALT_SELECT, + UDMA_MODE_PINGPONG, + (void *)(UART0_BASE + UART_O_DR), + g_ui8RxBufB, sizeof(g_ui8RxBufB)); + + // + // Put the attributes in a known state for the uDMA UART0TX channel. These + // should already be disabled by default. + // + ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_UART0TX, + UDMA_ATTR_ALTSELECT | + UDMA_ATTR_HIGH_PRIORITY | + UDMA_ATTR_REQMASK); + + // + // Set the USEBURST attribute for the uDMA UART TX channel. This will + // force the controller to always use a burst when transferring data from + // the TX buffer to the UART. This is somewhat more effecient bus usage + // than the default which allows single or burst transfers. + // + ROM_uDMAChannelAttributeEnable(UDMA_CHANNEL_UART0TX, UDMA_ATTR_USEBURST); + + // + // Configure the control parameters for the UART TX. The uDMA UART TX + // channel is used to transfer a block of data from a buffer to the UART. + // The data size is 8 bits. The source address increment is 8-bit bytes + // since the data is coming from a buffer. The destination increment is + // none since the data is to be written to the UART data register. The + // arbitration size is set to 4, which matches the UART TX FIFO trigger + // threshold. + // + ROM_uDMAChannelControlSet(UDMA_CHANNEL_UART0TX | UDMA_PRI_SELECT, + UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_NONE | + UDMA_ARB_4); + + // + // Set up the transfer parameters for the uDMA UART TX channel. This will + // configure the transfer source and destination and the transfer size. + // Basic mode is used because the peripheral is making the uDMA transfer + // request. The source is the TX buffer and the destination is the UART + // data register. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_UART0TX | UDMA_PRI_SELECT, + UDMA_MODE_BASIC, g_ui8TxBuf, + (void *)(UART0_BASE + UART_O_DR), + sizeof(g_ui8TxBuf)); + + // + // Now both the uDMA UART TX and RX channels are primed to start a + // transfer. As soon as the channels are enabled, the peripheral will + // issue a transfer request and the data transfers will begin. + // + ROM_uDMAChannelEnable(UDMA_CHANNEL_UART0RX); + ROM_uDMAChannelEnable(UDMA_CHANNEL_UART0TX); +} + +//***************************************************************************** +// +// Initializes the uDMA software channel to perform a memory to memory uDMA +// transfer. +// +//***************************************************************************** +void +InitSWTransfer(void) +{ + uint_fast16_t ui16Idx; + + // + // Fill the source memory buffer with a simple incrementing pattern. + // + for(ui16Idx = 0; ui16Idx < MEM_BUFFER_SIZE; ui16Idx++) + { + g_ui32SrcBuf[ui16Idx] = ui16Idx; + } + + // + // Enable interrupts from the uDMA software channel. + // + ROM_IntEnable(INT_UDMA); + + // + // Put the attributes in a known state for the uDMA software channel. + // These should already be disabled by default. + // + ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_SW, + UDMA_ATTR_USEBURST | UDMA_ATTR_ALTSELECT | + (UDMA_ATTR_HIGH_PRIORITY | + UDMA_ATTR_REQMASK)); + + // + // Configure the control parameters for the SW channel. The SW channel + // will be used to transfer between two memory buffers, 32 bits at a time. + // Therefore the data size is 32 bits, and the address increment is 32 bits + // for both source and destination. The arbitration size will be set to 8, + // which causes the uDMA controller to rearbitrate after 8 items are + // transferred. This keeps this channel from hogging the uDMA controller + // once the transfer is started, and allows other channels cycles if they + // are higher priority. + // + ROM_uDMAChannelControlSet(UDMA_CHANNEL_SW | UDMA_PRI_SELECT, + UDMA_SIZE_32 | UDMA_SRC_INC_32 | UDMA_DST_INC_32 | + UDMA_ARB_8); + + // + // Set up the transfer parameters for the software channel. This will + // configure the transfer buffers and the transfer size. Auto mode must be + // used for software transfers. + // + ROM_uDMAChannelTransferSet(UDMA_CHANNEL_SW | UDMA_PRI_SELECT, + UDMA_MODE_AUTO, g_ui32SrcBuf, g_ui32DstBuf, + MEM_BUFFER_SIZE); + + // + // Now the software channel is primed to start a transfer. The channel + // must be enabled. For software based transfers, a request must be + // issued. After this, the uDMA memory transfer begins. + // + ROM_uDMAChannelEnable(UDMA_CHANNEL_SW); + ROM_uDMAChannelRequest(UDMA_CHANNEL_SW); +} + +//***************************************************************************** +// +// This example demonstrates how to use the uDMA controller to transfer data +// between memory buffers and to and from a peripheral, in this case a UART. +// The uDMA controller is configured to repeatedly transfer a block of data +// from one memory buffer to another. It is also set up to repeatedly copy a +// block of data from a buffer to the UART output. The UART data is looped +// back so the same data is received, and the uDMA controlled is configured to +// continuously receive the UART data using ping-pong buffers. +// +// The processor is put to sleep when it is not doing anything, and this allows +// collection of CPU usage data to see how much CPU is being used while the +// data transfers are ongoing. +// +//***************************************************************************** +int +main(void) +{ + static uint32_t ui32PrevSeconds; + static uint32_t ui32PrevXferCount; + static uint32_t ui32PrevUARTCount = 0; + static char pcStrBuf[40]; + tRectangle sRect; + uint32_t ui32CenterX; + uint32_t ui32XfersCompleted; + uint32_t ui32BytesTransferred; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run from the PLL at 50 MHz. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Enable peripherals to operate when CPU is in sleep. + // + ROM_SysCtlPeripheralClockGating(true); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context and find the middle X coordinate. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Get the center X coordinate of the screen, since it is used a lot. + // + ui32CenterX = GrContextDpyWidthGet(&g_sContext) / 2; + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "udma-demo", -1, ui32CenterX, 4, 0); + + // + // Show the clock frequency on the display. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + usnprintf(pcStrBuf, sizeof(pcStrBuf), "%u MHz", + ROM_SysCtlClockGet() / 1000000); + GrStringDrawCentered(&g_sContext, pcStrBuf, -1, ui32CenterX, 14, 0); + + // + // Show static text and field labels on the display. + // + GrStringDraw(&g_sContext, "Mem", -1, 0, 22, 0); + GrStringDraw(&g_sContext, "UART", -1, 0, 32, 0); + + // + // Configure SysTick to occur 100 times per second, to use as a time + // reference. Enable SysTick to generate interrupts. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); + ROM_SysTickIntEnable(); + ROM_SysTickEnable(); + + // + // Initialize the CPU usage measurement routine. + // + CPUUsageInit(ROM_SysCtlClockGet(), SYSTICKS_PER_SECOND, 2); + + // + // Enable the uDMA controller at the system level. Enable it to continue + // to run while the processor is in sleep. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); + ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UDMA); + + // + // Enable the uDMA controller error interrupt. This interrupt will occur + // if there is a bus error during a transfer. + // + ROM_IntEnable(INT_UDMAERR); + + // + // Enable the uDMA controller. + // + ROM_uDMAEnable(); + + // + // Point at the control table to use for channel control structures. + // + ROM_uDMAControlBaseSet(ui8ControlTable); + + // + // Initialize the uDMA memory to memory transfers. + // + InitSWTransfer(); + + // + // Initialize the uDMA UART transfers. + // + InitUART0Transfer(); + + // + // Remember the current SysTick seconds count. + // + ui32PrevSeconds = g_ui32Seconds; + + // + // Remember the current count of memory buffer transfers. + // + ui32PrevXferCount = g_ui32MemXferCount; + + // + // Loop until the button is pressed. The processor is put to sleep + // in this loop so that CPU utilization can be measured. + // + while(1) + { + // + // Check to see if one second has elapsed. If so, the make some + // updates. + // + if(g_ui32Seconds != ui32PrevSeconds) + { + // + // Print a message to the display showing the CPU usage percent. + // The fractional part of the percent value is ignored. + // + usnprintf(pcStrBuf, sizeof(pcStrBuf), "CPU %2u%%", + g_ui32CPUUsage >> 16); + GrStringDrawCentered(&g_sContext, pcStrBuf, -1, ui32CenterX, 44, + 1); + + // + // Tell the user how many seconds we have to go before ending. + // + usnprintf(pcStrBuf, sizeof(pcStrBuf), " %d seconds ", + 10 - g_ui32Seconds); + GrStringDrawCentered(&g_sContext, pcStrBuf, -1, ui32CenterX, 54, + 1); + + // + // Remember the new seconds count. + // + ui32PrevSeconds = g_ui32Seconds; + + // + // Calculate how many memory transfers have occurred since the last + // second. + // + ui32XfersCompleted = g_ui32MemXferCount - ui32PrevXferCount; + + // + // Remember the new transfer count. + // + ui32PrevXferCount = g_ui32MemXferCount; + + // + // Compute how many bytes were transferred in the memory transfer + // since the last second. + // + ui32BytesTransferred = ui32XfersCompleted * MEM_BUFFER_SIZE * 4; + + // + // Print a message to the display showing the memory transfer rate. + // + usnprintf(pcStrBuf, sizeof(pcStrBuf), "%8u B/s ", + ui32BytesTransferred); + GrStringDraw(&g_sContext, pcStrBuf, -1, 24, 22, 1); + + // + // Calculate how many UART transfers have occurred since the last + // second. + // + ui32XfersCompleted = (g_ui32RxBufACount + g_ui32RxBufBCount - + ui32PrevUARTCount); + + // + // Remember the new UART transfer count. + // + ui32PrevUARTCount = g_ui32RxBufACount + g_ui32RxBufBCount; + + // + // Compute how many bytes were transferred by the UART. The number + // of bytes received is multiplied by 2 so that the TX bytes + // transferred are also accounted for. + // + ui32BytesTransferred = ui32XfersCompleted * UART_RXBUF_SIZE * 2; + + // + // Print a message to the display showing the UART transfer rate. + // + usnprintf(pcStrBuf, sizeof(pcStrBuf), "%7u B/s ", + ui32BytesTransferred); + GrStringDraw(&g_sContext, pcStrBuf, -1, 30, 32, 1); + } + + // + // Put the processor to sleep if there is nothing to do. This allows + // the CPU usage routine to measure the number of free CPU cycles. + // If the processor is sleeping a lot, it can be hard to connect to + // the target with the debugger. + // + ROM_SysCtlSleep(); + + // + // See if we have run int32_t enough and exit the loop if so. + // + if(g_ui32Seconds >= 10) + { + break; + } + } + + // + // Indicate on the display that the example is stopped. + // + GrContextForegroundSet(&g_sContext, ClrRed); + GrStringDrawCentered(&g_sContext, " Stopped ", -1, + ui32CenterX, 54, 1); + + // + // Loop forever with the CPU not sleeping, so the debugger can connect. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.ewd b/boards/ek-lm4f232/udma_demo/udma_demo.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.ewp b/boards/ek-lm4f232/udma_demo/udma_demo.ewp new file mode 100644 index 0000000..1595159 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.ewp @@ -0,0 +1,798 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\..\..\..\..\utils\cpu_usage.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\udma_demo.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.icf b/boards/ek-lm4f232/udma_demo/udma_demo.icf new file mode 100644 index 0000000..6ea3260 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// udma_demo.icf - Linker configuration file for udma_demo. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.ld b/boards/ek-lm4f232/udma_demo/udma_demo.ld new file mode 100644 index 0000000..93bcb43 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * udma_demo.ld - Linker configuration file for udma_demo. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.sct b/boards/ek-lm4f232/udma_demo/udma_demo.sct new file mode 100644 index 0000000..371a107 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; udma_demo.sct - Linker configuration file for udma_demo. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.uvopt b/boards/ek-lm4f232/udma_demo/udma_demo.uvopt new file mode 100644 index 0000000..4d26a8e --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.uvopt @@ -0,0 +1,345 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + udma_demo + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\cpu_usage.c + cpu_usage.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\udma_demo.c + udma_demo.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 8 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/udma_demo/udma_demo.uvproj b/boards/ek-lm4f232/udma_demo/udma_demo.uvproj new file mode 100644 index 0000000..c7efe63 --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo.uvproj @@ -0,0 +1,444 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + udma_demo + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + udma_demo + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\udma_demo.bin .\rvmdk\udma_demo.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + udma_demo.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + cpu_usage.c + 1 + ..\..\..\..\utils\cpu_usage.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + udma_demo.c + 1 + .\udma_demo.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/udma_demo/udma_demo_ccs.cmd b/boards/ek-lm4f232/udma_demo/udma_demo_ccs.cmd new file mode 100644 index 0000000..e97d4da --- /dev/null +++ b/boards/ek-lm4f232/udma_demo/udma_demo_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * udma_demo_ccs.cmd - CCS linker configuration file for udma_demo. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/usb_dev_bulk/Makefile b/boards/ek-lm4f232/usb_dev_bulk/Makefile new file mode 100644 index 0000000..282bf5d --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/Makefile @@ -0,0 +1,92 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB device bulk example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the USB device bulk example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_dev_bulk.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB device bulk example. +# +${COMPILER}/usb_dev_bulk.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_dev_bulk.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_dev_bulk.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_dev_bulk.axf: ${COMPILER}/usb_bulk_structs.o +${COMPILER}/usb_dev_bulk.axf: ${COMPILER}/usb_dev_bulk.o +${COMPILER}/usb_dev_bulk.axf: ${COMPILER}/ustdlib.o +${COMPILER}/usb_dev_bulk.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_dev_bulk.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_dev_bulk.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_dev_bulk.axf: usb_dev_bulk.ld +SCATTERgcc_usb_dev_bulk=usb_dev_bulk.ld +ENTRY_usb_dev_bulk=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 -DUART_BUFFERED + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsimportspec new file mode 100644 index 0000000..6c9f4a0 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsimportspec @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsproject b/boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/.cproject b/boards/ek-lm4f232/usb_dev_bulk/ccs/.cproject new file mode 100644 index 0000000..7e870bb --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/ccs/.cproject @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/.project b/boards/ek-lm4f232/usb_dev_bulk/ccs/.project new file mode 100644 index 0000000..208ff61 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/ccs/.project @@ -0,0 +1,70 @@ + + + usb_dev_bulk + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_bulk/startup_ccs.c + + + usb_bulk_structs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.c + + + usb_dev_bulk.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.c + + + usb_dev_bulk_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk_ccs.cmd + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_dev_bulk/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.bin b/boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.bin new file mode 100644 index 0000000..1999e22 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.bin differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.out b/boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.out new file mode 100644 index 0000000..923c8e2 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/ccs/Debug/usb_dev_bulk.out differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_dev_bulk/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_dev_bulk/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_dev_bulk/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.bin b/boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.bin new file mode 100644 index 0000000..ec05afb Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.bin differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.out b/boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.out new file mode 100644 index 0000000..fdaaaf8 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/ewarm/Exe/usb_dev_bulk.out differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.axf b/boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.axf new file mode 100644 index 0000000..429b118 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.axf differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.bin b/boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.bin new file mode 100644 index 0000000..9216d9f Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/gcc/usb_dev_bulk.bin differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/readme.txt b/boards/ek-lm4f232/usb_dev_bulk/readme.txt new file mode 100644 index 0000000..13a804f --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/readme.txt @@ -0,0 +1,43 @@ +USB Generic Bulk Device + +This example provides a generic USB device offering simple bulk data +transfer to and from the host. The device uses a vendor-specific class ID +and supports a single bulk IN endpoint and a single bulk OUT endpoint. +Data received from the host is assumed to be ASCII text and it is +echoed back with the case of all alphabetic characters swapped. + +A Windows INF file for the device is provided on the installation CD and +in the C:/ti/TivaWare_C_Series-x.x/windows_drivers directory of TivaWare +releases. This INF contains information required to install the WinUSB +subsystem on WindowsXP and Vista PCs. WinUSB is a Windows subsystem +allowing user mode applications to access the USB device without the need +for a vendor-specific kernel mode driver. + +A sample Windows command-line application, usb_bulk_example, illustrating +how to connect to and communicate with the bulk device is also provided. +The application binary is installed as part of the ``TivaWare for C Series +PC Companion Utilities'' package (SW-TM4C-USB-WIN) on the installation CD +or via download from http://www.ti.com/tivaware . Project files are +included to allow the examples to be built using +Microsoft Visual Studio 2008. Source code for this application can be +found in directory ti/TivaWare_C_Series-x.x/tools/usb_bulk_example. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.axf b/boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.axf new file mode 100644 index 0000000..93ad4b6 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.axf differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.bin b/boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.bin new file mode 100644 index 0000000..a77766b Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_bulk/rvmdk/usb_dev_bulk.bin differ diff --git a/boards/ek-lm4f232/usb_dev_bulk/startup_ccs.c b/boards/ek-lm4f232/usb_dev_bulk/startup_ccs.c new file mode 100644 index 0000000..f1bf41e --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/startup_ccs.c @@ -0,0 +1,304 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void UARTStdioIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTStdioIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_bulk/startup_ewarm.c b/boards/ek-lm4f232/usb_dev_bulk/startup_ewarm.c new file mode 100644 index 0000000..b803406 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/startup_ewarm.c @@ -0,0 +1,335 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void UARTStdioIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTStdioIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_bulk/startup_gcc.c b/boards/ek-lm4f232/usb_dev_bulk/startup_gcc.c new file mode 100644 index 0000000..0e5df70 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/startup_gcc.c @@ -0,0 +1,351 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void UARTStdioIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTStdioIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_bulk/startup_rvmdk.S b/boards/ek-lm4f232/usb_dev_bulk/startup_rvmdk.S new file mode 100644 index 0000000..36b47aa --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/startup_rvmdk.S @@ -0,0 +1,360 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickIntHandler + EXTERN UARTStdioIntHandler + EXTERN USB0DeviceIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickIntHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD UARTStdioIntHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0DeviceIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.c b/boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.c new file mode 100644 index 0000000..30677fb --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.c @@ -0,0 +1,200 @@ +//***************************************************************************** +// +// usb_bulk_structs.c - Data structures defining this bulk USB device. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "driverlib/usb.h" +#include "usblib/usblib.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdbulk.h" +#include "usb_bulk_structs.h" + +//***************************************************************************** +// +// The languages supported by this device. +// +//***************************************************************************** +const uint8_t g_pui8LangDescriptor[] = +{ + 4, + USB_DTYPE_STRING, + USBShort(USB_LANG_EN_US) +}; + +//***************************************************************************** +// +// The manufacturer string. +// +//***************************************************************************** +const uint8_t g_pui8ManufacturerString[] = +{ + (17 + 1) * 2, + USB_DTYPE_STRING, + 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0, + 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0, +}; + +//***************************************************************************** +// +// The product string. +// +//***************************************************************************** +const uint8_t g_pui8ProductString[] = +{ + (19 + 1) * 2, + USB_DTYPE_STRING, + 'G', 0, 'e', 0, 'n', 0, 'e', 0, 'r', 0, 'i', 0, 'c', 0, ' ', 0, 'B', 0, + 'u', 0, 'l', 0, 'k', 0, ' ', 0, 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, + 'e', 0 +}; + +//***************************************************************************** +// +// The serial number string. +// +//***************************************************************************** +const uint8_t g_pui8SerialNumberString[] = +{ + (8 + 1) * 2, + USB_DTYPE_STRING, + '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0 +}; + +//***************************************************************************** +// +// The data interface description string. +// +//***************************************************************************** +const uint8_t g_pui8DataInterfaceString[] = +{ + (19 + 1) * 2, + USB_DTYPE_STRING, + 'B', 0, 'u', 0, 'l', 0, 'k', 0, ' ', 0, 'D', 0, 'a', 0, 't', 0, + 'a', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, + 'a', 0, 'c', 0, 'e', 0 +}; + +//***************************************************************************** +// +// The configuration description string. +// +//***************************************************************************** +const uint8_t g_pui8ConfigString[] = +{ + (23 + 1) * 2, + USB_DTYPE_STRING, + 'B', 0, 'u', 0, 'l', 0, 'k', 0, ' ', 0, 'D', 0, 'a', 0, 't', 0, + 'a', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, 'f', 0, 'i', 0, 'g', 0, + 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0, 'o', 0, 'n', 0 +}; + +//***************************************************************************** +// +// The descriptor string table. +// +//***************************************************************************** +const uint8_t *const g_ppui8StringDescriptors[] = +{ + g_pui8LangDescriptor, + g_pui8ManufacturerString, + g_pui8ProductString, + g_pui8SerialNumberString, + g_pui8DataInterfaceString, + g_pui8ConfigString +}; + +#define NUM_STRING_DESCRIPTORS (sizeof(g_ppui8StringDescriptors) / \ + sizeof(uint8_t *)) + +//***************************************************************************** +// +// The bulk device initialization and customization structures. In this case, +// we are using USBBuffers between the bulk device class driver and the +// application code. The function pointers and callback data values are set +// to insert a buffer in each of the data channels, transmit and receive. +// +// With the buffer in place, the bulk channel callback is set to the relevant +// channel function and the callback data is set to point to the channel +// instance data. The buffer, in turn, has its callback set to the application +// function and the callback data set to our bulk instance structure. +// +//***************************************************************************** +extern const tUSBBuffer g_sTxBuffer; +extern const tUSBBuffer g_sRxBuffer; + +tUSBDBulkDevice g_sBulkDevice = +{ + USB_VID_TI_1CBE, + USB_PID_BULK, + 500, + USB_CONF_ATTR_SELF_PWR, + USBBufferEventCallback, + (void *)&g_sRxBuffer, + USBBufferEventCallback, + (void *)&g_sTxBuffer, + g_ppui8StringDescriptors, + NUM_STRING_DESCRIPTORS +}; + +//***************************************************************************** +// +// Receive buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pui8USBRxBuffer[BULK_BUFFER_SIZE]; +uint8_t g_pui8RxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE]; +const tUSBBuffer g_sRxBuffer = +{ + false, // This is a receive buffer. + RxHandler, // pfnCallback + (void *)&g_sBulkDevice, // Callback data is our device pointer. + USBDBulkPacketRead, // pfnTransfer + USBDBulkRxPacketAvailable, // pfnAvailable + (void *)&g_sBulkDevice, // pvHandle + g_pui8USBRxBuffer, // pi8Buffer + BULK_BUFFER_SIZE, // ui32BufferSize + g_pui8RxBufferWorkspace // pvWorkspace +}; + +//***************************************************************************** +// +// Transmit buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pui8USBTxBuffer[BULK_BUFFER_SIZE]; +uint8_t g_pui8TxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE]; +const tUSBBuffer g_sTxBuffer = +{ + true, // This is a transmit buffer. + TxHandler, // pfnCallback + (void *)&g_sBulkDevice, // Callback data is our device pointer. + USBDBulkPacketWrite, // pfnTransfer + USBDBulkTxPacketAvailable, // pfnAvailable + (void *)&g_sBulkDevice, // pvHandle + g_pui8USBTxBuffer, // pi8Buffer + BULK_BUFFER_SIZE, // ui32BufferSize + g_pui8TxBufferWorkspace // pvWorkspace +}; diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.h b/boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.h new file mode 100644 index 0000000..e7d41b6 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_bulk_structs.h @@ -0,0 +1,48 @@ +//***************************************************************************** +// +// usb_bulk_structs.h - Data structures defining this bulk USB device. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef _USB_BULK_STRUCTS_H_ +#define _USB_BULK_STRUCTS_H_ + +//***************************************************************************** +// +// The size of the transmit and receive buffers used. 256 is chosen pretty +// much at random though the buffer should be at least twice the size of +// a maximum-sized USB packet. +// +//***************************************************************************** +#define BULK_BUFFER_SIZE 256 + +extern uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); +extern uint32_t TxHandler(void *pvi32CBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); + +extern const tUSBBuffer g_sTxBuffer; +extern const tUSBBuffer g_sRxBuffer; +extern tUSBDBulkDevice g_sBulkDevice; +extern uint8_t g_pui8USBTxBuffer[]; +extern uint8_t g_pui8USBRxBuffer[]; + +#endif diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.c b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.c new file mode 100644 index 0000000..93f32f3 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.c @@ -0,0 +1,709 @@ +//***************************************************************************** +// +// usb_dev_bulk.c - Main routines for the generic bulk device example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_gpio.h" +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_sysctl.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/pin_map.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/timer.h" +#include "driverlib/uart.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "usblib/usblib.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdbulk.h" +#include "utils/uartstdio.h" +#include "utils/ustdlib.h" +#include "drivers/cfal96x64x16.h" +#include "usb_bulk_structs.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB Generic Bulk Device (usb_dev_bulk)

+//! +//! This example provides a generic USB device offering simple bulk data +//! transfer to and from the host. The device uses a vendor-specific class ID +//! and supports a single bulk IN endpoint and a single bulk OUT endpoint. +//! Data received from the host is assumed to be ASCII text and it is +//! echoed back with the case of all alphabetic characters swapped. +//! +//! A Windows INF file for the device is provided on the installation CD and +//! in the C:/ti/TivaWare_C_Series-x.x/windows_drivers directory of TivaWare +//! releases. This INF contains information required to install the WinUSB +//! subsystem on WindowsXP and Vista PCs. WinUSB is a Windows subsystem +//! allowing user mode applications to access the USB device without the need +//! for a vendor-specific kernel mode driver. +//! +//! A sample Windows command-line application, usb_bulk_example, illustrating +//! how to connect to and communicate with the bulk device is also provided. +//! The application binary is installed as part of the ``TivaWare for C Series +//! PC Companion Utilities'' package (SW-TM4C-USB-WIN) on the installation CD +//! or via download from http://www.ti.com/tivaware . Project files are +//! included to allow the examples to be built using +//! Microsoft Visual Studio 2008. Source code for this application can be +//! found in directory ti/TivaWare_C_Series-x.x/tools/usb_bulk_example. +// +//***************************************************************************** + +//***************************************************************************** +// +// The system tick rate expressed both as ticks per second and a millisecond +// period. +// +//***************************************************************************** +#define SYSTICKS_PER_SECOND 100 +#define SYSTICK_PERIOD_MS (1000 / SYSTICKS_PER_SECOND) + +//***************************************************************************** +// +// The global system tick counter. +// +//***************************************************************************** +volatile uint32_t g_ui32SysTickCount = 0; + +//***************************************************************************** +// +// Variables tracking transmit and receive counts. +// +//***************************************************************************** +volatile uint32_t g_ui32TxCount = 0; +volatile uint32_t g_ui32RxCount = 0; +#ifdef DEBUG +uint32_t g_ui32UARTRxErrors = 0; +#endif + +//***************************************************************************** +// +// Debug-related definitions and declarations. +// +// Debug output is available via UART0 if DEBUG is defined during build. +// +//***************************************************************************** +#ifdef DEBUG +//***************************************************************************** +// +// Map all debug print calls to UARTprintf in debug builds. +// +//***************************************************************************** +#define DEBUG_PRINT UARTprintf + +#else + +//***************************************************************************** +// +// Compile out all debug print calls in release builds. +// +//***************************************************************************** +#define DEBUG_PRINT while(0) ((int32_t (*)(char *, ...))0) +#endif + +//***************************************************************************** +// +// Graphics context used to show text on the color LCD display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// Flags used to pass commands from interrupt context to the main loop. +// +//***************************************************************************** +#define COMMAND_PACKET_RECEIVED 0x00000001 +#define COMMAND_STATUS_UPDATE 0x00000002 + +volatile uint32_t g_ui32Flags = 0; +char *g_pcStatus; + +//***************************************************************************** +// +// Global flag indicating that a USB configuration has been set. +// +//***************************************************************************** +static volatile bool g_bUSBConfigured = false; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ + UARTprintf("Error at line %d of %s\n", ui32Line, pcFilename); + while(1) + { + } +} +#endif + +//***************************************************************************** +// +// Interrupt handler for the system tick counter. +// +//***************************************************************************** +void +SysTickIntHandler(void) +{ + // + // Update our system tick counter. + // + g_ui32SysTickCount++; +} + +//***************************************************************************** +// +// Receive new data and echo it back to the host. +// +// \param psDevice points to the instance data for the device whose data is to +// be processed. +// \param pi8Data points to the newly received data in the USB receive buffer. +// \param ui32NumBytes is the number of bytes of data available to be processed. +// +// This function is called whenever we receive a notification that data is +// available from the host. We read the data, byte-by-byte and swap the case +// of any alphabetical characters found then write it back out to be +// transmitted back to the host. +// +// \return Returns the number of bytes of data processed. +// +//***************************************************************************** +static uint32_t +EchoNewDataToHost(tUSBDBulkDevice *psDevice, uint8_t *pi8Data, + uint_fast32_t ui32NumBytes) +{ + uint_fast32_t ui32Loop, ui32Space, ui32Count; + uint_fast32_t ui32ReadIndex; + uint_fast32_t ui32WriteIndex; + tUSBRingBufObject sTxRing; + + // + // Get the current buffer information to allow us to write directly to + // the transmit buffer (we already have enough information from the + // parameters to access the receive buffer directly). + // + USBBufferInfoGet(&g_sTxBuffer, &sTxRing); + + // + // How much space is there in the transmit buffer? + // + ui32Space = USBBufferSpaceAvailable(&g_sTxBuffer); + + // + // How many characters can we process this time round? + // + ui32Loop = (ui32Space < ui32NumBytes) ? ui32Space : ui32NumBytes; + ui32Count = ui32Loop; + + // + // Update our receive counter. + // + g_ui32RxCount += ui32NumBytes; + + // + // Dump a debug message. + // + DEBUG_PRINT("Received %d bytes\n", ui32NumBytes); + + // + // Set up to process the characters by directly accessing the USB buffers. + // + ui32ReadIndex = (uint32_t)(pi8Data - g_pui8USBRxBuffer); + ui32WriteIndex = sTxRing.ui32WriteIndex; + + while(ui32Loop) + { + // + // Copy from the receive buffer to the transmit buffer converting + // character case on the way. + // + + // + // Is this a lower case character? + // + if((g_pui8USBRxBuffer[ui32ReadIndex] >= 'a') && + (g_pui8USBRxBuffer[ui32ReadIndex] <= 'z')) + { + // + // Convert to upper case and write to the transmit buffer. + // + g_pui8USBTxBuffer[ui32WriteIndex] = + (g_pui8USBRxBuffer[ui32ReadIndex] - 'a') + 'A'; + } + else + { + // + // Is this an upper case character? + // + if((g_pui8USBRxBuffer[ui32ReadIndex] >= 'A') && + (g_pui8USBRxBuffer[ui32ReadIndex] <= 'Z')) + { + // + // Convert to lower case and write to the transmit buffer. + // + g_pui8USBTxBuffer[ui32WriteIndex] = + (g_pui8USBRxBuffer[ui32ReadIndex] - 'Z') + 'z'; + } + else + { + // + // Copy the received character to the transmit buffer. + // + g_pui8USBTxBuffer[ui32WriteIndex] = + g_pui8USBRxBuffer[ui32ReadIndex]; + } + } + + // + // Move to the next character taking care to adjust the pointer for + // the buffer wrap if necessary. + // + ui32WriteIndex++; + ui32WriteIndex = + (ui32WriteIndex == BULK_BUFFER_SIZE) ? 0 : ui32WriteIndex; + + ui32ReadIndex++; + ui32ReadIndex = (ui32ReadIndex == BULK_BUFFER_SIZE) ? 0 : ui32ReadIndex; + + ui32Loop--; + } + + // + // We've processed the data in place so now send the processed data + // back to the host. + // + USBBufferDataWritten(&g_sTxBuffer, ui32Count); + + DEBUG_PRINT("Wrote %d bytes\n", ui32Count); + + // + // We processed as much data as we can directly from the receive buffer so + // we need to return the number of bytes to allow the lower layer to + // update its read pointer appropriately. + // + return(ui32Count); +} + +//***************************************************************************** +// +// Shows the status string on the display. +// +// \param psContext is a pointer to the graphics context representing the +// display. +// \param pi8Status is a pointer to the string to be shown. +// +//***************************************************************************** +void +DisplayStatus(tContext *psContext, char *pcStatus) +{ + // + // Clear the line with black. + // + GrContextForegroundSet(&g_sContext, ClrBlack); + GrStringDrawCentered(psContext, " ", -1, + GrContextDpyWidthGet(psContext) / 2, 16, true); + + // + // Draw the new status string + // + DEBUG_PRINT("%s\n", pcStatus); + GrContextForegroundSet(&g_sContext, ClrWhite); + GrStringDrawCentered(psContext, pcStatus, -1, + GrContextDpyWidthGet(psContext) / 2, 16, true); +} + +//***************************************************************************** +// +// Handles bulk driver notifications related to the transmit channel (data to +// the USB host). +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the bulk driver to notify us of any events +// related to operation of the transmit data channel (the IN channel carrying +// data to the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData) +{ + // + // We are not required to do anything in response to any transmit event + // in this example. All we do is update our transmit counter. + // + if(ui32Event == USB_EVENT_TX_COMPLETE) + { + g_ui32TxCount += ui32MsgValue; + } + + // + // Dump a debug message. + // + DEBUG_PRINT("TX complete %d\n", ui32MsgValue); + + return(0); +} + +//***************************************************************************** +// +// Handles bulk driver notifications related to the receive channel (data from +// the USB host). +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the bulk driver to notify us of any events +// related to operation of the receive data channel (the OUT channel carrying +// data from the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData) +{ + // + // Which event are we being sent? + // + switch(ui32Event) + { + // + // We are connected to a host and communication is now possible. + // + case USB_EVENT_CONNECTED: + { + g_bUSBConfigured = true; + g_pcStatus = "Host connected."; + g_ui32Flags |= COMMAND_STATUS_UPDATE; + + // + // Flush our buffers. + // + USBBufferFlush(&g_sTxBuffer); + USBBufferFlush(&g_sRxBuffer); + + break; + } + + // + // The host has disconnected. + // + case USB_EVENT_DISCONNECTED: + { + g_bUSBConfigured = false; + g_pcStatus = "Host disconn."; + g_ui32Flags |= COMMAND_STATUS_UPDATE; + break; + } + + // + // A new packet has been received. + // + case USB_EVENT_RX_AVAILABLE: + { + tUSBDBulkDevice *psDevice; + + // + // Get a pointer to our instance data from the callback data + // parameter. + // + psDevice = (tUSBDBulkDevice *)pvCBData; + + // + // Read the new packet and echo it back to the host. + // + return(EchoNewDataToHost(psDevice, pvMsgData, ui32MsgValue)); + } + + // + // Ignore SUSPEND and RESUME for now. + // + case USB_EVENT_SUSPEND: + case USB_EVENT_RESUME: + break; + + // + // Ignore all other events and return 0. + // + default: + break; + } + + return(0); +} + +#ifdef DEBUG +//***************************************************************************** +// +// Configure the UART and its pins. This must be called before UARTprintf(). +// +//***************************************************************************** +void +ConfigureUART(void) +{ + // + // Enable the GPIO Peripheral used by the UART. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Enable UART0 + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Configure GPIO Pins for UART mode. + // + ROM_GPIOPinConfigure(GPIO_PA0_U0RX); + ROM_GPIOPinConfigure(GPIO_PA1_U0TX); + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Use the internal 16MHz oscillator as the UART clock source. + // + UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); + + // + // Initialize the UART for console I/O. + // + UARTStdioConfig(0, 115200, 16000000); + // + UARTStdioConfig(0, 115200, 16000000); +} +#endif + +//***************************************************************************** +// +// This is the main application entry function. +// +//***************************************************************************** +int +main(void) +{ + uint_fast32_t ui32TxCount; + uint_fast32_t ui32RxCount; + tRectangle sRect; + char pcBuffer[16]; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run from the PLL at 50MHz + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + +#ifdef DEBUG + // + // Configure the UART for debug output. + // + ConfigureUART(); +#endif + + // + // Not configured initially. + // + g_bUSBConfigured = false; + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "usb-dev-bulk", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + + // + // Show the various static text elements on the color STN display. + // + GrStringDraw(&g_sContext, "Tx bytes:", -1, 0, 32, false); + GrStringDraw(&g_sContext, "Rx bytes:", -1, 0, 42, false); + + // + // Enable the GPIO peripheral used for USB, and configure the USB + // pins. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + + // + // Erratum workaround for silicon revision A1. VBUS must have pull-down. + // + if(CLASS_IS_TM4C123 && REVISION_IS_A1) + { + HWREG(GPIO_PORTB_BASE + GPIO_O_PDR) |= GPIO_PIN_1; + } + + // + // Enable the system tick. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); + ROM_SysTickIntEnable(); + ROM_SysTickEnable(); + + // + // Show the application name on the display and UART output. + // + DEBUG_PRINT("\nTiva C Series USB bulk device example\n"); + DEBUG_PRINT("---------------------------------\n\n"); + + // + // Tell the user what we are up to. + // + DisplayStatus(&g_sContext, "Configuring USB"); + + // + // Initialize the transmit and receive buffers. + // + USBBufferInit(&g_sTxBuffer); + USBBufferInit(&g_sRxBuffer); + + // + // Initialize the USB stack for device mode. + // + USBStackModeSet(0, eUSBModeDevice, 0); + + // + // Pass our device information to the USB library and place the device + // on the bus. + // + USBDBulkInit(0, &g_sBulkDevice); + + // + // Wait for initial configuration to complete. + // + DisplayStatus(&g_sContext, "Waiting for host"); + + // + // Clear our local byte counters. + // + ui32RxCount = 0; + ui32TxCount = 0; + + // + // Main application loop. + // + while(1) + { + + // + // Have we been asked to update the status display? + // + if(g_ui32Flags & COMMAND_STATUS_UPDATE) + { + // + // Clear the command flag + // + g_ui32Flags &= ~COMMAND_STATUS_UPDATE; + DisplayStatus(&g_sContext, g_pcStatus); + } + + // + // Has there been any transmit traffic since we last checked? + // + if(ui32TxCount != g_ui32TxCount) + { + // + // Take a snapshot of the latest transmit count. + // + ui32TxCount = g_ui32TxCount; + + // + // Update the display of bytes transmitted by the UART. + // + usnprintf(pcBuffer, 16, " %d ", ui32TxCount); + GrStringDraw(&g_sContext, pcBuffer, -1, 48, 32, true); + } + + // + // Has there been any receive traffic since we last checked? + // + if(ui32RxCount != g_ui32RxCount) + { + // + // Take a snapshot of the latest receive count. + // + ui32RxCount = g_ui32RxCount; + + // + // Update the display of bytes received by the UART. + // + usnprintf(pcBuffer, 16, " %d ", ui32RxCount); + GrStringDraw(&g_sContext, pcBuffer, -1, 48, 42, true); + } + } +} diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewd b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewp b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewp new file mode 100644 index 0000000..b2c5947 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ewp @@ -0,0 +1,805 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_bulk_structs.c + + + $PROJ_DIR$\usb_dev_bulk.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.icf b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.icf new file mode 100644 index 0000000..8e7cd11 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_dev_bulk.icf - Linker configuration file for usb_dev_bulk. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ld b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ld new file mode 100644 index 0000000..bc6970f --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_dev_bulk.ld - Linker configuration file for usb_dev_bulk. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.sct b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.sct new file mode 100644 index 0000000..ee76b8c --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_dev_bulk.sct - Linker configuration file for usb_dev_bulk. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvopt b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvopt new file mode 100644 index 0000000..4ddda85 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvopt @@ -0,0 +1,373 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_dev_bulk + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_bulk_structs.c + usb_bulk_structs.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_dev_bulk.c + usb_dev_bulk.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 8 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 9 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 10 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvproj b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvproj new file mode 100644 index 0000000..ca87e99 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk.uvproj @@ -0,0 +1,454 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_dev_bulk + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_dev_bulk + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_dev_bulk.bin .\rvmdk\usb_dev_bulk.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 UART_BUFFERED + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_dev_bulk.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_bulk_structs.c + 1 + .\usb_bulk_structs.c + + + usb_dev_bulk.c + 1 + .\usb_dev_bulk.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk_ccs.cmd b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk_ccs.cmd new file mode 100644 index 0000000..7acff4d --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_bulk/usb_dev_bulk_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_dev_bulk_ccs.cmd - CCS linker configuration file for usb_dev_bulk. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/usb_dev_keyboard/Makefile b/boards/ek-lm4f232/usb_dev_keyboard/Makefile new file mode 100644 index 0000000..48ddedf --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/Makefile @@ -0,0 +1,92 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB device keyboard example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the USB device keyboard example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_dev_keyboard.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB device keyboard example. +# +${COMPILER}/usb_dev_keyboard.axf: ${COMPILER}/buttons.o +${COMPILER}/usb_dev_keyboard.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_dev_keyboard.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_dev_keyboard.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_dev_keyboard.axf: ${COMPILER}/usb_dev_keyboard.o +${COMPILER}/usb_dev_keyboard.axf: ${COMPILER}/usb_keyb_structs.o +${COMPILER}/usb_dev_keyboard.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_dev_keyboard.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_dev_keyboard.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_dev_keyboard.axf: usb_dev_keyboard.ld +SCATTERgcc_usb_dev_keyboard=usb_dev_keyboard.ld +ENTRY_usb_dev_keyboard=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 -DUART_BUFFERED + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsimportspec new file mode 100644 index 0000000..4a82f9a --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsimportspec @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsproject b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/.cproject b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.cproject new file mode 100644 index 0000000..176715b --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.cproject @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/.project b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.project new file mode 100644 index 0000000..232d061 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.project @@ -0,0 +1,70 @@ + + + usb_dev_keyboard + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_keyboard/startup_ccs.c + + + usb_dev_keyboard.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.c + + + usb_dev_keyboard_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard_ccs.cmd + + + usb_keyb_structs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.c + + + drivers/buttons.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/buttons.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.bin b/boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.bin new file mode 100644 index 0000000..8277ca3 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.out b/boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.out new file mode 100644 index 0000000..2b09d35 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/ccs/Debug/usb_dev_keyboard.out differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_dev_keyboard/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_dev_keyboard/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.bin b/boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.bin new file mode 100644 index 0000000..11d274a Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.out b/boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.out new file mode 100644 index 0000000..880b42d Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/ewarm/Exe/usb_dev_keyboard.out differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.axf b/boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.axf new file mode 100644 index 0000000..892a54a Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.axf differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.bin b/boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.bin new file mode 100644 index 0000000..92c6679 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/gcc/usb_dev_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/readme.txt b/boards/ek-lm4f232/usb_dev_keyboard/readme.txt new file mode 100644 index 0000000..65948ca --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/readme.txt @@ -0,0 +1,37 @@ +USB HID Keyboard Device + +This example application turns the evaluation board into a USB keyboard +supporting the Human Interface Device class. When the push button is +pressed, a sequence of key presses is simulated to type a string. Care +should be taken to ensure that the active window can safely receive the +text; enter is not pressed at any point so no actions are attempted by the +host if a terminal window is used (for example). The status LED is used to +indicate the current Caps Lock state and is updated in response to any +other keyboard attached to the same USB host system. + +The device implemented by this application also supports USB remote wakeup +allowing it to request the host to reactivate a suspended bus. If the bus +is suspended (as indicated on the application display), pressing the +push button will request a remote wakeup assuming the host has not +specifically disabled such requests. + + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.axf b/boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.axf new file mode 100644 index 0000000..7db3f8f Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.axf differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.bin b/boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.bin new file mode 100644 index 0000000..34b3140 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_keyboard/rvmdk/usb_dev_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_dev_keyboard/startup_ccs.c b/boards/ek-lm4f232/usb_dev_keyboard/startup_ccs.c new file mode 100644 index 0000000..f1bf41e --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/startup_ccs.c @@ -0,0 +1,304 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void UARTStdioIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTStdioIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_keyboard/startup_ewarm.c b/boards/ek-lm4f232/usb_dev_keyboard/startup_ewarm.c new file mode 100644 index 0000000..b803406 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/startup_ewarm.c @@ -0,0 +1,335 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void UARTStdioIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTStdioIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_keyboard/startup_gcc.c b/boards/ek-lm4f232/usb_dev_keyboard/startup_gcc.c new file mode 100644 index 0000000..0e5df70 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/startup_gcc.c @@ -0,0 +1,351 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void UARTStdioIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + UARTStdioIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_keyboard/startup_rvmdk.S b/boards/ek-lm4f232/usb_dev_keyboard/startup_rvmdk.S new file mode 100644 index 0000000..36b47aa --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/startup_rvmdk.S @@ -0,0 +1,360 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickIntHandler + EXTERN UARTStdioIntHandler + EXTERN USB0DeviceIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickIntHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD UARTStdioIntHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0DeviceIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.c b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.c new file mode 100644 index 0000000..028e97c --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.c @@ -0,0 +1,731 @@ +//***************************************************************************** +// +// usb_dev_keyboard.c - Main routines for the keyboard example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_gpio.h" +#include "inc/hw_sysctl.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "usblib/usblib.h" +#include "usblib/usbhid.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdhid.h" +#include "usblib/device/usbdhidkeyb.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/buttons.h" +#include "usb_keyb_structs.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB HID Keyboard Device (usb_dev_keyboard)

+//! +//! This example application turns the evaluation board into a USB keyboard +//! supporting the Human Interface Device class. When the push button is +//! pressed, a sequence of key presses is simulated to type a string. Care +//! should be taken to ensure that the active window can safely receive the +//! text; enter is not pressed at any point so no actions are attempted by the +//! host if a terminal window is used (for example). The status LED is used to +//! indicate the current Caps Lock state and is updated in response to any +//! other keyboard attached to the same USB host system. +//! +//! The device implemented by this application also supports USB remote wakeup +//! allowing it to request the host to reactivate a suspended bus. If the bus +//! is suspended (as indicated on the application display), pressing the +//! push button will request a remote wakeup assuming the host has not +//! specifically disabled such requests. +//! +// +//***************************************************************************** + +//***************************************************************************** +// +// The system tick timer period. +// +//***************************************************************************** +#define SYSTICKS_PER_SECOND 100 + +//***************************************************************************** +// +// A mapping from the ASCII value received from the UART to the corresponding +// USB HID usage code. +// +//***************************************************************************** +static const int8_t g_ppi8KeyUsageCodes[][2] = +{ + { 0, HID_KEYB_USAGE_SPACE }, // 0x20 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_1 }, // ! 0x21 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_FQUOTE }, // " 0x22 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_3 }, // # 0x23 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_4 }, // $ 0x24 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_5 }, // % 0x25 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_7 }, // & 0x26 + { 0, HID_KEYB_USAGE_FQUOTE }, // ' 0x27 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_9 }, // ( 0x28 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_0 }, // ) 0x29 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_8 }, // * 0x2a + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_EQUAL }, // + 0x2b + { 0, HID_KEYB_USAGE_COMMA }, // , 0x2c + { 0, HID_KEYB_USAGE_MINUS }, // - 0x2d + { 0, HID_KEYB_USAGE_PERIOD }, // . 0x2e + { 0, HID_KEYB_USAGE_FSLASH }, // / 0x2f + { 0, HID_KEYB_USAGE_0 }, // 0 0x30 + { 0, HID_KEYB_USAGE_1 }, // 1 0x31 + { 0, HID_KEYB_USAGE_2 }, // 2 0x32 + { 0, HID_KEYB_USAGE_3 }, // 3 0x33 + { 0, HID_KEYB_USAGE_4 }, // 4 0x34 + { 0, HID_KEYB_USAGE_5 }, // 5 0x35 + { 0, HID_KEYB_USAGE_6 }, // 6 0x36 + { 0, HID_KEYB_USAGE_7 }, // 7 0x37 + { 0, HID_KEYB_USAGE_8 }, // 8 0x38 + { 0, HID_KEYB_USAGE_9 }, // 9 0x39 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_SEMICOLON }, // : 0x3a + { 0, HID_KEYB_USAGE_SEMICOLON }, // ; 0x3b + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_COMMA }, // < 0x3c + { 0, HID_KEYB_USAGE_EQUAL }, // = 0x3d + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_PERIOD }, // > 0x3e + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_FSLASH }, // ? 0x3f + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_2 }, // @ 0x40 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_A }, // A 0x41 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_B }, // B 0x42 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_C }, // C 0x43 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_D }, // D 0x44 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_E }, // E 0x45 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_F }, // F 0x46 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_G }, // G 0x47 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_H }, // H 0x48 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_I }, // I 0x49 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_J }, // J 0x4a + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_K }, // K 0x4b + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_L }, // L 0x4c + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_M }, // M 0x4d + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_N }, // N 0x4e + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_O }, // O 0x4f + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_P }, // P 0x50 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_Q }, // Q 0x51 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_R }, // R 0x52 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_S }, // S 0x53 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_T }, // T 0x54 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_U }, // U 0x55 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_V }, // V 0x56 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_W }, // W 0x57 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_X }, // X 0x58 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_Y }, // Y 0x59 + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_Z }, // Z 0x5a + { 0, HID_KEYB_USAGE_LBRACKET }, // [ 0x5b + { 0, HID_KEYB_USAGE_BSLASH }, // \ 0x5c + { 0, HID_KEYB_USAGE_RBRACKET }, // ] 0x5d + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_6 }, // ^ 0x5e + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_MINUS }, // _ 0x5f + { 0, HID_KEYB_USAGE_BQUOTE }, // ` 0x60 + { 0, HID_KEYB_USAGE_A }, // a 0x61 + { 0, HID_KEYB_USAGE_B }, // b 0x62 + { 0, HID_KEYB_USAGE_C }, // c 0x63 + { 0, HID_KEYB_USAGE_D }, // d 0x64 + { 0, HID_KEYB_USAGE_E }, // e 0x65 + { 0, HID_KEYB_USAGE_F }, // f 0x66 + { 0, HID_KEYB_USAGE_G }, // g 0x67 + { 0, HID_KEYB_USAGE_H }, // h 0x68 + { 0, HID_KEYB_USAGE_I }, // i 0x69 + { 0, HID_KEYB_USAGE_J }, // j 0x6a + { 0, HID_KEYB_USAGE_K }, // k 0x6b + { 0, HID_KEYB_USAGE_L }, // l 0x6c + { 0, HID_KEYB_USAGE_M }, // m 0x6d + { 0, HID_KEYB_USAGE_N }, // n 0x6e + { 0, HID_KEYB_USAGE_O }, // o 0x6f + { 0, HID_KEYB_USAGE_P }, // p 0x70 + { 0, HID_KEYB_USAGE_Q }, // q 0x71 + { 0, HID_KEYB_USAGE_R }, // r 0x72 + { 0, HID_KEYB_USAGE_S }, // s 0x73 + { 0, HID_KEYB_USAGE_T }, // t 0x74 + { 0, HID_KEYB_USAGE_U }, // u 0x75 + { 0, HID_KEYB_USAGE_V }, // v 0x76 + { 0, HID_KEYB_USAGE_W }, // w 0x77 + { 0, HID_KEYB_USAGE_X }, // x 0x78 + { 0, HID_KEYB_USAGE_Y }, // y 0x79 + { 0, HID_KEYB_USAGE_Z }, // z 0x7a + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_LBRACKET }, // { 0x7b + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_BSLASH }, // | 0x7c + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_RBRACKET }, // } 0x7d + { HID_KEYB_LEFT_SHIFT, HID_KEYB_USAGE_BQUOTE }, // ~ 0x7e +}; + +//***************************************************************************** +// +// This global indicates whether or not we are connected to a USB host. +// +//***************************************************************************** +volatile bool g_bConnected = false; + +//***************************************************************************** +// +// This global indicates whether or not the USB bus is currently in the suspend +// state. +// +//***************************************************************************** +volatile bool g_bSuspended = false; + +//***************************************************************************** +// +// Global system tick counter holds elapsed time since the application started +// expressed in 100ths of a second. +// +//***************************************************************************** +volatile uint32_t g_ui32SysTickCount; + +//***************************************************************************** +// +// The number of system ticks to wait for each USB packet to be sent before +// we assume the host has disconnected. The value 50 equates to half a second. +// +//***************************************************************************** +#define MAX_SEND_DELAY 50 + +//***************************************************************************** +// +// This global is set to true if the host sends a request to set or clear +// any keyboard LED. +// +//***************************************************************************** +volatile bool g_bDisplayUpdateRequired; + +//***************************************************************************** +// +// This enumeration holds the various states that the keyboard can be in during +// normal operation. +// +//***************************************************************************** +volatile enum +{ + // + // Unconfigured. + // + STATE_UNCONFIGURED, + + // + // No keys to send and not waiting on data. + // + STATE_IDLE, + + // + // Waiting on data to be sent out. + // + STATE_SENDING +} +g_eKeyboardState = STATE_UNCONFIGURED; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Handles asynchronous events from the HID keyboard driver. +// +// \param pvCBData is the event callback pointer provided during +// USBDHIDKeyboardInit(). This is a pointer to our keyboard device structure +// (&g_sKeyboardDevice). +// \param ui32Event identifies the event we are being called back for. +// \param ui32MsgData is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the HID keyboard driver to inform the application +// of particular asynchronous events related to operation of the keyboard HID +// device. +// +// \return Returns 0 in all cases. +// +//***************************************************************************** +uint32_t +KeyboardHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgData, + void *pvMsgData) +{ + switch (ui32Event) + { + // + // The host has connected to us and configured the device. + // + case USB_EVENT_CONNECTED: + { + g_bConnected = true; + g_bSuspended = false; + break; + } + + // + // The host has disconnected from us. + // + case USB_EVENT_DISCONNECTED: + { + g_bConnected = false; + break; + } + + // + // We receive this event every time the host acknowledges transmission + // of a report. It is used here purely as a way of determining whether + // the host is still talking to us or not. + // + case USB_EVENT_TX_COMPLETE: + { + // + // Enter the idle state since we finished sending something. + // + g_eKeyboardState = STATE_IDLE; + break; + } + + // + // This event indicates that the host has suspended the USB bus. + // + case USB_EVENT_SUSPEND: + { + g_bSuspended = true; + break; + } + + // + // This event signals that the host has resumed signalling on the bus. + // + case USB_EVENT_RESUME: + { + g_bSuspended = false; + break; + } + + // + // This event indicates that the host has sent us an Output or + // Feature report and that the report is now in the buffer we provided + // on the previous USBD_HID_EVENT_GET_REPORT_BUFFER callback. + // + case USBD_HID_KEYB_EVENT_SET_LEDS: + { + // + // Set the LED to match the current state of the caps lock LED. + // + ROM_GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, + (ui32MsgData & HID_KEYB_CAPS_LOCK) ? GPIO_PIN_2 : + 0); + + break; + } + + // + // We ignore all other events. + // + default: + { + break; + } + } + + return(0); +} + +//*************************************************************************** +// +// Wait for a period of time for the state to become idle. +// +// \param ui32TimeoutTick is the number of system ticks to wait before +// declaring a timeout and returning \b false. +// +// This function polls the current keyboard state for ui32TimeoutTicks system +// ticks waiting for it to become idle. If the state becomes idle, the +// function returns true. If it ui32TimeoutTicks occur prior to the state +// becoming idle, false is returned to indicate a timeout. +// +// \return Returns \b true on success or \b false on timeout. +// +//*************************************************************************** +bool +WaitForSendIdle(uint_fast32_t ui32TimeoutTicks) +{ + uint32_t ui32Start; + uint32_t ui32Now; + uint32_t ui32Elapsed; + + ui32Start = g_ui32SysTickCount; + ui32Elapsed = 0; + + while(ui32Elapsed < ui32TimeoutTicks) + { + // + // Is the keyboard is idle, return immediately. + // + if(g_eKeyboardState == STATE_IDLE) + { + return(true); + } + + // + // Determine how much time has elapsed since we started waiting. This + // should be safe across a wrap of g_ui32SysTickCount. + // + ui32Now = g_ui32SysTickCount; + ui32Elapsed = ((ui32Start < ui32Now) ? (ui32Now - ui32Start) : + (((uint32_t)0xFFFFFFFF - ui32Start) + ui32Now + 1)); + } + + // + // If we get here, we timed out so return a bad return code to let the + // caller know. + // + return(false); +} + +//***************************************************************************** +// +// Sends a string of characters via the USB HID keyboard interface. +// +//***************************************************************************** +void +SendString(char *pcStr) +{ + uint32_t ui32Char; + + // + // Loop while there are more characters in the string. + // + while(*pcStr) + { + // + // Get the next character from the string. + // + ui32Char = *pcStr++; + + // + // Skip this character if it is a non-printable character. + // + if((ui32Char < ' ') || (ui32Char > '~')) + { + continue; + } + + // + // Convert the character into an index into the keyboard usage code + // table. + // + ui32Char -= ' '; + + // + // Send the key press message. + // + g_eKeyboardState = STATE_SENDING; + if(USBDHIDKeyboardKeyStateChange((void *)&g_sKeyboardDevice, + g_ppi8KeyUsageCodes[ui32Char][0], + g_ppi8KeyUsageCodes[ui32Char][1], + true) != KEYB_SUCCESS) + { + return; + } + + // + // Wait until the key press message has been sent. + // + if(!WaitForSendIdle(MAX_SEND_DELAY)) + { + g_bConnected = 0; + return; + } + + // + // Send the key release message. + // + g_eKeyboardState = STATE_SENDING; + if(USBDHIDKeyboardKeyStateChange((void *)&g_sKeyboardDevice, + 0, g_ppi8KeyUsageCodes[ui32Char][1], + false) != KEYB_SUCCESS) + { + return; + } + + // + // Wait until the key release message has been sent. + // + if(!WaitForSendIdle(MAX_SEND_DELAY)) + { + g_bConnected = 0; + return; + } + } +} + +//***************************************************************************** +// +// This is the interrupt handler for the SysTick interrupt. It is used to +// update our local tick count which, in turn, is used to check for transmit +// timeouts. +// +//***************************************************************************** +void +SysTickIntHandler(void) +{ + g_ui32SysTickCount++; +} + +//***************************************************************************** +// +// This is the main loop that runs the application. +// +//***************************************************************************** +int +main(void) +{ + uint_fast32_t ui32LastTickCount; + bool bLastSuspend; + tRectangle sRect; + tContext sContext; + int_fast32_t i32CenterX; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run from the PLL at 50MHz. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Configure the required pins for USB operation. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Erratum workaround for silicon revision A1. VBUS must have pull-down. + // + if(CLASS_IS_TM4C123 && REVISION_IS_A1) + { + HWREG(GPIO_PORTB_BASE + GPIO_O_PDR) |= GPIO_PIN_1; + } + + // + // Enable the GPIO that is used for the on-board LED. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2); + ROM_GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, 0); + + // + // Initialize the buttons driver + // + ButtonsInit(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context and find the middle X coordinate. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + i32CenterX = GrContextDpyWidthGet(&sContext) / 2; + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "usb-dev-keyboard", -1, i32CenterX, 4, 0); + + // + // Not configured initially. + // + g_bConnected = false; + g_bSuspended = false; + bLastSuspend = false; + + // + // Initialize the USB stack for device mode. + // + USBStackModeSet(0, eUSBModeDevice, 0); + + // + // Pass our device information to the USB HID device class driver, + // initialize the USB + // controller and connect the device to the bus. + // + USBDHIDKeyboardInit(0, &g_sKeyboardDevice); + + // + // Set the system tick to fire 100 times per second. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); + ROM_SysTickIntEnable(); + ROM_SysTickEnable(); + + // + // The main loop starts here. We begin by waiting for a host connection + // then drop into the main keyboard handling section. If the host + // disconnects, we return to the top and wait for a new connection. + // + while(1) + { + uint8_t ui8Buttons; + uint8_t ui8ButtonsChanged; + + // + // Tell the user what we are doing and provide some basic instructions. + // + GrStringDrawCentered(&sContext, " Waiting ", + -1, i32CenterX, 22, 1); + GrStringDrawCentered(&sContext, " for host ... ", -1, + i32CenterX, 32, 1); + + // + // Wait here until USB device is connected to a host. + // + while(!g_bConnected) + { + } + + // + // Update the status. + // + GrStringDrawCentered(&sContext, " Host ", + -1, i32CenterX, 22, 1); + GrStringDrawCentered(&sContext, " connected ... ", + -1, i32CenterX, 32, 1); + + // + // Enter the idle state. + // + g_eKeyboardState = STATE_IDLE; + + // + // Assume that the bus is not currently suspended if we have just been + // configured. + // + bLastSuspend = false; + + // + // Keep transferring characters from the UART to the USB host for as + // long as we are connected to the host. + // + while(g_bConnected) + { + // + // Remember the current time. + // + ui32LastTickCount = g_ui32SysTickCount; + + // + // Has the suspend state changed since last time we checked? + // + if(bLastSuspend != g_bSuspended) + { + // + // Yes - the state changed so update the display. + // + bLastSuspend = g_bSuspended; + if(bLastSuspend) + { + GrStringDrawCentered(&sContext, " Bus ", -1, + i32CenterX, 22, 1); + GrStringDrawCentered(&sContext, " suspended ... ", -1, + i32CenterX, 32, 1); + } + else + { + GrStringDrawCentered(&sContext, " Host ", -1, + i32CenterX, 22, 1); + GrStringDrawCentered(&sContext, " connected ... ", + -1, i32CenterX, 32, 1); + } + } + + // + // See if the button was just pressed. + // + ui8Buttons = ButtonsPoll(&ui8ButtonsChanged, 0); + if(BUTTON_PRESSED(SELECT_BUTTON, ui8Buttons, ui8ButtonsChanged)) + { + // + // If the bus is suspended then resume it. Otherwise, type + // some "random" characters. + // + if(g_bSuspended) + { + USBDHIDKeyboardRemoteWakeupRequest( + (void *)&g_sKeyboardDevice); + } + else + { + SendString("Make the Switch to TI Microcontrollers!"); + } + } + + // + // Wait for at least 1 system tick to have gone by before we poll + // the buttons again. + // + while(g_ui32SysTickCount == ui32LastTickCount) + { + } + } + } +} diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewd b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewp b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewp new file mode 100644 index 0000000..f8c0038 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ewp @@ -0,0 +1,805 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\buttons.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_dev_keyboard.c + + + $PROJ_DIR$\usb_keyb_structs.c + + + diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.icf b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.icf new file mode 100644 index 0000000..fe2f11e --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_dev_keyboard.icf - Linker configuration file for usb_dev_keyboard. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ld b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ld new file mode 100644 index 0000000..3b6f6fc --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_dev_keyboard.ld - Linker configuration file for usb_dev_keyboard. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.sct b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.sct new file mode 100644 index 0000000..de7ce34 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_dev_keyboard.sct - Linker configuration file for usb_dev_keyboard. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvopt b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvopt new file mode 100644 index 0000000..76a34a0 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvopt @@ -0,0 +1,373 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_dev_keyboard + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\buttons.c + buttons.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_dev_keyboard.c + usb_dev_keyboard.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_keyb_structs.c + usb_keyb_structs.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 8 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 9 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 10 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvproj b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvproj new file mode 100644 index 0000000..accad7a --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard.uvproj @@ -0,0 +1,454 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_dev_keyboard + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_dev_keyboard + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_dev_keyboard.bin .\rvmdk\usb_dev_keyboard.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 UART_BUFFERED + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_dev_keyboard.sct + + + --entry Reset_Handler + + + + + + + + Source + + + buttons.c + 1 + ..\drivers\buttons.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_dev_keyboard.c + 1 + .\usb_dev_keyboard.c + + + usb_keyb_structs.c + 1 + .\usb_keyb_structs.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard_ccs.cmd b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard_ccs.cmd new file mode 100644 index 0000000..08585db --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_dev_keyboard_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_dev_keyboard_ccs.cmd - CCS linker configuration file for usb_dev_keyboard. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.c b/boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.c new file mode 100644 index 0000000..36bbf63 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.c @@ -0,0 +1,149 @@ +//***************************************************************************** +// +// usb_keyb_structs.c - Data structures defining the USB keyboard device. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "driverlib/usb.h" +#include "usblib/usblib.h" +#include "usblib/usbhid.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdhid.h" +#include "usblib/device/usbdhidkeyb.h" +#include "usb_keyb_structs.h" + +//**************************************************************************** +// +// The languages supported by this device. +// +//**************************************************************************** +const uint8_t g_pui8LangDescriptor[] = +{ + 4, + USB_DTYPE_STRING, + USBShort(USB_LANG_EN_US) +}; + +//**************************************************************************** +// +// The manufacturer string. +// +//**************************************************************************** +const uint8_t g_pui8ManufacturerString[] = +{ + (17 + 1) * 2, + USB_DTYPE_STRING, + 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0, + 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0, +}; + +//**************************************************************************** +// +// The product string. +// +//**************************************************************************** +const uint8_t g_pui8ProductString[] = +{ + (16 + 1) * 2, + USB_DTYPE_STRING, + 'K', 0, 'e', 0, 'y', 0, 'b', 0, 'o', 0, 'a', 0, 'r', 0, 'd', 0, ' ', 0, + 'E', 0, 'x', 0, 'a', 0, 'm', 0, 'p', 0, 'l', 0, 'e', 0 +}; + +//**************************************************************************** +// +// The serial number string. +// +//**************************************************************************** +const uint8_t g_pui8SeriailNumberString[] = +{ + (8 + 1) * 2, + USB_DTYPE_STRING, + '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0 +}; + +//***************************************************************************** +// +// The interface description string. +// +//***************************************************************************** +const uint8_t g_pui8HIDInterfaceString[] = +{ + (22 + 1) * 2, + USB_DTYPE_STRING, + 'H', 0, 'I', 0, 'D', 0, ' ', 0, 'K', 0, 'e', 0, 'y', 0, 'b', 0, + 'o', 0, 'a', 0, 'r', 0, 'd', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, + 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0 +}; + +//***************************************************************************** +// +// The configuration description string. +// +//***************************************************************************** +const uint8_t g_pui8ConfigString[] = +{ + (26 + 1) * 2, + USB_DTYPE_STRING, + 'H', 0, 'I', 0, 'D', 0, ' ', 0, 'K', 0, 'e', 0, 'y', 0, 'b', 0, + 'o', 0, 'a', 0, 'r', 0, 'd', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, + 'f', 0, 'i', 0, 'g', 0, 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0, + 'o', 0, 'n', 0 +}; + +//***************************************************************************** +// +// The descriptor string table. +// +//***************************************************************************** +const uint8_t * const g_ppui8StringDescriptors[] = +{ + g_pui8LangDescriptor, + g_pui8ManufacturerString, + g_pui8ProductString, + g_pui8SeriailNumberString, + g_pui8HIDInterfaceString, + g_pui8ConfigString +}; + +#define NUM_STRING_DESCRIPTORS (sizeof(g_ppui8StringDescriptors) / \ + sizeof(uint8_t *)) + +//***************************************************************************** +// +// The HID keyboard device initialization and customization structures. +// +//***************************************************************************** +tUSBDHIDKeyboardDevice g_sKeyboardDevice = +{ + USB_VID_TI_1CBE, + USB_PID_KEYBOARD, + 500, + USB_CONF_ATTR_SELF_PWR | USB_CONF_ATTR_RWAKE, + KeyboardHandler, + (void *)&g_sKeyboardDevice, + g_ppui8StringDescriptors, + NUM_STRING_DESCRIPTORS +}; diff --git a/boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.h b/boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.h new file mode 100644 index 0000000..de89c2c --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_keyboard/usb_keyb_structs.h @@ -0,0 +1,35 @@ +//***************************************************************************** +// +// usb_keyb_structs.h - Data structures defining the keyboard USB device. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef _USB_KEYB_STRUCTS_H_ +#define _USB_KEYB_STRUCTS_H_ + +extern uint32_t KeyboardHandler(void *pvCBData, + uint32_t ui32Event, + uint32_t ui32MsgData, + void *pvMsgData); + +extern tUSBDHIDKeyboardDevice g_sKeyboardDevice; + +#endif diff --git a/boards/ek-lm4f232/usb_dev_msc/Makefile b/boards/ek-lm4f232/usb_dev_msc/Makefile new file mode 100644 index 0000000..c807c1e --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/Makefile @@ -0,0 +1,96 @@ +#****************************************************************************** +# +# Makefile - Rules for building the Mass Storage Class example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../third_party/fatfs/port +VPATH+=../../../../third_party/fatfs/src +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. +IPATH+=../../../../third_party + +# +# The default rule, which causes the Mass Storage Class example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_dev_msc.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the Mass Storage Class example. +# +${COMPILER}/usb_dev_msc.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_dev_msc.axf: ${COMPILER}/mmc-ek-lm4f232.o +${COMPILER}/usb_dev_msc.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_dev_msc.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_dev_msc.axf: ${COMPILER}/usb_dev_msc.o +${COMPILER}/usb_dev_msc.axf: ${COMPILER}/usb_msc_structs.o +${COMPILER}/usb_dev_msc.axf: ${COMPILER}/usbdsdcard.o +${COMPILER}/usb_dev_msc.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_dev_msc.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_dev_msc.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_dev_msc.axf: usb_dev_msc.ld +SCATTERgcc_usb_dev_msc=usb_dev_msc.ld +ENTRY_usb_dev_msc=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_dev_msc/ccs/.ccsimportspec new file mode 100644 index 0000000..e530bf9 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/ccs/.ccsimportspec @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/.ccsproject b/boards/ek-lm4f232/usb_dev_msc/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/.cproject b/boards/ek-lm4f232/usb_dev_msc/ccs/.cproject new file mode 100644 index 0000000..2472d4a --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/ccs/.cproject @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/.project b/boards/ek-lm4f232/usb_dev_msc/ccs/.project new file mode 100644 index 0000000..4e19231 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/ccs/.project @@ -0,0 +1,75 @@ + + + usb_dev_msc + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_msc/startup_ccs.c + + + usb_dev_msc.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.c + + + usb_dev_msc_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc_ccs.cmd + + + usb_msc_structs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.c + + + usbdsdcard.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_msc/usbdsdcard.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + third_party/fatfs/port/mmc-ek-lm4f232.c + 1 + SW_ROOT/third_party/fatfs/port/mmc-ek-lm4f232.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_dev_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.bin b/boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.bin new file mode 100644 index 0000000..348f6ff Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.bin differ diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.out b/boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.out new file mode 100644 index 0000000..bb42f02 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/ccs/Debug/usb_dev_msc.out differ diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_dev_msc/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_dev_msc/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_dev_msc/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.bin b/boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.bin new file mode 100644 index 0000000..70add2c Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.bin differ diff --git a/boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.out b/boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.out new file mode 100644 index 0000000..111dd3f Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/ewarm/Exe/usb_dev_msc.out differ diff --git a/boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.axf b/boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.axf new file mode 100644 index 0000000..0e1ab9d Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.axf differ diff --git a/boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.bin b/boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.bin new file mode 100644 index 0000000..ff5e834 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/gcc/usb_dev_msc.bin differ diff --git a/boards/ek-lm4f232/usb_dev_msc/readme.txt b/boards/ek-lm4f232/usb_dev_msc/readme.txt new file mode 100644 index 0000000..38c4c38 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/readme.txt @@ -0,0 +1,27 @@ +USB MSC Device + +This example application turns the evaluation board into a USB mass storage +class device. The application will use the microSD card for the storage +media for the mass storage device. The screen will display the current +action occurring on the device ranging from disconnected, no media, reading, +writing and idle. + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.axf b/boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.axf new file mode 100644 index 0000000..c15d5e8 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.axf differ diff --git a/boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.bin b/boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.bin new file mode 100644 index 0000000..b5ea132 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_msc/rvmdk/usb_dev_msc.bin differ diff --git a/boards/ek-lm4f232/usb_dev_msc/startup_ccs.c b/boards/ek-lm4f232/usb_dev_msc/startup_ccs.c new file mode 100644 index 0000000..02f7ee1 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/startup_ccs.c @@ -0,0 +1,303 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_msc/startup_ewarm.c b/boards/ek-lm4f232/usb_dev_msc/startup_ewarm.c new file mode 100644 index 0000000..4a89955 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/startup_ewarm.c @@ -0,0 +1,334 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_msc/startup_gcc.c b/boards/ek-lm4f232/usb_dev_msc/startup_gcc.c new file mode 100644 index 0000000..d4c8869 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/startup_gcc.c @@ -0,0 +1,350 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_msc/startup_rvmdk.S b/boards/ek-lm4f232/usb_dev_msc/startup_rvmdk.S new file mode 100644 index 0000000..8b59f43 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickHandler + EXTERN USB0DeviceIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0DeviceIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.c b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.c new file mode 100644 index 0000000..764e4ff --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.c @@ -0,0 +1,617 @@ +//***************************************************************************** +// +// usb_dev_msc.c - Main routines for the device mass storage class example. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/sysctl.h" +#include "driverlib/rom.h" +#include "driverlib/systick.h" +#include "driverlib/usb.h" +#include "driverlib/gpio.h" +#include "driverlib/udma.h" +#include "driverlib/pin_map.h" +#include "grlib/grlib.h" +#include "usblib/usblib.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdmsc.h" +#include "drivers/cfal96x64x16.h" +#include "usb_msc_structs.h" +#include "third_party/fatfs/src/diskio.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB MSC Device (usb_dev_msc)

+//! +//! This example application turns the evaluation board into a USB mass storage +//! class device. The application will use the microSD card for the storage +//! media for the mass storage device. The screen will display the current +//! action occurring on the device ranging from disconnected, no media, reading, +//! writing and idle. +// +//***************************************************************************** + +//***************************************************************************** +// +// These defines are used to define the screen constraints to the application. +// +//***************************************************************************** +#define DISPLAY_BANNER_HEIGHT 11 +#define DISPLAY_BANNER_BG ClrDarkBlue +#define DISPLAY_BANNER_FG ClrWhite + +//***************************************************************************** +// +// The number of ticks to wait before falling back to the idle state. Since +// the tick rate is 100Hz this is approximately 3 seconds. +// +//***************************************************************************** +#define USBMSC_ACTIVITY_TIMEOUT 300 + +//***************************************************************************** +// +// This enumeration holds the various states that the device can be in during +// normal operation. +// +//***************************************************************************** +volatile enum +{ + // + // Unconfigured. + // + MSC_DEV_DISCONNECTED, + + // + // Connected but not yet fully enumerated. + // + MSC_DEV_CONNECTED, + + // + // Connected and fully enumerated but not currently handling a command. + // + MSC_DEV_IDLE, + + // + // Currently reading the SD card. + // + MSC_DEV_READ, + + // + // Currently writing the SD card. + // + MSC_DEV_WRITE, +} +g_eMSCState; + +//***************************************************************************** +// +// The Flags that handle updates to the status area to avoid drawing when no +// updates are required.. +// +//***************************************************************************** +#define FLAG_UPDATE_STATUS 1 +static uint32_t g_ui32Flags; +static uint32_t g_ui32IdleTimeout; + +//***************************************************************************** +// +// Graphics context used to show text on the display. +// +//***************************************************************************** +tContext g_sContext; + +//****************************************************************************** +// +// The DMA control structure table. +// +//****************************************************************************** +#ifdef ewarm +#pragma data_alignment=1024 +tDMAControlTable sDMAControlTable[64]; +#elif defined(ccs) +#pragma DATA_ALIGN(sDMAControlTable, 1024) +tDMAControlTable sDMAControlTable[64]; +#else +tDMAControlTable sDMAControlTable[64] __attribute__ ((aligned(1024))); +#endif + +//***************************************************************************** +// +// Handles bulk driver notifications related to the receive channel (data from +// the USB host). +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the bulk driver to notify us of any events +// related to operation of the receive data channel (the OUT channel carrying +// data from the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +RxHandler(void *pvCBData, uint_fast32_t ui32Event, + uint_fast32_t ui32MsgValue, void *pvMsgData) +{ + return(0); +} + +//***************************************************************************** +// +// Handles bulk driver notifications related to the transmit channel (data to +// the USB host). +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the bulk driver to notify us of any events +// related to operation of the transmit data channel (the IN channel carrying +// data to the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +TxHandler(void *pvCBData, uint_fast32_t ui32Event, uint_fast32_t ui32MsgValue, + void *pvMsgData) +{ + return(0); +} + +//***************************************************************************** +// +// This function updates the status area of the screen. It uses the current +// state of the application to print the status bar. +// +//***************************************************************************** +void +UpdateStatus(char *pcString, bool bClrBackground) +{ + tRectangle sRect; + + // + // + // + GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG); + + if(bClrBackground) + { + // + // Fill the bottom rows of the screen with blue to create the status area. + // + sRect.i16XMin = 0; + sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - + DISPLAY_BANNER_HEIGHT; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT - 1; + + // + // Draw the background of the banner. + // + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); + GrRectFill(&g_sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG); + GrRectDraw(&g_sContext, &sRect); + } + else + { + // + // Fill the bottom rows of the screen with blue to create the status area. + // + sRect.i16XMin = 1; + sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - + DISPLAY_BANNER_HEIGHT + 1; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 2; + sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT - 3; + + // + // Draw the background of the banner. + // + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); + GrRectFill(&g_sContext, &sRect); + + // + // White text in the banner. + // + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG); + } + + // + // Write the current state to the left of the status area. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + + // + // Update the status on the screen. + // + if(pcString != 0) + { + GrStringDrawCentered(&g_sContext, pcString, + -1, GrContextDpyWidthGet(&g_sContext) / 2, + 58, 1); + } +} + +//***************************************************************************** +// +// This function is the call back notification function provided to the USB +// library's mass storage class. +// +//***************************************************************************** +uint32_t +USBDMSCEventCallback(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgParam, + void *pvMsgData) +{ + // + // Reset the time out every time an event occurs. + // + g_ui32IdleTimeout = USBMSC_ACTIVITY_TIMEOUT; + + switch(ui32Event) + { + // + // Writing to the device. + // + case USBD_MSC_EVENT_WRITING: + { + // + // Only update if this is a change. + // + if(g_eMSCState != MSC_DEV_WRITE) + { + // + // Go to the write state. + // + g_eMSCState = MSC_DEV_WRITE; + + // + // Cause the main loop to update the screen. + // + g_ui32Flags |= FLAG_UPDATE_STATUS; + } + + break; + } + + // + // Reading from the device. + // + case USBD_MSC_EVENT_READING: + { + // + // Only update if this is a change. + // + if(g_eMSCState != MSC_DEV_READ) + { + // + // Go to the read state. + // + g_eMSCState = MSC_DEV_READ; + + // + // Cause the main loop to update the screen. + // + g_ui32Flags |= FLAG_UPDATE_STATUS; + } + + break; + } + // + // The USB host has disconnected from the device. + // + case USB_EVENT_DISCONNECTED: + { + // + // Go to the disconnected state. + // + g_eMSCState = MSC_DEV_DISCONNECTED; + + // + // Cause the main loop to update the screen. + // + g_ui32Flags |= FLAG_UPDATE_STATUS; + + break; + } + // + // The USB host has connected to the device. + // + case USB_EVENT_CONNECTED: + { + // + // Go to the idle state to wait for read/writes. + // + g_eMSCState = MSC_DEV_IDLE; + + break; + } + case USBD_MSC_EVENT_IDLE: + default: + { + break; + } + } + + return(0); +} + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. FatFs requires a timer tick +// every 10 ms for internal timing purposes. +// +//***************************************************************************** +void +SysTickHandler(void) +{ + // + // Call the FatFs tick timer. + // + disk_timerproc(); + + if(g_ui32IdleTimeout != 0) + { + g_ui32IdleTimeout--; + } +} + +//***************************************************************************** +// +// This is the main loop that runs the application. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + uint_fast32_t ui32Retcode; + + // + // Set the system clock to run at 50MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Configure SysTick for a 100Hz interrupt. The FatFs driver wants a 10 ms + // tick. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Configure and enable uDMA + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); + SysCtlDelay(10); + ROM_uDMAControlBaseSet(&sDMAControlTable[0]); + ROM_uDMAEnable(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top 15 rows of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = DISPLAY_BANNER_HEIGHT - 1; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + GrRectDraw(&g_sContext, &sRect); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "usb-dev-msc", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 5, 0); + + // + // Initialize the idle timeout and reset all flags. + // + g_ui32IdleTimeout = 0; + g_ui32Flags = 0; + + // + // Initialize the state to idle. + // + g_eMSCState = MSC_DEV_DISCONNECTED; + + // + // Draw the status bar and set it to idle. + // + UpdateStatus("Disconnected", 1); + + // + // Enable the USB controller. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); + + // + // Set the USB pins to be controlled by the USB controller. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Set the USB stack mode to Device mode with VBUS monitoring. + // + USBStackModeSet(0, eUSBModeDevice, 0); + + // + // Pass our device information to the USB library and place the device + // on the bus. + // + USBDMSCInit(0, &g_sMSCDevice); + + // + // Determine whether or not an SDCard is installed. If not, print a + // warning and have the user install one and restart. + // + ui32Retcode = disk_initialize(0); + + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + if(ui32Retcode != RES_OK) + { + GrStringDrawCentered(&g_sContext, "No SDCard Found", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 16, 0); + GrStringDrawCentered(&g_sContext, "Please insert", + -1, GrContextDpyWidthGet(&g_sContext) / 2, 26, 0); + GrStringDrawCentered(&g_sContext, "a card and", + -1, GrContextDpyWidthGet(&g_sContext) / 2, 36, 0); + GrStringDrawCentered(&g_sContext, "reset the board.", + -1, GrContextDpyWidthGet(&g_sContext) / 2, 46, 0); + } + else + { + GrStringDrawCentered(&g_sContext, "SDCard Found", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 30, 0); + } + + // + // Drop into the main loop. + // + while(1) + { + switch(g_eMSCState) + { + case MSC_DEV_READ: + { + // + // Update the screen if necessary. + // + if(g_ui32Flags & FLAG_UPDATE_STATUS) + { + UpdateStatus("Reading", 0); + g_ui32Flags &= ~FLAG_UPDATE_STATUS; + } + + // + // If there is no activity then return to the idle state. + // + if(g_ui32IdleTimeout == 0) + { + UpdateStatus("Idle", 0); + g_eMSCState = MSC_DEV_IDLE; + } + + break; + } + case MSC_DEV_WRITE: + { + // + // Update the screen if necessary. + // + if(g_ui32Flags & FLAG_UPDATE_STATUS) + { + UpdateStatus("Writing", 0); + g_ui32Flags &= ~FLAG_UPDATE_STATUS; + } + + // + // If there is no activity then return to the idle state. + // + if(g_ui32IdleTimeout == 0) + { + UpdateStatus("Idle", 0); + g_eMSCState = MSC_DEV_IDLE; + } + break; + } + case MSC_DEV_DISCONNECTED: + { + // + // Update the screen if necessary. + // + if(g_ui32Flags & FLAG_UPDATE_STATUS) + { + UpdateStatus("Disconnected", 0); + g_ui32Flags &= ~FLAG_UPDATE_STATUS; + } + break; + } + case MSC_DEV_IDLE: + { + break; + } + default: + { + break; + } + } + } +} + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ + while(1) + { + // + // Hang on runtime error. + // + } +} +#endif + diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewd b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewp b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewp new file mode 100644 index 0000000..5b307a6 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ewp @@ -0,0 +1,809 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_dev_msc.c + + + $PROJ_DIR$\usb_msc_structs.c + + + $PROJ_DIR$\usbdsdcard.c + + + diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.icf b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.icf new file mode 100644 index 0000000..7d63f60 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_dev_msc.icf - Linker configuration file for usb_dev_msc. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ld b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ld new file mode 100644 index 0000000..eb6119b --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_dev_msc.ld - Linker configuration file for usb_dev_msc. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.sct b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.sct new file mode 100644 index 0000000..668a52c --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_dev_msc.sct - Linker configuration file for usb_dev_msc. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvopt b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvopt new file mode 100644 index 0000000..dd3871d --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvopt @@ -0,0 +1,387 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_dev_msc + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + mmc-ek-lm4f232.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_dev_msc.c + usb_dev_msc.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_msc_structs.c + usb_msc_structs.c + + + 1 + 7 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usbdsdcard.c + usbdsdcard.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 8 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 9 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 10 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 11 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvproj b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvproj new file mode 100644 index 0000000..7fe5428 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc.uvproj @@ -0,0 +1,459 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_dev_msc + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_dev_msc + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_dev_msc.bin .\rvmdk\usb_dev_msc.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..;..\..\..\..\third_party; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_dev_msc.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + mmc-ek-lm4f232.c + 1 + ..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_dev_msc.c + 1 + .\usb_dev_msc.c + + + usb_msc_structs.c + 1 + .\usb_msc_structs.c + + + usbdsdcard.c + 1 + .\usbdsdcard.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc_ccs.cmd b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc_ccs.cmd new file mode 100644 index 0000000..ca737d4 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_dev_msc_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_dev_msc_ccs.cmd - CCS linker configuration file for usb_dev_msc. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.c b/boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.c new file mode 100644 index 0000000..7978c07 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.c @@ -0,0 +1,191 @@ +//***************************************************************************** +// +// usb_bulk_structs.c - Data structures defining the mass storage USB device. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "driverlib/usb.h" +#include "usblib/usblib.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdmsc.h" +#include "usb_msc_structs.h" +#include "usbdsdcard.h" + +//***************************************************************************** +// +// The languages supported by this device. +// +//***************************************************************************** +const uint8_t g_pui8LangDescriptor[] = +{ + 4, + USB_DTYPE_STRING, + USBShort(USB_LANG_EN_US) +}; + +//***************************************************************************** +// +// The manufacturer string. +// +//***************************************************************************** +const uint8_t g_pui8ManufacturerString[] = +{ + (17 + 1) * 2, + USB_DTYPE_STRING, + 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0, + 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0, +}; + +//***************************************************************************** +// +// The product string. +// +//***************************************************************************** +const uint8_t g_pui8ProductString[] = +{ + (19 + 1) * 2, + USB_DTYPE_STRING, + 'M', 0, 'a', 0, 's', 0, 's', 0, ' ', 0, 'S', 0, 't', 0, 'o', 0, 'r', 0, + 'a', 0, 'g', 0, 'e', 0, ' ', 0, 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, + 'e', 0 +}; + +//***************************************************************************** +// +// The serial number string. +// +//***************************************************************************** +const uint8_t g_pui8SerialNumberString[] = +{ + (8 + 1) * 2, + USB_DTYPE_STRING, + '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0 +}; + +//***************************************************************************** +// +// The data interface description string. +// +//***************************************************************************** +const uint8_t g_pui8DataInterfaceString[] = +{ + (19 + 1) * 2, + USB_DTYPE_STRING, + 'B', 0, 'u', 0, 'l', 0, 'k', 0, ' ', 0, 'D', 0, 'a', 0, 't', 0, + 'a', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, + 'a', 0, 'c', 0, 'e', 0 +}; + +//***************************************************************************** +// +// The configuration description string. +// +//***************************************************************************** +const uint8_t g_pui8ConfigString[] = +{ + (23 + 1) * 2, + USB_DTYPE_STRING, + 'B', 0, 'u', 0, 'l', 0, 'k', 0, ' ', 0, 'D', 0, 'a', 0, 't', 0, + 'a', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, 'f', 0, 'i', 0, 'g', 0, + 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0, 'o', 0, 'n', 0 +}; + +//***************************************************************************** +// +// The descriptor string table. +// +//***************************************************************************** +const uint8_t * const g_ppui8StringDescriptors[] = +{ + g_pui8LangDescriptor, + g_pui8ManufacturerString, + g_pui8ProductString, + g_pui8SerialNumberString, + g_pui8DataInterfaceString, + g_pui8ConfigString +}; + +#define NUM_STRING_DESCRIPTORS (sizeof(g_ppui8StringDescriptors) / \ + sizeof(uint8_t *)) + +//***************************************************************************** +// +// The bulk device initialization and customization structures. In this case, +// we are using USBBuffers between the bulk device class driver and the +// application code. The function pointers and callback data values are set +// to insert a buffer in each of the data channels, transmit and receive. +// +// With the buffer in place, the bulk channel callback is set to the relevant +// channel function and the callback data is set to point to the channel +// instance data. The buffer, in turn, has its callback set to the application +// function and the callback data set to our bulk instance structure. +// +//***************************************************************************** +tUSBDMSCDevice g_sMSCDevice = +{ + // + // Vendor ID. + // + USB_VID_TI_1CBE, + + // + // Product ID. + // + USB_PID_MSC, + + // + // Vendor Information. + // + "TI ", + + // + // Product Identification. + // + "Mass Storage ", + + // + // Revision. + // + "1.00", + 500, + USB_CONF_ATTR_SELF_PWR, + g_ppui8StringDescriptors, + NUM_STRING_DESCRIPTORS, + { + USBDMSCStorageOpen, + USBDMSCStorageClose, + USBDMSCStorageRead, + USBDMSCStorageWrite, + USBDMSCStorageNumBlocks, + 0 + }, + USBDMSCEventCallback +}; + +//***************************************************************************** +// +// The size of the transmit and receive buffers used. +// +//***************************************************************************** +#define MSC_BUFFER_SIZE 512 diff --git a/boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.h b/boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.h new file mode 100644 index 0000000..55073c6 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usb_msc_structs.h @@ -0,0 +1,43 @@ +//***************************************************************************** +// +// usb_msc_structs.h - Data structures defining the mass storage USB device. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __USB_MSC_STRUCTS_H__ +#define __USB_MSC_STRUCTS_H__ + +//***************************************************************************** +// +// The mass storage class device structure. +// +//***************************************************************************** +extern tUSBDMSCDevice g_sMSCDevice; + +//***************************************************************************** +// +// The externally provided mass storage class event call back function. +// +//***************************************************************************** +extern uint32_t USBDMSCEventCallback(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgParam, void *pvMsgData); + +#endif diff --git a/boards/ek-lm4f232/usb_dev_msc/usbdsdcard.c b/boards/ek-lm4f232/usb_dev_msc/usbdsdcard.c new file mode 100644 index 0000000..1c716bc --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usbdsdcard.c @@ -0,0 +1,257 @@ +//***************************************************************************** +// +// usbdsdcard.c - Routines supplied for use by the mass storage class device +// class. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/sysctl.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/rom.h" +#include "driverlib/systick.h" +#include "grlib/grlib.h" +#include "usblib/usblib.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdmsc.h" +#include "usb_msc_structs.h" +#include "third_party/fatfs/src/diskio.h" +#include "drivers/cfal96x64x16.h" + +#define SDCARD_PRESENT 0x00000001 +#define SDCARD_IN_USE 0x00000002 +struct +{ + uint32_t ui32Flags; +} +g_sDriveInformation; + +//***************************************************************************** +// +// This function opens the drive number and prepares it for use by the Mass +// storage class device. +// +// /param ui32Drive is the driver number to open. +// +// This function is used to initialize and open the physical drive number +// associated with the parameter /e ui32Drive. The function will return zero if +// the drive could not be opened for some reason. In the case of removable +// device like an SD card this function should return zero if the SD card is +// not present. +// +// /return Returns a pointer to data that should be passed to other APIs or it +// will return 0 if no drive was found. +// +//***************************************************************************** +void * +USBDMSCStorageOpen(uint_fast32_t ui32Drive) +{ + uint_fast32_t ui32Temp; + + ASSERT(ui32Drive == 0); + + // + // Return if already in use. + // + if(g_sDriveInformation.ui32Flags & SDCARD_IN_USE) + { + return(0); + } + + // + // Initialize the drive if it is present. + // + ui32Temp = disk_initialize(0); + + if(ui32Temp == RES_OK) + { + // + // Card is present and in use. + // + g_sDriveInformation.ui32Flags = SDCARD_PRESENT | SDCARD_IN_USE; + } + else if(ui32Temp == STA_NODISK) + { + // + // Allocate the card but it is not present. + // + g_sDriveInformation.ui32Flags = SDCARD_IN_USE; + } + else + { + return(0); + } + + return((void *)&g_sDriveInformation); +} + +//***************************************************************************** +// +// This function close the drive number in use by the mass storage class device. +// +// /param pvDrive is the pointer that was returned from a call to +// USBDMSCStorageOpen(). +// +// This function is used to close the physical drive number associated with the +// parameter /e pvDrive. This function will return 0 if the drive was closed +// successfully and any other value will indicate a failure. +// +// /return Returns 0 if the drive was successfully closed or non-zero for a +// failure. +// +//***************************************************************************** +void +USBDMSCStorageClose(void * pvDrive) +{ + uint_fast8_t ui8Power; + + ASSERT(pvDrive != 0); + + // + // Clear all flags. + // + g_sDriveInformation.ui32Flags = 0; + + // + // Power up the card. + // + ui8Power = 0; + + // + // Turn off the power to the card. + // + disk_ioctl(0, CTRL_POWER, &ui8Power); +} + +//***************************************************************************** +// +// This function will read a block from a device opened by the +// USBDMSCStorageOpen() call. +// +// /param pvDrive is the pointer that was returned from a call to +// USBDMSCStorageOpen(). +// /param pui8Data is the buffer that data will be written into. +// /param ui32NumBlocks is the number of blocks to read. +// +// This function is use to read blocks from a physical device and return them +// in the /e pui8Data buffer. The data area pointed to by /e pui8Data should be +// at least /e ui32NumBlocks * Block Size bytes to prevent overwriting data. +// +// /return Returns the number of bytes that were read from the device. +// +//***************************************************************************** +uint32_t USBDMSCStorageRead(void * pvDrive, + uint8_t *pui8Data, + uint_fast32_t ui32Sector, + uint_fast32_t ui32NumBlocks) +{ + ASSERT(pvDrive != 0); + + if(disk_read (0, pui8Data, ui32Sector, ui32NumBlocks) == RES_OK) + { + // TODO remove fixed 512 + return(ui32NumBlocks * 512); + } + return(0); +} + +//***************************************************************************** +// +// This function will write a block to a device opened by the +// USBDMSCStorageOpen() call. +// +// /param pvDrive is the pointer that was returned from a call to +// USBDMSCStorageOpen(). +// /param pui8Data is the buffer that data will be used for writing. +// /param ui32NumBlocks is the number of blocks to write. +// +// This function is use to write blocks to a physical device from the buffer +// pointed to by the /e pui8Data buffer. If the number of blocks is greater than +// one then the block address will increment and write to the next block until +// /e ui32NumBlocks * Block Size bytes have been written. +// +// /return Returns the number of bytes that were written to the device. +// +//***************************************************************************** +uint32_t USBDMSCStorageWrite(void * pvDrive, + uint8_t *pui8Data, + uint_fast32_t ui32Sector, + uint_fast32_t ui32NumBlocks) +{ + ASSERT(pvDrive != 0); + + if(disk_write(0, pui8Data, ui32Sector, ui32NumBlocks) == RES_OK) + { + return(ui32NumBlocks * 512); + } + return(0); +} + +//***************************************************************************** +// +// This function will return the number of blocks present on a device. +// +// /param pvDrive is the pointer that was returned from a call to +// USBDMSCStorageOpen(). +// +// This function is used to return the total number of blocks on a physical +// device based on the /e pvDrive parameter. +// +// /return Returns the number of blocks that are present in a device. +// +//***************************************************************************** +uint32_t +USBDMSCStorageNumBlocks(void * pvDrive) +{ + uint_fast32_t ui32SectorCount; + + // + // Read the number of sectors. + // + disk_ioctl(0, GET_SECTOR_COUNT, &ui32SectorCount); + + return(ui32SectorCount); +} + +//***************************************************************************** +// +// This function will return the current status of a device. +// +// /param pvDrive is the pointer that was returned from a call to +// USBDMSCStorageOpen(). +// +// This function is used to return the current status of the device indicated by +// the /e pvDrive parameter. This can be used to see if the device is busy, +// or if it is present. +// +// /return Returns the size in bytes of blocks that in a device. +// +//***************************************************************************** +#define USBDMSC_IDLE 0x00000000 +#define USBDMSC_NOT_PRESENT 0x00000001 +uint32_t USBDMSCStorageStatus(void * pvDrive); diff --git a/boards/ek-lm4f232/usb_dev_msc/usbdsdcard.h b/boards/ek-lm4f232/usb_dev_msc/usbdsdcard.h new file mode 100644 index 0000000..17a4a62 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_msc/usbdsdcard.h @@ -0,0 +1,43 @@ +//***************************************************************************** +// +// usbdsdcard.h - Prototypes for functions supplied for use by the mass storage +// class device. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __USBDSDCARD_H__ +#define __USBDSDCARD_H__ + +//***************************************************************************** +// +// +//***************************************************************************** +extern void * USBDMSCStorageOpen(uint32_t ui32Drive); +extern void USBDMSCStorageClose(void * pvDrive); +extern uint32_t USBDMSCStorageRead(void * pvDrive, uint8_t *pui8Data, + uint32_t ui32Sector, + uint32_t ui32NumBlocks); +extern uint32_t USBDMSCStorageWrite(void * pvDrive, uint8_t *pui8Data, + uint32_t ui32Sector, + uint32_t ui32NumBlocks); +uint32_t USBDMSCStorageNumBlocks(void * pvDrive); + +#endif diff --git a/boards/ek-lm4f232/usb_dev_serial/Makefile b/boards/ek-lm4f232/usb_dev_serial/Makefile new file mode 100644 index 0000000..a66b530 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/Makefile @@ -0,0 +1,92 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB device serial example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the USB device serial example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_dev_serial.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB device serial example. +# +${COMPILER}/usb_dev_serial.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_dev_serial.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_dev_serial.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_dev_serial.axf: ${COMPILER}/usb_dev_serial.o +${COMPILER}/usb_dev_serial.axf: ${COMPILER}/usb_serial_structs.o +${COMPILER}/usb_dev_serial.axf: ${COMPILER}/ustdlib.o +${COMPILER}/usb_dev_serial.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_dev_serial.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_dev_serial.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_dev_serial.axf: usb_dev_serial.ld +SCATTERgcc_usb_dev_serial=usb_dev_serial.ld +ENTRY_usb_dev_serial=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 -DUART_BUFFERED + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_dev_serial/ccs/.ccsimportspec new file mode 100644 index 0000000..c5ecbbf --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/ccs/.ccsimportspec @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/.ccsproject b/boards/ek-lm4f232/usb_dev_serial/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/.cproject b/boards/ek-lm4f232/usb_dev_serial/ccs/.cproject new file mode 100644 index 0000000..da9340c --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/ccs/.cproject @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/.project b/boards/ek-lm4f232/usb_dev_serial/ccs/.project new file mode 100644 index 0000000..ddf1b3a --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/ccs/.project @@ -0,0 +1,70 @@ + + + usb_dev_serial + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_serial/startup_ccs.c + + + usb_dev_serial.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.c + + + usb_dev_serial_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial_ccs.cmd + + + usb_serial_structs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_dev_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.bin b/boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.bin new file mode 100644 index 0000000..7b46059 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.bin differ diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.out b/boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.out new file mode 100644 index 0000000..c405af2 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/ccs/Debug/usb_dev_serial.out differ diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_dev_serial/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_dev_serial/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_dev_serial/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.bin b/boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.bin new file mode 100644 index 0000000..66f4d1a Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.bin differ diff --git a/boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.out b/boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.out new file mode 100644 index 0000000..3bb46b0 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/ewarm/Exe/usb_dev_serial.out differ diff --git a/boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.axf b/boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.axf new file mode 100644 index 0000000..0389315 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.axf differ diff --git a/boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.bin b/boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.bin new file mode 100644 index 0000000..ff555b4 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/gcc/usb_dev_serial.bin differ diff --git a/boards/ek-lm4f232/usb_dev_serial/readme.txt b/boards/ek-lm4f232/usb_dev_serial/readme.txt new file mode 100644 index 0000000..b9c1ca2 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/readme.txt @@ -0,0 +1,32 @@ +USB Serial Device + +This example application turns the evaluation kit into a virtual serial +port when connected to the USB host system. The application supports the +USB Communication Device Class, Abstract Control Model to redirect UART0 +traffic to and from the USB host system. + +Assuming you installed TivaWare in the default directory, a +driver information (INF) file for use with Windows XP, Windows Vista and +Windows7 can be found in C:/ti/TivaWare_C_Series-x.x/windows_drivers. +For Windows 2000, the required INF file is in +C:/ti/TivaWare_C_Series-x.x/windows_drivers/win2K. + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.axf b/boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.axf new file mode 100644 index 0000000..c0b7915 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.axf differ diff --git a/boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.bin b/boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.bin new file mode 100644 index 0000000..66c86f8 Binary files /dev/null and b/boards/ek-lm4f232/usb_dev_serial/rvmdk/usb_dev_serial.bin differ diff --git a/boards/ek-lm4f232/usb_dev_serial/startup_ccs.c b/boards/ek-lm4f232/usb_dev_serial/startup_ccs.c new file mode 100644 index 0000000..27d76ef --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/startup_ccs.c @@ -0,0 +1,304 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USBUARTIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + USBUARTIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_serial/startup_ewarm.c b/boards/ek-lm4f232/usb_dev_serial/startup_ewarm.c new file mode 100644 index 0000000..c0c44e6 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/startup_ewarm.c @@ -0,0 +1,335 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USBUARTIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + USBUARTIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_serial/startup_gcc.c b/boards/ek-lm4f232/usb_dev_serial/startup_gcc.c new file mode 100644 index 0000000..1042858 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/startup_gcc.c @@ -0,0 +1,351 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USBUARTIntHandler(void); +extern void USB0DeviceIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + USBUARTIntHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0DeviceIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_dev_serial/startup_rvmdk.S b/boards/ek-lm4f232/usb_dev_serial/startup_rvmdk.S new file mode 100644 index 0000000..c1d213d --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/startup_rvmdk.S @@ -0,0 +1,360 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickIntHandler + EXTERN USBUARTIntHandler + EXTERN USB0DeviceIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickIntHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD USBUARTIntHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0DeviceIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.c b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.c new file mode 100644 index 0000000..e770cbb --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.c @@ -0,0 +1,1441 @@ +//***************************************************************************** +// +// usb_dev_serial.c - Main routines for the USB CDC serial example. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_gpio.h" +#include "inc/hw_uart.h" +#include "inc/hw_sysctl.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/timer.h" +#include "driverlib/uart.h" +#include "driverlib/usb.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "usblib/usblib.h" +#include "usblib/usbcdc.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdcdc.h" +#include "utils/ustdlib.h" +#include "drivers/cfal96x64x16.h" +#include "usb_serial_structs.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB Serial Device (usb_dev_serial)

+//! +//! This example application turns the evaluation kit into a virtual serial +//! port when connected to the USB host system. The application supports the +//! USB Communication Device Class, Abstract Control Model to redirect UART0 +//! traffic to and from the USB host system. +//! +//! Assuming you installed TivaWare in the default directory, a +//! driver information (INF) file for use with Windows XP, Windows Vista and +//! Windows7 can be found in C:/ti/TivaWare_C_Series-x.x/windows_drivers. +//! For Windows 2000, the required INF file is in +//! C:/ti/TivaWare_C_Series-x.x/windows_drivers/win2K. +// +//***************************************************************************** + +//***************************************************************************** +// +// Note: +// +// This example is intended to run on Tiva C Series evaluation kit hardware +// where the UARTs are wired solely for TX and RX, and do not have GPIOs +// connected to act as handshake signals. As a result, this example mimics +// the case where communication is always possible. It reports DSR, DCD +// and CTS as high to ensure that the USB host recognizes that data can be +// sent and merely ignores the host's requested DTR and RTS states. "TODO" +// comments in the code indicate where code would be required to add support +// for real handshakes. +// +//***************************************************************************** + +//***************************************************************************** +// +// Configuration and tuning parameters. +// +//***************************************************************************** + +//***************************************************************************** +// +// The system tick rate expressed both as ticks per second and a millisecond +// period. +// +//***************************************************************************** +#define SYSTICKS_PER_SECOND 100 +#define SYSTICK_PERIOD_MS (1000 / SYSTICKS_PER_SECOND) + +//***************************************************************************** +// +// Variables tracking transmit and receive counts. +// +//***************************************************************************** +volatile uint32_t g_ui32UARTTxCount = 0; +volatile uint32_t g_ui32UARTRxCount = 0; +#ifdef DEBUG +uint32_t g_ui32UARTRxErrors = 0; +#endif + +//***************************************************************************** +// +// The base address, peripheral ID and interrupt ID of the UART that is to +// be redirected. +// +//***************************************************************************** + +//***************************************************************************** +// +// Defines required to redirect UART0 via USB. +// +//***************************************************************************** +#define USB_UART_BASE UART0_BASE +#define USB_UART_PERIPH SYSCTL_PERIPH_UART0 +#define USB_UART_INT INT_UART0 + +//***************************************************************************** +// +// Default line coding settings for the redirected UART. +// +//***************************************************************************** +#define DEFAULT_BIT_RATE 115200 +#define DEFAULT_UART_CONFIG (UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | \ + UART_CONFIG_STOP_ONE) + +//***************************************************************************** +// +// GPIO peripherals and pins muxed with the redirected UART. These will depend +// upon the IC in use and the UART selected in USB_UART_BASE. Be careful that +// these settings all agree with the hardware you are using. +// +//***************************************************************************** + +//***************************************************************************** +// +// Defines required to redirect UART0 via USB. +// +//***************************************************************************** +#define TX_GPIO_BASE GPIO_PORTA_BASE +#define TX_GPIO_PERIPH SYSCTL_PERIPH_GPIOA +#define TX_GPIO_PIN GPIO_PIN_1 + +#define RX_GPIO_BASE GPIO_PORTA_BASE +#define RX_GPIO_PERIPH SYSCTL_PERIPH_GPIOA +#define RX_GPIO_PIN GPIO_PIN_0 + +//***************************************************************************** +// +// Flag indicating whether or not we are currently sending a Break condition. +// +//***************************************************************************** +static bool g_bSendingBreak = false; + +//***************************************************************************** +// +// Global system tick counter +// +//***************************************************************************** +volatile uint32_t g_ui32SysTickCount = 0; + +//***************************************************************************** +// +// Graphics context used to show text on the color STN display. +// +//***************************************************************************** +tContext g_sContext; +#define TEXT_FONT g_psFontFixed6x8 +#define TEXT_HEIGHT (GrFontHeightGet(TEXT_FONT)) +#define BUFFER_METER_HEIGHT TEXT_HEIGHT +#define BUFFER_METER_WIDTH 56 + +//***************************************************************************** +// +// Flags used to pass commands from interrupt context to the main loop. +// +//***************************************************************************** +#define COMMAND_PACKET_RECEIVED 0x00000001 +#define COMMAND_STATUS_UPDATE 0x00000002 + +volatile uint32_t g_ui32Flags = 0; +char *g_pcStatus; + +//***************************************************************************** +// +// Global flag indicating that a USB configuration has been set. +// +//***************************************************************************** +static volatile bool g_bUSBConfigured = false; + +//***************************************************************************** +// +// Internal function prototypes. +// +//***************************************************************************** +static void USBUARTPrimeTransmit(uint32_t ui32Base); +static void CheckForSerialStateChange(const tUSBDCDCDevice *psDevice, + int32_t i32Errors); +static void SetControlLineState(uint16_t ui16State); +static bool SetLineCoding(tLineCoding *psLineCoding); +static void GetLineCoding(tLineCoding *psLineCoding); +static void SendBreak(bool bSend); + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ + while(1) + { + } +} +#endif + +//***************************************************************************** +// +// This function is called whenever serial data is received from the UART. +// It is passed the accumulated error flags from each character received in +// this interrupt and determines from them whether or not an interrupt +// notification to the host is required. +// +// If a notification is required and the control interrupt endpoint is idle, +// we send the notification immediately. If the endpoint is not idle, we +// accumulate the errors in a global variable which will be checked on +// completion of the previous notification and used to send a second one +// if necessary. +// +//***************************************************************************** +static void +CheckForSerialStateChange(const tUSBDCDCDevice *psDevice, int32_t i32Errors) +{ + uint16_t ui16SerialState; + + // + // Clear our USB serial state. Since we are faking the handshakes, always + // set the TXCARRIER (DSR) and RXCARRIER (DCD) bits. + // + ui16SerialState = USB_CDC_SERIAL_STATE_TXCARRIER | + USB_CDC_SERIAL_STATE_RXCARRIER; + + // + // Are any error bits set? + // + if(i32Errors) + { + // + // At least one error is being notified so translate from our hardware + // error bits into the correct state markers for the USB notification. + // + if(i32Errors & UART_DR_OE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_OVERRUN; + } + + if(i32Errors & UART_DR_PE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_PARITY; + } + + if(i32Errors & UART_DR_FE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_FRAMING; + } + + if(i32Errors & UART_DR_BE) + { + ui16SerialState |= USB_CDC_SERIAL_STATE_BREAK; + } + + // Call the CDC driver to notify the state change. + USBDCDCSerialStateChange((void *)psDevice, ui16SerialState); + } +} + +//***************************************************************************** +// +// Read as many characters from the UART FIFO as we can and move them into +// the CDC transmit buffer. +// +// \return Returns UART error flags read during data reception. +// +//***************************************************************************** +static int32_t +ReadUARTData(void) +{ + int32_t i32Char, i32Errors; + uint8_t ui8Char; + uint32_t ui32Space; + + // + // Clear our error indicator. + // + i32Errors = 0; + + // + // How much space do we have in the buffer? + // + ui32Space = USBBufferSpaceAvailable((tUSBBuffer *)&g_sTxBuffer); + + // + // Read data from the UART FIFO until there is none left or we run + // out of space in our receive buffer. + // + while(ui32Space && ROM_UARTCharsAvail(USB_UART_BASE)) + { + // + // Read a character from the UART FIFO into the ring buffer if no + // errors are reported. + // + i32Char = ROM_UARTCharGetNonBlocking(USB_UART_BASE); + + // + // If the character did not contain any error notifications, + // copy it to the output buffer. + // + if(!(i32Char & ~0xFF)) + { + ui8Char = (uint8_t)(i32Char & 0xFF); + USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, + (uint8_t *)&ui8Char, 1); + + // + // Decrement the number of bytes we know the buffer can accept. + // + ui32Space--; + } + else + { +#ifdef DEBUG + // + // Increment our receive error counter. + // + g_ui32UARTRxErrors++; +#endif + // + // Update our error accumulator. + // + i32Errors |= i32Char; + } + + // + // Update our count of bytes received via the UART. + // + g_ui32UARTRxCount++; + } + + // + // Pass back the accumulated error indicators. + // + return(i32Errors); +} + +//***************************************************************************** +// +// Take as many bytes from the transmit buffer as we have space for and move +// them into the USB UART's transmit FIFO. +// +//***************************************************************************** +static void +USBUARTPrimeTransmit(uint32_t ui32Base) +{ + uint32_t ui32Read; + uint8_t ui8Char; + + // + // If we are currently sending a break condition, don't receive any + // more data. We will resume transmission once the break is turned off. + // + if(g_bSendingBreak) + { + return; + } + + // + // If there is space in the UART FIFO, try to read some characters + // from the receive buffer to fill it again. + // + while(ROM_UARTSpaceAvail(ui32Base)) + { + // + // Get a character from the buffer. + // + ui32Read = USBBufferRead((tUSBBuffer *)&g_sRxBuffer, &ui8Char, 1); + + // + // Did we get a character? + // + if(ui32Read) + { + // + // Place the character in the UART transmit FIFO. + // + ROM_UARTCharPutNonBlocking(ui32Base, ui8Char); + + // + // Update our count of bytes transmitted via the UART. + // + g_ui32UARTTxCount++; + } + else + { + // + // We ran out of characters so exit the function. + // + return; + } + } +} + +//***************************************************************************** +// +// Interrupt handler for the system tick counter. +// +//***************************************************************************** +void +SysTickIntHandler(void) +{ + // + // Update our system time. + // + g_ui32SysTickCount++; +} + +//***************************************************************************** +// +// Interrupt handler for the UART which we are redirecting via USB. +// +//***************************************************************************** +void +USBUARTIntHandler(void) +{ + uint32_t ui32Ints; + int32_t i32Errors; + + // + // Get and clear the current interrupt source(s) + // + ui32Ints = ROM_UARTIntStatus(USB_UART_BASE, true); + ROM_UARTIntClear(USB_UART_BASE, ui32Ints); + + // + // Are we being interrupted because the TX FIFO has space available? + // + if(ui32Ints & UART_INT_TX) + { + // + // Move as many bytes as we can into the transmit FIFO. + // + USBUARTPrimeTransmit(USB_UART_BASE); + + // + // If the output buffer is empty, turn off the transmit interrupt. + // + if(!USBBufferDataAvailable(&g_sRxBuffer)) + { + ROM_UARTIntDisable(USB_UART_BASE, UART_INT_TX); + } + } + + // + // Handle receive interrupts. + // + if(ui32Ints & (UART_INT_RX | UART_INT_RT)) + { + // + // Read the UART's characters into the buffer. + // + i32Errors = ReadUARTData(); + + // + // Check to see if we need to notify the host of any errors we just + // detected. + // + CheckForSerialStateChange(&g_sCDCDevice, i32Errors); + } +} + +//***************************************************************************** +// +// Set the state of the RS232 RTS and DTR signals. +// +//***************************************************************************** +static void +SetControlLineState(uint16_t ui16State) +{ + // + // TODO: If configured with GPIOs controlling the handshake lines, + // set them appropriately depending upon the flags passed in the wValue + // field of the request structure passed. + // +} + +//***************************************************************************** +// +// Set the communication parameters to use on the UART. +// +//***************************************************************************** +static bool +SetLineCoding(tLineCoding *psLineCoding) +{ + uint32_t ui32Config; + bool bRetcode; + + // + // Assume everything is OK until we detect any problem. + // + bRetcode = true; + + // + // Word length. For invalid values, the default is to set 8 bits per + // character and return an error. + // + switch(psLineCoding->ui8Databits) + { + case 5: + { + ui32Config = UART_CONFIG_WLEN_5; + break; + } + + case 6: + { + ui32Config = UART_CONFIG_WLEN_6; + break; + } + + case 7: + { + ui32Config = UART_CONFIG_WLEN_7; + break; + } + + case 8: + { + ui32Config = UART_CONFIG_WLEN_8; + break; + } + + default: + { + ui32Config = UART_CONFIG_WLEN_8; + bRetcode = false; + break; + } + } + + // + // Parity. For any invalid values, we set no parity and return an error. + // + switch(psLineCoding->ui8Parity) + { + case USB_CDC_PARITY_NONE: + { + ui32Config |= UART_CONFIG_PAR_NONE; + break; + } + + case USB_CDC_PARITY_ODD: + { + ui32Config |= UART_CONFIG_PAR_ODD; + break; + } + + case USB_CDC_PARITY_EVEN: + { + ui32Config |= UART_CONFIG_PAR_EVEN; + break; + } + + case USB_CDC_PARITY_MARK: + { + ui32Config |= UART_CONFIG_PAR_ONE; + break; + } + + case USB_CDC_PARITY_SPACE: + { + ui32Config |= UART_CONFIG_PAR_ZERO; + break; + } + + default: + { + ui32Config |= UART_CONFIG_PAR_NONE; + bRetcode = false; + break; + } + } + + // + // Stop bits. Our hardware only supports 1 or 2 stop bits whereas CDC + // allows the host to select 1.5 stop bits. If passed 1.5 (or any other + // invalid or unsupported value of ui8Stop, we set up for 1 stop bit but + // return an error in case the caller needs to Stall or otherwise report + // this back to the host. + // + switch(psLineCoding->ui8Stop) + { + // + // One stop bit requested. + // + case USB_CDC_STOP_BITS_1: + { + ui32Config |= UART_CONFIG_STOP_ONE; + break; + } + + // + // Two stop bits requested. + // + case USB_CDC_STOP_BITS_2: + { + ui32Config |= UART_CONFIG_STOP_TWO; + break; + } + + // + // Other cases are either invalid values of ui8Stop or values that we + // cannot support so set 1 stop bit but return an error. + // + default: + { + ui32Config = UART_CONFIG_STOP_ONE; + bRetcode |= false; + break; + } + } + + // + // Set the UART mode appropriately. + // + ROM_UARTConfigSetExpClk(USB_UART_BASE, ROM_SysCtlClockGet(), + psLineCoding->ui32Rate, ui32Config); + + // + // Let the caller know if we had a problem or not. + // + return(bRetcode); +} + +//***************************************************************************** +// +// Get the communication parameters in use on the UART. +// +//***************************************************************************** +static void +GetLineCoding(tLineCoding *psLineCoding) +{ + uint32_t ui32Config; + uint32_t ui32Rate; + + // + // Get the current line coding set in the UART. + // + ROM_UARTConfigGetExpClk(USB_UART_BASE, ROM_SysCtlClockGet(), &ui32Rate, + &ui32Config); + psLineCoding->ui32Rate = ui32Rate; + + // + // Translate the configuration word length field into the format expected + // by the host. + // + switch(ui32Config & UART_CONFIG_WLEN_MASK) + { + case UART_CONFIG_WLEN_8: + { + psLineCoding->ui8Databits = 8; + break; + } + + case UART_CONFIG_WLEN_7: + { + psLineCoding->ui8Databits = 7; + break; + } + + case UART_CONFIG_WLEN_6: + { + psLineCoding->ui8Databits = 6; + break; + } + + case UART_CONFIG_WLEN_5: + { + psLineCoding->ui8Databits = 5; + break; + } + } + + // + // Translate the configuration parity field into the format expected + // by the host. + // + switch(ui32Config & UART_CONFIG_PAR_MASK) + { + case UART_CONFIG_PAR_NONE: + { + psLineCoding->ui8Parity = USB_CDC_PARITY_NONE; + break; + } + + case UART_CONFIG_PAR_ODD: + { + psLineCoding->ui8Parity = USB_CDC_PARITY_ODD; + break; + } + + case UART_CONFIG_PAR_EVEN: + { + psLineCoding->ui8Parity = USB_CDC_PARITY_EVEN; + break; + } + + case UART_CONFIG_PAR_ONE: + { + psLineCoding->ui8Parity = USB_CDC_PARITY_MARK; + break; + } + + case UART_CONFIG_PAR_ZERO: + { + psLineCoding->ui8Parity = USB_CDC_PARITY_SPACE; + break; + } + } + + // + // Translate the configuration stop bits field into the format expected + // by the host. + // + switch(ui32Config & UART_CONFIG_STOP_MASK) + { + case UART_CONFIG_STOP_ONE: + { + psLineCoding->ui8Stop = USB_CDC_STOP_BITS_1; + break; + } + + case UART_CONFIG_STOP_TWO: + { + psLineCoding->ui8Stop = USB_CDC_STOP_BITS_2; + break; + } + } +} + +//***************************************************************************** +// +// This function sets or clears a break condition on the redirected UART RX +// line. A break is started when the function is called with \e bSend set to +// \b true and persists until the function is called again with \e bSend set +// to \b false. +// +//***************************************************************************** +static void +SendBreak(bool bSend) +{ + // + // Are we being asked to start or stop the break condition? + // + if(!bSend) + { + // + // Remove the break condition on the line. + // + ROM_UARTBreakCtl(USB_UART_BASE, false); + g_bSendingBreak = false; + } + else + { + // + // Start sending a break condition on the line. + // + ROM_UARTBreakCtl(USB_UART_BASE, true); + g_bSendingBreak = true; + } +} + +//***************************************************************************** +// +// Shows the status string on the color STN display. +// +// \param psContext is a pointer to the graphics context representing the +// display. +// \param pcStatus is a pointer to the string to be shown. +// +// This implementation assumes we are using a 6 pixel wide font, giving us +// space for 16 characters across the display. +// +//***************************************************************************** +void +DisplayStatus(tContext *psContext, char *pcStatus) +{ + tRectangle sRectLine; + + // + // Determine the bounding rectangle for this line of text. + // + sRectLine.i16XMin = 0; + sRectLine.i16XMax = GrContextDpyWidthGet(psContext) - 1; + sRectLine.i16YMin = GrContextDpyHeightGet(psContext) - (TEXT_HEIGHT + 2); + sRectLine.i16YMax = sRectLine.i16YMin + GrFontHeightGet(TEXT_FONT) + 1; + + // + // Clear the line with black. + // + GrContextForegroundSet(&g_sContext, ClrBlack); + GrRectFill(psContext, &sRectLine); + + // + // Draw the new status string + // + GrContextForegroundSet(&g_sContext, ClrWhite); + GrStringDrawCentered(psContext, pcStatus, -1, + GrContextDpyWidthGet(psContext) / 2, + sRectLine.i16YMin + (TEXT_HEIGHT / 2), false); +} + +//***************************************************************************** +// +// Draw a horizontal meter at a given position on the display and fill it +// with green. +// +//***************************************************************************** +void +DrawBufferMeter(tContext *psContext, int32_t i32X, int32_t i32Y) +{ + tRectangle sRect; + int32_t i32CorrectedY; + + // + // Correct the Y coordinate so that the meter is centered on the same line + // as the text caption to its left. + // + i32CorrectedY = i32Y - ((BUFFER_METER_HEIGHT - TEXT_HEIGHT) / 2); + + // + // Determine the bounding rectangle of the meter. + // + sRect.i16XMin = i32X; + sRect.i16XMax = i32X + BUFFER_METER_WIDTH - 1; + sRect.i16YMin = i32CorrectedY; + sRect.i16YMax = i32CorrectedY + BUFFER_METER_HEIGHT - 1; + + // + // Fill the meter with green to indicate empty + // + GrContextForegroundSet(psContext, ClrGreen); + GrRectFill(psContext, &sRect); + + // + // Put a white box around the meter. + // + GrContextForegroundSet(psContext, ClrWhite); + GrRectDraw(psContext, &sRect); +} + +//***************************************************************************** +// +// Draw green and red blocks within a graphical meter on the display to +// indicate percentage fullness of some quantity (transmit and receive buffers +// in this case). +// +//***************************************************************************** +void +UpdateBufferMeter(tContext *psContext, uint32_t ui32FullPercent, int32_t i32X, + int32_t i32Y) +{ + tRectangle sRect; + int32_t i32CorrectedY; + int32_t i32XBreak; + + // + // Correct the Y coordinate so that the meter is centered on the same line + // as the text caption to its left and so that we avoid the meter's 1 pixel + // white border. + // + i32CorrectedY = i32Y - ((BUFFER_METER_HEIGHT - TEXT_HEIGHT) / 2) + 1; + + // + // Determine where the break point between full (red) and empty (green) + // sections occurs. + // + i32XBreak = (i32X + 1) + (ui32FullPercent * (BUFFER_METER_WIDTH - 2)) / 100; + + // + // Determine the bounding rectangle of the full section. + // + sRect.i16XMin = i32X + 1; + sRect.i16XMax = i32XBreak; + sRect.i16YMin = i32CorrectedY; + sRect.i16YMax = i32CorrectedY + BUFFER_METER_HEIGHT - 3; + + // + // Fill the full section with red (if there is anything to draw) + // + if(ui32FullPercent) + { + GrContextForegroundSet(psContext, ClrRed); + GrRectFill(psContext, &sRect); + } + + // + // Fill the empty section with green. + // + sRect.i16XMin = i32XBreak; + sRect.i16XMax = i32X + BUFFER_METER_WIDTH - 2; + if(sRect.i16XMax > sRect.i16XMin) + { + GrContextForegroundSet(psContext, ClrGreen); + GrRectFill(psContext, &sRect); + } + + // + // Revert to white for text drawing which may occur later. + // + GrContextForegroundSet(psContext, ClrWhite); + +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to control and setup of the device. +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to perform control-related +// operations on behalf of the USB host. These functions include setting +// and querying the serial communication parameters, setting handshake line +// states and sending break conditions. +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +ControlHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData) +{ + uint32_t ui32IntsOff; + + // + // Which event are we being asked to process? + // + switch(ui32Event) + { + // + // We are connected to a host and communication is now possible. + // + case USB_EVENT_CONNECTED: + g_bUSBConfigured = true; + + // + // Flush our buffers. + // + USBBufferFlush(&g_sTxBuffer); + USBBufferFlush(&g_sRxBuffer); + + // + // Tell the main loop to update the display. + // + ui32IntsOff = ROM_IntMasterDisable(); + g_pcStatus = "Connected"; + g_ui32Flags |= COMMAND_STATUS_UPDATE; + if(!ui32IntsOff) + { + ROM_IntMasterEnable(); + } + break; + + // + // The host has disconnected. + // + case USB_EVENT_DISCONNECTED: + g_bUSBConfigured = false; + ui32IntsOff = ROM_IntMasterDisable(); + g_pcStatus = "Disconnected"; + g_ui32Flags |= COMMAND_STATUS_UPDATE; + if(!ui32IntsOff) + { + ROM_IntMasterEnable(); + } + break; + + // + // Return the current serial communication parameters. + // + case USBD_CDC_EVENT_GET_LINE_CODING: + GetLineCoding(pvMsgData); + break; + + // + // Set the current serial communication parameters. + // + case USBD_CDC_EVENT_SET_LINE_CODING: + SetLineCoding(pvMsgData); + break; + + // + // Set the current serial communication parameters. + // + case USBD_CDC_EVENT_SET_CONTROL_LINE_STATE: + SetControlLineState((uint16_t)ui32MsgValue); + break; + + // + // Send a break condition on the serial line. + // + case USBD_CDC_EVENT_SEND_BREAK: + SendBreak(true); + break; + + // + // Clear the break condition on the serial line. + // + case USBD_CDC_EVENT_CLEAR_BREAK: + SendBreak(false); + break; + + // + // Ignore SUSPEND and RESUME for now. + // + case USB_EVENT_SUSPEND: + case USB_EVENT_RESUME: + break; + + // + // We don't expect to receive any other events. Ignore any that show + // up in a release build or hang in a debug build. + // + default: +#ifdef DEBUG + while(1); +#else + break; +#endif + + } + + return(0); +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to the transmit channel (data to +// the USB host). +// +// \param pvCBData is the client-supplied callback pointer for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to notify us of any events +// related to operation of the transmit data channel (the IN channel carrying +// data to the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData) +{ + // + // Which event have we been sent? + // + switch(ui32Event) + { + case USB_EVENT_TX_COMPLETE: + // + // Since we are using the USBBuffer, we don't need to do anything + // here. + // + break; + + // + // We don't expect to receive any other events. Ignore any that show + // up in a release build or hang in a debug build. + // + default: +#ifdef DEBUG + while(1); +#else + break; +#endif + + } + return(0); +} + +//***************************************************************************** +// +// Handles CDC driver notifications related to the receive channel (data from +// the USB host). +// +// \param pvCBData is the client-supplied callback data value for this channel. +// \param ui32Event identifies the event we are being notified about. +// \param ui32MsgValue is an event-specific value. +// \param pvMsgData is an event-specific pointer. +// +// This function is called by the CDC driver to notify us of any events +// related to operation of the receive data channel (the OUT channel carrying +// data from the USB host). +// +// \return The return value is event-specific. +// +//***************************************************************************** +uint32_t +RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, + void *pvMsgData) +{ + uint32_t ui32Count; + + // + // Which event are we being sent? + // + switch(ui32Event) + { + // + // A new packet has been received. + // + case USB_EVENT_RX_AVAILABLE: + { + // + // Feed some characters into the UART TX FIFO and enable the + // interrupt so we are told when there is more space. + // + USBUARTPrimeTransmit(USB_UART_BASE); + ROM_UARTIntEnable(USB_UART_BASE, UART_INT_TX); + break; + } + + // + // We are being asked how much unprocessed data we have still to + // process. We return 0 if the UART is currently idle or 1 if it is + // in the process of transmitting something. The actual number of + // bytes in the UART FIFO is not important here, merely whether or + // not everything previously sent to us has been transmitted. + // + case USB_EVENT_DATA_REMAINING: + { + // + // Get the number of bytes in the buffer and add 1 if some data + // still has to clear the transmitter. + // + ui32Count = ROM_UARTBusy(USB_UART_BASE) ? 1 : 0; + return(ui32Count); + } + + // + // We are being asked to provide a buffer into which the next packet + // can be read. We do not support this mode of receiving data so let + // the driver know by returning 0. The CDC driver should not be sending + // this message but this is included just for illustration and + // completeness. + // + case USB_EVENT_REQUEST_BUFFER: + { + return(0); + } + + // + // We don't expect to receive any other events. Ignore any that show + // up in a release build or hang in a debug build. + // + default: +#ifdef DEBUG + while(1); +#else + break; +#endif + } + + return(0); +} + +//***************************************************************************** +// +// This is the main application entry function. +// +//***************************************************************************** +int +main(void) +{ + uint32_t ui32TxCount; + uint32_t ui32RxCount; + tRectangle sRect; + char pcBuffer[16]; + uint32_t ui32Fullness; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run from the PLL at 50MHz + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Configure the required pins for USB operation. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Erratum workaround for silicon revision A1. VBUS must have pull-down. + // + if(CLASS_IS_TM4C123 && REVISION_IS_A1) + { + HWREG(GPIO_PORTB_BASE + GPIO_O_PDR) |= GPIO_PIN_1; + } + + // + // Not configured initially. + // + g_bUSBConfigured = false; + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top 15 rows of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + GrRectDraw(&g_sContext, &sRect); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "usb-dev-serial", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + + // + // Show the various static text elements on the color STN display. + // + GrStringDraw(&g_sContext, "Tx #",-1, 0, 12, false); + GrStringDraw(&g_sContext, "Tx buf", -1, 0, 22, false); + GrStringDraw(&g_sContext, "Rx #", -1, 0, 32, false); + GrStringDraw(&g_sContext, "Rx buf", -1, 0, 42, false); + DrawBufferMeter(&g_sContext, 40, 22); + DrawBufferMeter(&g_sContext, 40, 42); + + // + // Enable the UART that we will be redirecting. + // + ROM_SysCtlPeripheralEnable(USB_UART_PERIPH); + + // + // Enable and configure the UART RX and TX pins + // + ROM_SysCtlPeripheralEnable(TX_GPIO_PERIPH); + ROM_SysCtlPeripheralEnable(RX_GPIO_PERIPH); + ROM_GPIOPinTypeUART(TX_GPIO_BASE, TX_GPIO_PIN); + ROM_GPIOPinTypeUART(RX_GPIO_BASE, RX_GPIO_PIN); + + // + // TODO: Add code to configure handshake GPIOs if required. + // + + // + // Set the default UART configuration. + // + ROM_UARTConfigSetExpClk(USB_UART_BASE, ROM_SysCtlClockGet(), + DEFAULT_BIT_RATE, DEFAULT_UART_CONFIG); + ROM_UARTFIFOLevelSet(USB_UART_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8); + + // + // Configure and enable UART interrupts. + // + ROM_UARTIntClear(USB_UART_BASE, ROM_UARTIntStatus(USB_UART_BASE, false)); + ROM_UARTIntEnable(USB_UART_BASE, (UART_INT_OE | UART_INT_BE | UART_INT_PE | + UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX)); + + // + // Enable the system tick. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND); + ROM_SysTickIntEnable(); + ROM_SysTickEnable(); + + // + // Tell the user what we are up to. + // + DisplayStatus(&g_sContext, " Configuring... "); + + // + // Initialize the transmit and receive buffers. + // + USBBufferInit(&g_sTxBuffer); + USBBufferInit(&g_sRxBuffer); + + // + // Set the USB stack mode to Device mode with VBUS monitoring. + // + USBStackModeSet(0, eUSBModeDevice, 0); + + // + // Pass our device information to the USB library and place the device + // on the bus. + // + USBDCDCInit(0, &g_sCDCDevice); + + // + // Wait for initial configuration to complete. + // + DisplayStatus(&g_sContext, "Waiting for host"); + + // + // Clear our local byte counters. + // + ui32RxCount = 0; + ui32TxCount = 0; + + // + // Enable interrupts now that the application is ready to start. + // + ROM_IntEnable(USB_UART_INT); + + // + // Main application loop. + // + while(1) + { + + // + // Have we been asked to update the status display? + // + if(g_ui32Flags & COMMAND_STATUS_UPDATE) + { + // + // Clear the command flag + // + ROM_IntMasterDisable(); + g_ui32Flags &= ~COMMAND_STATUS_UPDATE; + ROM_IntMasterEnable(); + + DisplayStatus(&g_sContext, g_pcStatus); + } + + // + // Has there been any transmit traffic since we last checked? + // + if(ui32TxCount != g_ui32UARTTxCount) + { + // + // Take a snapshot of the latest transmit count. + // + ui32TxCount = g_ui32UARTTxCount; + + // + // Update the display of bytes transmitted by the UART. + // + usnprintf(pcBuffer, 16, "%d ", ui32TxCount); + GrStringDraw(&g_sContext, pcBuffer, -1, 40, 12, true); + + // + // Update the RX buffer fullness. Remember that the buffers are + // named relative to the USB whereas the status display is from + // the UART's perspective. The USB's receive buffer is the UART's + // transmit buffer. + // + ui32Fullness = ((USBBufferDataAvailable(&g_sRxBuffer) * 100) / + UART_BUFFER_SIZE); + + UpdateBufferMeter(&g_sContext, ui32Fullness, 40, 22); + } + + // + // Has there been any receive traffic since we last checked? + // + if(ui32RxCount != g_ui32UARTRxCount) + { + // + // Take a snapshot of the latest receive count. + // + ui32RxCount = g_ui32UARTRxCount; + + // + // Update the display of bytes received by the UART. + // + usnprintf(pcBuffer, 16, "%d ", ui32RxCount); + GrStringDraw(&g_sContext, pcBuffer, -1, 40, 32, true); + + // + // Update the TX buffer fullness. Remember that the buffers are + // named relative to the USB whereas the status display is from + // the UART's perspective. The USB's transmit buffer is the UART's + // receive buffer. + // + ui32Fullness = ((USBBufferDataAvailable(&g_sTxBuffer) * 100) / + UART_BUFFER_SIZE); + + UpdateBufferMeter(&g_sContext, ui32Fullness, 40, 42); + } + } +} diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewd b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewp b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewp new file mode 100644 index 0000000..c3a5d25 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ewp @@ -0,0 +1,805 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_dev_serial.c + + + $PROJ_DIR$\usb_serial_structs.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.icf b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.icf new file mode 100644 index 0000000..273b33d --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_dev_serial.icf - Linker configuration file for usb_dev_serial. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ld b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ld new file mode 100644 index 0000000..a81bd04 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_dev_serial.ld - Linker configuration file for usb_dev_serial. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.sct b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.sct new file mode 100644 index 0000000..7383330 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_dev_serial.sct - Linker configuration file for usb_dev_serial. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvopt b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvopt new file mode 100644 index 0000000..75fd78c --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvopt @@ -0,0 +1,373 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_dev_serial + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_dev_serial.c + usb_dev_serial.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_serial_structs.c + usb_serial_structs.c + + + 1 + 6 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 8 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 9 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 10 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvproj b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvproj new file mode 100644 index 0000000..f0937ec --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial.uvproj @@ -0,0 +1,454 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_dev_serial + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_dev_serial + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_dev_serial.bin .\rvmdk\usb_dev_serial.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 UART_BUFFERED + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_dev_serial.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_dev_serial.c + 1 + .\usb_dev_serial.c + + + usb_serial_structs.c + 1 + .\usb_serial_structs.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial_ccs.cmd b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial_ccs.cmd new file mode 100644 index 0000000..8eed689 --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_dev_serial_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_dev_serial_ccs.cmd - CCS linker configuration file for usb_dev_serial. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.c b/boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.c new file mode 100644 index 0000000..cd1761e --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.c @@ -0,0 +1,215 @@ +//***************************************************************************** +// +// usb_serial_structs.c - Data structures defining this CDC USB device. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "driverlib/usb.h" +#include "usblib/usblib.h" +#include "usblib/usbcdc.h" +#include "usblib/usb-ids.h" +#include "usblib/device/usbdevice.h" +#include "usblib/device/usbdcdc.h" +#include "usb_serial_structs.h" + +//***************************************************************************** +// +// The languages supported by this device. +// +//***************************************************************************** +const uint8_t g_pui8LangDescriptor[] = +{ + 4, + USB_DTYPE_STRING, + USBShort(USB_LANG_EN_US) +}; + +//***************************************************************************** +// +// The manufacturer string. +// +//***************************************************************************** +const uint8_t g_pui8ManufacturerString[] = +{ + (17 + 1) * 2, + USB_DTYPE_STRING, + 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0, + 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0, +}; + +//***************************************************************************** +// +// The product string. +// +//***************************************************************************** +const uint8_t g_pui8ProdectString[] = +{ + 2 + (16 * 2), + USB_DTYPE_STRING, + 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0, + 'C', 0, 'O', 0, 'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0 +}; + +//***************************************************************************** +// +// The serial number string. +// +//***************************************************************************** +const uint8_t g_pui8SerialNumberString[] = +{ + 2 + (8 * 2), + USB_DTYPE_STRING, + '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0 +}; + +//***************************************************************************** +// +// The control interface description string. +// +//***************************************************************************** +const uint8_t g_pui8ControlInterfaceString[] = +{ + 2 + (21 * 2), + USB_DTYPE_STRING, + 'A', 0, 'C', 0, 'M', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, 't', 0, + 'r', 0, 'o', 0, 'l', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, 'e', 0, + 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0 +}; + +//***************************************************************************** +// +// The configuration description string. +// +//***************************************************************************** +const uint8_t g_pui8ConfigString[] = +{ + 2 + (26 * 2), + USB_DTYPE_STRING, + 'S', 0, 'e', 0, 'l', 0, 'f', 0, ' ', 0, 'P', 0, 'o', 0, 'w', 0, + 'e', 0, 'r', 0, 'e', 0, 'd', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, + 'f', 0, 'i', 0, 'g', 0, 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0, + 'o', 0, 'n', 0 +}; + +//***************************************************************************** +// +// The descriptor string table. +// +//***************************************************************************** +const uint8_t * const g_pui8StringDescriptors[] = +{ + g_pui8LangDescriptor, + g_pui8ManufacturerString, + g_pui8ProdectString, + g_pui8SerialNumberString, + g_pui8ControlInterfaceString, + g_pui8ConfigString +}; + +#define NUM_STRING_DESCRIPTORS (sizeof(g_pui8StringDescriptors) / \ + sizeof(uint8_t *)) + +//***************************************************************************** +// +// CDC device callback function prototypes. +// +//***************************************************************************** +uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); +uint32_t TxHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); +uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); + +//***************************************************************************** +// +// The CDC device initialization and customization structures. In this case, +// we are using USBBuffers between the CDC device class driver and the +// application code. The function pointers and callback data values are set +// to insert a buffer in each of the data channels, transmit and receive. +// +// With the buffer in place, the CDC channel callback is set to the relevant +// channel function and the callback data is set to point to the channel +// instance data. The buffer, in turn, has its callback set to the application +// function and the callback data set to our CDC instance structure. +// +//***************************************************************************** +extern const tUSBBuffer g_sTxBuffer; +extern const tUSBBuffer g_sRxBuffer; + +tUSBDCDCDevice g_sCDCDevice = +{ + USB_VID_TI_1CBE, + USB_PID_SERIAL, + 0, + USB_CONF_ATTR_SELF_PWR, + ControlHandler, + (void *)&g_sCDCDevice, + USBBufferEventCallback, + (void *)&g_sRxBuffer, + USBBufferEventCallback, + (void *)&g_sTxBuffer, + g_pui8StringDescriptors, + NUM_STRING_DESCRIPTORS +}; + +//***************************************************************************** +// +// Receive buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pi8USBRxBuffer[UART_BUFFER_SIZE]; +uint8_t g_pui8RxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE]; +const tUSBBuffer g_sRxBuffer = +{ + false, // This is a receive buffer. + RxHandler, // pfnCallback + (void *)&g_sCDCDevice, // Callback data is our device pointer. + USBDCDCPacketRead, // pfnTransfer + USBDCDCRxPacketAvailable, // pfnAvailable + (void *)&g_sCDCDevice, // pvHandle + g_pi8USBRxBuffer, // pi8Buffer + UART_BUFFER_SIZE, // ui32BufferSize + g_pui8RxBufferWorkspace // pvWorkspace +}; + +//***************************************************************************** +// +// Transmit buffer (from the USB perspective). +// +//***************************************************************************** +uint8_t g_pi8USBTxBuffer[UART_BUFFER_SIZE]; +uint8_t g_pui8TxBufferWorkspace[USB_BUFFER_WORKSPACE_SIZE]; +const tUSBBuffer g_sTxBuffer = +{ + true, // This is a transmit buffer. + TxHandler, // pfnCallback + (void *)&g_sCDCDevice, // Callback data is our device pointer. + USBDCDCPacketWrite, // pfnTransfer + USBDCDCTxPacketAvailable, // pfnAvailable + (void *)&g_sCDCDevice, // pvHandle + g_pi8USBTxBuffer, // pi8Buffer + UART_BUFFER_SIZE, // ui32BufferSize + g_pui8TxBufferWorkspace // pvWorkspace +}; diff --git a/boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.h b/boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.h new file mode 100644 index 0000000..d8c617a --- /dev/null +++ b/boards/ek-lm4f232/usb_dev_serial/usb_serial_structs.h @@ -0,0 +1,49 @@ +//***************************************************************************** +// +// usb_serial_structs.h - Data structures defining this USB CDC device. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef _USB_SERIAL_STRUCTS_H_ +#define _USB_SERIAL_STRUCTS_H_ + +//***************************************************************************** +// +// The size of the transmit and receive buffers used for the redirected UART. +// This number should be a power of 2 for best performance. 256 is chosen +// pretty much at random though the buffer should be at least twice the size of +// a maxmum-sized USB packet. +// +//***************************************************************************** +#define UART_BUFFER_SIZE 256 + +extern uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); +extern uint32_t TxHandler(void *pvi32CBData, uint32_t ui32Event, + uint32_t ui32MsgValue, void *pvMsgData); + +extern const tUSBBuffer g_sTxBuffer; +extern const tUSBBuffer g_sRxBuffer; +extern tUSBDCDCDevice g_sCDCDevice; +extern uint8_t g_pui8USBTxBuffer[]; +extern uint8_t g_pui8USBRxBuffer[]; + +#endif diff --git a/boards/ek-lm4f232/usb_host_audio/Makefile b/boards/ek-lm4f232/usb_host_audio/Makefile new file mode 100644 index 0000000..894d383 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/Makefile @@ -0,0 +1,100 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB host audio example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../third_party/fatfs/port +VPATH+=../../../../third_party/fatfs/src +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. +IPATH+=../../../../third_party +IPATH+=../../../../utils + +# +# The default rule, which causes the USB host audio example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_host_audio.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB host audio example. +# +${COMPILER}/usb_host_audio.axf: ${COMPILER}/buttons.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/ff.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/mmc-ek-lm4f232.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/slidemenuwidget.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/usb_host_audio.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/usb_sound.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/ustdlib.o +${COMPILER}/usb_host_audio.axf: ${COMPILER}/wavfile.o +${COMPILER}/usb_host_audio.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_host_audio.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_host_audio.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_host_audio.axf: usb_host_audio.ld +SCATTERgcc_usb_host_audio=usb_host_audio.ld +ENTRY_usb_host_audio=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_host_audio/ccs/.ccsimportspec new file mode 100644 index 0000000..fbf85a1 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/.ccsproject b/boards/ek-lm4f232/usb_host_audio/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/.cproject b/boards/ek-lm4f232/usb_host_audio/ccs/.cproject new file mode 100644 index 0000000..9a5cbf7 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/ccs/.cproject @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/.project b/boards/ek-lm4f232/usb_host_audio/ccs/.project new file mode 100644 index 0000000..ae92495 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/ccs/.project @@ -0,0 +1,90 @@ + + + usb_host_audio + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_audio/startup_ccs.c + + + usb_host_audio.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_audio/usb_host_audio.c + + + usb_host_audio_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_audio/usb_host_audio_ccs.cmd + + + drivers/buttons.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/buttons.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + drivers/slidemenuwidget.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/slidemenuwidget.c + + + drivers/usb_sound.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/usb_sound.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + utils/wavfile.c + 1 + SW_ROOT/utils/wavfile.c + + + third_party/fatfs/port/mmc-ek-lm4f232.c + 1 + SW_ROOT/third_party/fatfs/port/mmc-ek-lm4f232.c + + + third_party/fatfs/src/ff.c + 1 + SW_ROOT/third_party/fatfs/src/ff.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_host_audio/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.bin b/boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.bin new file mode 100644 index 0000000..a5ca953 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.bin differ diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.out b/boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.out new file mode 100644 index 0000000..209e4fe Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/ccs/Debug/usb_host_audio.out differ diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_host_audio/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_host_audio/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_host_audio/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.bin b/boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.bin new file mode 100644 index 0000000..b71bde8 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.bin differ diff --git a/boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.out b/boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.out new file mode 100644 index 0000000..dc84279 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/ewarm/Exe/usb_host_audio.out differ diff --git a/boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.axf b/boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.axf new file mode 100644 index 0000000..7816db2 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.axf differ diff --git a/boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.bin b/boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.bin new file mode 100644 index 0000000..0e8e4bf Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/gcc/usb_host_audio.bin differ diff --git a/boards/ek-lm4f232/usb_host_audio/readme.txt b/boards/ek-lm4f232/usb_host_audio/readme.txt new file mode 100644 index 0000000..408d3b6 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/readme.txt @@ -0,0 +1,32 @@ +USB host audio example application using SD Card FAT file system + + +This example application demonstrates playing .wav files from an SD card +that is formatted with a FAT file system using USB host audio class. The +application will only look in the root directory of the SD card and display +all files that are found. Files can be selected to show their format and +then played if the application determines that they are a valid .wav file. +Only PCM format (uncompressed) files may be played. + +For additional details about FatFs, see the following site: +http://elm-chan.org/fsw/ff/00index_e.html + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.axf b/boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.axf new file mode 100644 index 0000000..4b3d1de Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.axf differ diff --git a/boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.bin b/boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.bin new file mode 100644 index 0000000..37e5857 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_audio/rvmdk/usb_host_audio.bin differ diff --git a/boards/ek-lm4f232/usb_host_audio/startup_ccs.c b/boards/ek-lm4f232/usb_host_audio/startup_ccs.c new file mode 100644 index 0000000..df90457 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/startup_ccs.c @@ -0,0 +1,303 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_audio/startup_ewarm.c b/boards/ek-lm4f232/usb_host_audio/startup_ewarm.c new file mode 100644 index 0000000..511a2a8 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/startup_ewarm.c @@ -0,0 +1,334 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[512] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_audio/startup_gcc.c b/boards/ek-lm4f232/usb_host_audio/startup_gcc.c new file mode 100644 index 0000000..f4fcc5e --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/startup_gcc.c @@ -0,0 +1,350 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[512]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_audio/startup_rvmdk.S b/boards/ek-lm4f232/usb_host_audio/startup_rvmdk.S new file mode 100644 index 0000000..daba879 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000800 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickHandler + EXTERN USB0OTGModeIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0OTGModeIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.c b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.c new file mode 100644 index 0000000..a54ad8c --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.c @@ -0,0 +1,1987 @@ +//***************************************************************************** +// +// usb_host_audio.c - Main routine for the USB host audio example. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_ints.h" +#include "driverlib/flash.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/rom.h" +#include "driverlib/sysctl.h" +#include "driverlib/udma.h" +#include "driverlib/systick.h" +#include "driverlib/pin_map.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "grlib/canvas.h" +#include "grlib/slider.h" +#include "grlib/listbox.h" +#include "grlib/pushbutton.h" +#include "utils/ustdlib.h" +#include "third_party/fatfs/src/ff.h" +#include "third_party/fatfs/src/diskio.h" +#include "drivers/usb_sound.h" +#include "utils/wavfile.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/buttons.h" +#include "drivers/slidemenuwidget.h" +#include "usblib/usblib.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB host audio example application using SD Card FAT file system +//! (usb_host_audio)

+//! +//! This example application demonstrates playing .wav files from an SD card +//! that is formatted with a FAT file system using USB host audio class. The +//! application will only look in the root directory of the SD card and display +//! all files that are found. Files can be selected to show their format and +//! then played if the application determines that they are a valid .wav file. +//! Only PCM format (uncompressed) files may be played. +//! +//! For additional details about FatFs, see the following site: +//! http://elm-chan.org/fsw/ff/00index_e.html +// +//***************************************************************************** + +//***************************************************************************** +// +// Our running system tick counter and a global used to determine the time +// elapsed since last call to GetTickms(). +// +//***************************************************************************** +static uint32_t g_ui32SysTickCount; +static uint32_t g_ui32LastTick; +static uint32_t GetTickms(void); + +//***************************************************************************** +// +// The following are data structures used by FatFs. +// +//***************************************************************************** +static FATFS g_sFatFs; +static DIR g_sDirObject; +static FILINFO g_sFileInfo; + +//***************************************************************************** +// +// A structure that holds a mapping between an FRESULT numerical code, +// and a string representation. FRESULT codes are returned from the FatFs +// FAT file system driver. +// +//***************************************************************************** +typedef struct +{ + FRESULT fresult; + char *pcResultStr; +} +tFresultString; + +//***************************************************************************** +// +// A macro to make it easy to add result codes to the table. +// +//***************************************************************************** +#define FRESULT_ENTRY(f) { (f), (#f) } + +//***************************************************************************** +// +// A table that holds a mapping between the numerical FRESULT code and +// it's name as a string. This is used for looking up error codes and +// providing a human-readable string. +// +//***************************************************************************** +tFresultString g_sFresultStrings[] = +{ + FRESULT_ENTRY(FR_OK), + FRESULT_ENTRY(FR_DISK_ERR), + FRESULT_ENTRY(FR_INT_ERR), + FRESULT_ENTRY(FR_NOT_READY), + FRESULT_ENTRY(FR_NO_FILE), + FRESULT_ENTRY(FR_NO_PATH), + FRESULT_ENTRY(FR_INVALID_NAME), + FRESULT_ENTRY(FR_DENIED), + FRESULT_ENTRY(FR_EXIST), + FRESULT_ENTRY(FR_INVALID_OBJECT), + FRESULT_ENTRY(FR_WRITE_PROTECTED), + FRESULT_ENTRY(FR_INVALID_DRIVE), + FRESULT_ENTRY(FR_NOT_ENABLED), + FRESULT_ENTRY(FR_NO_FILESYSTEM), + FRESULT_ENTRY(FR_MKFS_ABORTED), + FRESULT_ENTRY(FR_TIMEOUT), + FRESULT_ENTRY(FR_LOCKED), + FRESULT_ENTRY(FR_NOT_ENOUGH_CORE), + FRESULT_ENTRY(FR_TOO_MANY_OPEN_FILES), + FRESULT_ENTRY(FR_INVALID_PARAMETER), +}; + +//***************************************************************************** +// +// A macro that holds the number of result codes. +// +//***************************************************************************** +#define NUM_FRESULT_CODES (sizeof(g_sFresultStrings) / sizeof(tFresultString)) + +//***************************************************************************** +// +// Error reasons returned by ChangeToDirectory(). +// +//***************************************************************************** +#define NAME_TOO_LONG_ERROR 1 +#define OPENDIR_ERROR 2 + +//***************************************************************************** +// +// Define a pair of buffers that are used for holding path information. +// The buffer size must be large enough to hold the longest expected +// full path name, including the file name, and a trailing null character. +// The initial path is set to root "/". +// +//***************************************************************************** +#define PATH_BUF_SIZE 80 +static char g_pcCwdBuf[PATH_BUF_SIZE] = "/"; +static char g_pcTmpBuf[PATH_BUF_SIZE]; + +//***************************************************************************** +// +// A set of string pointers that are used for showing status on the display. +// Five lines of text are accommodated, which is the reasonable limit for +// this display. +// +//***************************************************************************** +static char *g_pcStatusLines[5]; + +//***************************************************************************** +// +// A variable to track the current level in the directory tree. The root +// level is level 0. +// +//***************************************************************************** +static uint32_t g_ui32Level; + +//***************************************************************************** +// +// A variable to track the current level in the directory tree. The root +// level is level 0. +// +//***************************************************************************** +static uint32_t g_ui32Level; + +//***************************************************************************** +// +// Declare a pair of off-screen buffers and associated display structures. +// These are used by the slide menu widget for animated menu effects. +// +//***************************************************************************** +#define OFFSCREEN_BUF_SIZE GrOffScreen4BPPSize(96, 40) +static uint8_t g_pui8OffscreenBufA[OFFSCREEN_BUF_SIZE]; +static uint8_t g_pui8OffscreenBufB[OFFSCREEN_BUF_SIZE]; +static tDisplay g_sOffscreenDisplayA; +static tDisplay g_sOffscreenDisplayB; + +//***************************************************************************** +// +// Create a palette that is used by the on-screen menus and anything else that +// uses the (above) off-screen buffers. This palette should contain any +// colors that are used by any widget using the offscreen buffers. There can +// be up to 16 colors in this palette. +// +//***************************************************************************** +static uint32_t g_pui32Palette[] = +{ + ClrBlack, + ClrWhite, + ClrDarkBlue, + ClrLightBlue, + ClrRed, + ClrDarkGreen, + ClrYellow, + ClrBlue +}; +#define NUM_PALETTE_ENTRIES (sizeof(g_pui32Palette) / sizeof(uint32_t)) + +//***************************************************************************** +// +// The number of SysTick ticks per second. +// +//***************************************************************************** +#define TICKS_PER_SECOND 100 +#define MS_PER_SYSTICK (1000 / TICKS_PER_SECOND) + +//***************************************************************************** +// +// Audio buffering definitions, these are optimized to deal with USB audio. +// AUDIO_TRANSFER_SIZE define one frame of audio at 48000 Stereo 16 bit +// and AUDIO_BUFFERS declares 16 frames(16ms) of audio buffering. +// +//***************************************************************************** +#define AUDIO_TRANSFER_SIZE (192) +#define AUDIO_BUFFERS (16) +#define AUDIO_BUFFER_SIZE (AUDIO_TRANSFER_SIZE * AUDIO_BUFFERS) +uint32_t g_ui32TransferSize; +uint32_t g_ui32BufferSize; + +//***************************************************************************** +// +// The main audio buffer and it's pointers. +// +//***************************************************************************** +uint8_t g_pui8AudioBuffer[AUDIO_BUFFER_SIZE]; +uint8_t *g_pui8Read; +uint8_t *g_pui8Write; +uint32_t g_ui32ValidBytes; + +//***************************************************************************** +// +// Holds global flags for the system. +// +//***************************************************************************** +uint32_t g_ui32Flags = 0; + +// +// Currently streaming audio to the USB device. +// +#define FLAGS_PLAYING 1 + +// +// The last transfer has competed so a new one can be started. +// +#define FLAGS_TX_COMPLETE 2 + +// +// New audio device present. +// +#define FLAGS_DEVICE_CONNECT 3 + +// +// New audio device present. +// +#define FLAGS_DEVICE_READY 4 + +// +// Play Screen is being displayed +// +#define FLAGS_PLAY_SCREEN 5 + +//***************************************************************************** +// +// These are the global .wav file states used by the application. +// +//***************************************************************************** +tWavFile g_sWavFile; +tWavHeader g_sWavHeader; + +//***************************************************************************** +// +// Define the maximum number of files that can appear at any directory level. +// This is used for allocating space for holding the file information. +// Define the maximum depth of subdirectories, also used to allocating space +// for directory structures. +// Define the maximum number of characters allowed to be stored for a file +// name. +// +//***************************************************************************** +#define MAX_FILES_PER_MENU 64 +#define MAX_SUBDIR_DEPTH 32 +#define MAX_FILENAME_STRING_LEN 16 + +//***************************************************************************** +// +// Widget definitions +// +//***************************************************************************** + +//***************************************************************************** +// +// Declare a set of menu items and matching strings that are used to hold +// file information. There are two alternating sets. Two are needed because +// the file information must be retained for the current directory, and the +// new directory (up or down the tree). +// +//***************************************************************************** +static char g_pcFileNames[2][MAX_FILES_PER_MENU][MAX_FILENAME_STRING_LEN]; +static tSlideMenuItem g_psFileMenuItems[2][MAX_FILES_PER_MENU]; + +//***************************************************************************** +// +// Declare a set of menus, one for each level of directory. +// +//***************************************************************************** +static tSlideMenu g_psFileMenus[MAX_SUBDIR_DEPTH]; + +//***************************************************************************** +// +// Define the slide menu widget. This is the wigdet that is used for +// displaying the file information. +// +//***************************************************************************** +SlideMenu(g_sFileMenuWidget, WIDGET_ROOT, 0, 0, &g_sCFAL96x64x16, 0, 12, 96, 40, + &g_sOffscreenDisplayA, &g_sOffscreenDisplayB, 16, + ClrWhite, ClrRed, ClrBlack, &g_sFontFixed6x8, &g_psFileMenus[0], + 0); + +//***************************************************************************** +// +// The canvas widgets for the wav file information. +// +//***************************************************************************** +extern tCanvasWidget g_sWaveInfoBackground; + +char g_pcVolume[16] = ""; +Canvas(g_sWaveInfoVolume, &g_sWaveInfoBackground, 0, 0, + &g_sCFAL96x64x16, 0, 42, 96, 10, + CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE, ClrRed, ClrWhite, ClrWhite, g_psFontFixed6x8, + g_pcVolume, 0, 0); + +char g_pcTime[16] = ""; +Canvas(g_sWaveInfoTime, &g_sWaveInfoBackground, &g_sWaveInfoVolume, 0, + &g_sCFAL96x64x16, 0, 32, 96, 10, + CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE, ClrRed, ClrWhite, ClrWhite, g_psFontFixed6x8, + g_pcTime, 0, 0); + +char g_pcFormat[16] = ""; +Canvas(g_sWaveInfoSample, &g_sWaveInfoBackground, &g_sWaveInfoTime, 0, + &g_sCFAL96x64x16, 0, 22, 96, 10, + CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | + CANVAS_STYLE_TEXT_OPAQUE, ClrRed, ClrWhite, ClrWhite, g_psFontFixed6x8, + g_pcFormat, 0, 0); + +char g_pcFileName[16] = ""; +Canvas(g_sWaveInfoFileName, &g_sWaveInfoBackground, &g_sWaveInfoSample, 0, + &g_sCFAL96x64x16, 0, 12, 96, 10, + CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_OPAQUE, + ClrRed, ClrWhite, ClrWhite, g_psFontFixed6x8, + g_pcFileName, 0, 0); + +#define INITIAL_VOLUME_PERCENT 20 +uint32_t g_ui32CurrentVolume; + +//***************************************************************************** +// +// The canvas widget acting as the background for the wav file information. +// +//***************************************************************************** +Canvas(g_sWaveInfoBackground, WIDGET_ROOT, 0, + &g_sWaveInfoFileName, &g_sCFAL96x64x16, 0, 12, 96, 40, + CANVAS_STYLE_OUTLINE | CANVAS_STYLE_FILL, ClrBlack, ClrWhite, ClrWhite, + g_psFontFixed6x8, 0, 0, 0); + +//***************************************************************************** +// +// The status line. +// +//***************************************************************************** +#define STATUS_TEXT_SIZE 40 +char g_pcStatusText[STATUS_TEXT_SIZE] = ""; +Canvas(g_sStatus, WIDGET_ROOT, 0, 0, + &g_sCFAL96x64x16, 0, 64 - 12, 96, 12, + (CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT), + ClrDarkBlue, ClrWhite, ClrWhite, g_psFontFixed6x8, g_pcStatusText, 0, 0); + +//***************************************************************************** +// +// The heading containing the application title. +// +//***************************************************************************** +Canvas(g_sHeading, WIDGET_ROOT, 0, 0, + &g_sCFAL96x64x16, 0, 0, 96, 12, + (CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT), + ClrDarkBlue, ClrWhite, ClrWhite, g_psFontFixed6x8, "usb-host-audio", 0, 0); + +//***************************************************************************** +// +// State information for keep track of time. +// +//***************************************************************************** +static uint32_t g_ui32BytesPlayed; +static uint32_t g_ui32NextUpdate; + +//***************************************************************************** +// +// Globals used to track play back position. +// +//***************************************************************************** +static uint16_t g_ui16Minutes; +static uint16_t g_ui16Seconds; + +//***************************************************************************** +// +// Fill the audio buffer with data from the open file. +// +//***************************************************************************** +void +FillAudioBuffer(void) +{ + uint32_t ui32Count, ui32Size; + uint8_t *pui8Read; + + // + // If already full return. + // + if(g_ui32ValidBytes == g_ui32BufferSize) + { + return; + } + + // + // Snap shot the read pointer since it might change while we are filling + // the buffer. If the read pointer moved due to an interrupt we will + // get the update on the next call to this function. + // + pui8Read = g_pui8Read; + + // + // If write is ahead of read then fill to the end of the buffer if + // possible. + // + if(pui8Read <= g_pui8Write) + { + // + // Calculate the amount of space we have. + // + ui32Size = g_ui32BufferSize - + (uint32_t)(g_pui8Write - g_pui8AudioBuffer); + ui32Count = WavRead(&g_sWavFile, g_pui8Write, ui32Size); + + g_pui8Write += ui32Count; + g_ui32ValidBytes += ui32Count; + + if(g_pui8Write == (g_pui8AudioBuffer + g_ui32BufferSize)) + { + g_pui8Write = g_pui8AudioBuffer; + } + } + + // + // If read is now ahead of write then fill to the read pointer. + // + if(pui8Read > g_pui8Write) + { + // + // Calculate the amount of space we have. + // + ui32Size = (uint32_t)(pui8Read - g_pui8Write); + ui32Count = WavRead(&g_sWavFile, g_pui8Write, ui32Size); + + g_pui8Write += ui32Count; + g_ui32ValidBytes += ui32Count; + } +} + +//***************************************************************************** +// +// This function handles the callback from the USB audio device when a buffer +// has been played or a new buffer has been received. +// +//***************************************************************************** +static void +USBAudioOutCallback(void *pvBuffer, uint32_t ui32Event) +{ + // + // If a buffer has been played then schedule a new one to play. + // + if((ui32Event == USB_EVENT_TX_COMPLETE) && + (HWREGBITW(&g_ui32Flags, FLAGS_PLAYING))) + { + // + // Indicate that a transfer was complete so that the non-interrupt + // code can read in more data from the file. + // + HWREGBITW(&g_ui32Flags, FLAGS_TX_COMPLETE) = 1; + + // + // Increment the read pointer. + // + g_pui8Read += g_ui32TransferSize; + + // + // Remove the specified number of bytes from the buffer. + // + if(g_ui32ValidBytes > g_ui32TransferSize) + { + g_ui32ValidBytes -= g_ui32TransferSize; + } + else + { + g_ui32ValidBytes = 0; + } + + // + // Wrap the read pointer if necessary. + // + if(g_pui8Read >= (g_pui8AudioBuffer + g_ui32BufferSize)) + { + g_pui8Read = g_pui8AudioBuffer; + } + + // + // Increment the number of bytes that have been played. + // + g_ui32BytesPlayed += g_ui32TransferSize; + + // + // Schedule a new USB audio buffer to be transmitted to the USB + // audio device. + // + USBSoundBufferOut(g_pui8Read, g_ui32TransferSize, USBAudioOutCallback); + } +} + +//***************************************************************************** +// +// This function is used to update the current volume being using for play +// back. +// +//***************************************************************************** +static void +DisplayVolume(void) +{ + // + // Print the volume string in the format Volume dd% + // + usprintf(g_pcVolume, "Volume %0d%%", g_ui32CurrentVolume); + + // + // Display the updated time on the screen. + // + WidgetPaint((tWidget *)&g_sWaveInfoVolume); +} + +//***************************************************************************** +// +// This function is used to tell when to update the play back times for a file. +// It will only update the screen at 1 second intervals but can be called more +// often with no result. +// +//***************************************************************************** +static void +DisplayTime(uint32_t ui32ForceUpdate) +{ + uint32_t ui32Seconds; + uint32_t ui32Minutes; + + // + // Only display on the screen once per second. + // + if((g_ui32BytesPlayed >= g_ui32NextUpdate) || (ui32ForceUpdate != 0)) + { + // + // Set the next update time to one second later. + // + g_ui32NextUpdate = g_ui32BytesPlayed + g_sWavHeader.ui32AvgByteRate; + + // + // Calculate the integer number of minutes and seconds. + // + ui32Seconds = g_ui32BytesPlayed / g_sWavHeader.ui32AvgByteRate; + ui32Minutes = ui32Seconds / 60; + ui32Seconds -= ui32Minutes * 60; + + // + // Print the time string in the format mm.ss/mm.ss + // + usprintf(g_pcTime, "%2d:%02d/%d:%02d", ui32Minutes,ui32Seconds, + g_ui16Minutes, g_ui16Seconds); + + // + // Display the updated time on the screen. + // + WidgetPaint((tWidget *)&g_sWaveInfoTime); + } +} + +//***************************************************************************** +// +// This function will handle stopping the play back of audio. It will not do +// this immediately but will defer stopping audio at a later time. This allows +// this function to be called from an interrupt handler. +// +//***************************************************************************** +static void +WaveStop(void) +{ + uint32_t ui32Idx; + uint32_t *pui32Buffer; + + // + // Stop playing audio. + // + HWREGBITW(&g_ui32Flags, FLAGS_PLAYING) = 0; + + // + // Do unsigned long accesses to clear out the buffer. + // + pui32Buffer = (uint32_t *)g_pui8AudioBuffer; + + // + // Zero out the buffer. + // + for(ui32Idx = 0; ui32Idx < (AUDIO_BUFFER_SIZE >> 2); ui32Idx++) + { + pui32Buffer[ui32Idx] = 0; + } + + // + // Reset the number of bytes played and for a time update on the screen. + // + g_ui32BytesPlayed = 0; + DisplayTime(1); + + // + // Change the status text on the button to Stopped. + // + strcpy(g_pcStatusText, "Stopped"); + WidgetPaint((tWidget *)&g_sStatus); +} + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. FatFs requires a +// timer tick every 10ms for internal timing purposes. +// +//***************************************************************************** +void +SysTickHandler(void) +{ + // + // Increment the system tick count. + // + g_ui32SysTickCount++; + + // + // Call the FatFs tick timer. + // + disk_timerproc(); +} + +//***************************************************************************** +// +// This function returns the number of ticks since the last time this function +// was called. +// +//***************************************************************************** +static uint32_t +GetTickms(void) +{ + uint32_t ui32RetVal; + uint32_t ui32Saved; + + ui32RetVal = g_ui32SysTickCount; + ui32Saved = ui32RetVal; + + if(ui32Saved > g_ui32LastTick) + { + ui32RetVal = ui32Saved - g_ui32LastTick; + } + else + { + ui32RetVal = g_ui32LastTick - ui32Saved; + } + + // + // This could miss a few milliseconds but the timings here are on a + // much larger scale. + // + g_ui32LastTick = ui32Saved; + + // + // Return the number of milliseconds since the last time this was called. + // + return(ui32RetVal * MS_PER_SYSTICK); +} + +//***************************************************************************** +// +// This function returns a string representation of an error code +// that was returned from a function call to FatFs. It can be used +// for printing human readable error messages. +// +//***************************************************************************** +static const char * +StringFromFresult(FRESULT fresult) +{ + uint32_t ui32Idx; + + // + // Enter a loop to search the error code table for a matching + // error code. + // + for(ui32Idx = 0; ui32Idx < NUM_FRESULT_CODES; ui32Idx++) + { + // + // If a match is found, then return the string name of the + // error code. + // + if(g_sFresultStrings[ui32Idx].fresult == fresult) + { + return(g_sFresultStrings[ui32Idx].pcResultStr); + } + } + + // + // At this point no matching code was found, so return a + // string indicating unknown error. + // + return("UNKNOWN ERR"); +} + +//***************************************************************************** +// +// This function shows a status screen. It draws a banner at the top of the +// screen with the name of the application, and then up to 5 lines of text +// in the remaining screen area. The caller specifies a pointer to a set of +// strings, and the count of number of lines of text (up to 5). This +// function attempts to vertically center the strings on the display. +// +//***************************************************************************** +static void +ShowStatusScreen(char *pcStatus[], uint32_t ui32Count) +{ + tContext sContext; + tRectangle sRect; + uint32_t ui32Idx; + int32_t i32Y; + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the rest of the display with black, to clear whatever was there + // before. + // + sRect.i16XMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMin = 12; + sRect.i16YMax = 63 - 12; + GrContextForegroundSet(&sContext, ClrBlack); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Cap the max number of status lines to 4 + // + ui32Count = (ui32Count > 4) ? 4 : ui32Count; + + // + // Compute the starting Y coordinate based on the number of lines. + // + i32Y = 36 - (ui32Count * 5); + + // + // Display the status lines + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + for(ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++) + { + GrStringDrawCentered(&sContext, pcStatus[ui32Idx], -1, + GrContextDpyWidthGet(&sContext) / 2, i32Y, 0); + i32Y += 10; + } +} + +//***************************************************************************** +// +// Initializes the file system module. +// +// \param None. +// +// This function initializes the third party FAT implementation. +// +// \return Returns \e true on success or \e false on failure. +// +//***************************************************************************** +static bool +FileInit(void) +{ + // + // Mount the file system, using logical disk 0. + // + if(f_mount(0, &g_sFatFs) != FR_OK) + { + return(false); + } + return(true); +} + +//***************************************************************************** +// +// This function handled global level events for the USB host audio. This +// function was passed into the USBSoundInit() function. +// +//***************************************************************************** +static void +AudioEvent(uint32_t ui32Event, uint32_t ui32Param) +{ + switch(ui32Event) + { + case SOUND_EVENT_READY: + { + // + // Flag that a new audio device is present. + // + HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_CONNECT) = 1; + + // + // Change the text to reflect the change. + // + strcpy(g_pcStatusText, "Ready"); + WidgetPaint((tWidget *)&g_sStatus); + + break; + } + case SOUND_EVENT_DISCONNECT: + { + // + // Device is no longer present. + // + HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_READY) = 0; + HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_CONNECT) = 0; + HWREGBITW(&g_ui32Flags, FLAGS_PLAYING) = 0; + HWREGBITW(&g_ui32Flags, FLAGS_PLAY_SCREEN) = 0; + + // + // Change the text to reflect the change. + // + strcpy(g_pcStatusText, "No Device"); + WidgetPaint((tWidget *)&g_sStatus); + + // + // Display the SD card found message again. This + // should replace the slide menu. + // + g_pcStatusLines[0] = "SD Card Found"; + ShowStatusScreen(g_pcStatusLines, 1); + + break; + } + case SOUND_EVENT_UNKNOWN_DEV: + { + if(ui32Param == 1) + { + // + // Unknown device connected. + // + strcpy(g_pcStatusText, "Unknown Device"); + WidgetPaint((tWidget *)&g_sStatus); + } + else + { + // + // Unknown device disconnected. + // + strcpy(g_pcStatusText, "No Device"); + WidgetPaint((tWidget *)&g_sStatus); + } + + break; + } + default: + { + break; + } + } +} + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} + +#endif + +//***************************************************************************** +// +// This function is called to read the contents of the current directory from +// the USB stick and populate a set of menu items, one for each file in the +// directory. A subdirectory within the directory counts as a file item. +// +// This function returns the number of file items that were found, or 0 if +// there is any error detected. +// +//***************************************************************************** +static uint32_t +PopulateFileList(uint32_t ui32Level) +{ + uint32_t ui32ItemCount; + FRESULT fresult; + + // + // Open the current directory for access. + // + fresult = f_opendir(&g_sDirObject, g_pcCwdBuf); + + // + // Check for error and return if there is a problem. + // + if(fresult != FR_OK) + { + // + // Ensure that the error is reported. + // + g_pcStatusLines[0] = "Error from"; + g_pcStatusLines[1] = "SD Card"; + g_pcStatusLines[2] = (char *)StringFromFresult(fresult); + ShowStatusScreen(g_pcStatusLines, 3); + return(0); + } + + // + // Initialize the count of files in this directory + // + ui32ItemCount = 0; + + // + // Enter loop to enumerate through all directory entries. + // + for(;;) + { + // + // Read an entry from the directory. + // + fresult = f_readdir(&g_sDirObject, &g_sFileInfo); + + // + // Check for error and return if there is a problem. + // + if(fresult != FR_OK) + { + g_pcStatusLines[0] = "Error from"; + g_pcStatusLines[1] = "USB disk"; + g_pcStatusLines[2] = (char *)StringFromFresult(fresult); + ShowStatusScreen(g_pcStatusLines, 3); + return(0); + } + + // + // If the file name is blank, then this is the end of the + // listing. + // + if(!g_sFileInfo.fname[0]) + { + break; + } + + // + // Add the information to a menu item + // + if(ui32ItemCount < MAX_FILES_PER_MENU) + { + tSlideMenuItem *psMenuItem; + + // + // Get a pointer to the current menu item. Use the directory + // level to determine which of the two sets of menu items to use. + // (ui32Level & 1]. This lets us alternate between the current + // set of menu items and the new set (up or down the tree). + // + psMenuItem = &g_psFileMenuItems[ui32Level & 1][ui32ItemCount]; + + // + // Add the file name to the menu item + // + usnprintf(g_pcFileNames[ui32Level & 1][ui32ItemCount], + MAX_FILENAME_STRING_LEN, "%s", g_sFileInfo.fname); + psMenuItem->pcText = g_pcFileNames[ui32Level & 1][ui32ItemCount]; + + // + // If this is a directory, then add the next level menu so that + // when displayed it will be showed with a submenu option + // (next level down in directory tree). Otherwise it is a file + // so clear the child menu so that there is no submenu option + // shown. + // + psMenuItem->psChildMenu = (g_sFileInfo.fattrib & AM_DIR) ? + &g_psFileMenus[ui32Level + 1] : 0; + + // + // Move to the next entry in the item array we use to populate the + // list box. + // + ui32ItemCount++; + } + } + + // + // Made it to here, return the count of files that were populated. + // + return(ui32ItemCount); +} + +//***************************************************************************** +// +// This function is used to change to a new directory in the file system. +// It takes a parameter that specifies the directory to make the current +// working directory. +// Path separators must use a forward slash "/". The directory parameter +// can be one of the following: +// * root ("/") +// * a fully specified path ("/my/path/to/mydir") +// * a single directory name that is in the current directory ("mydir") +// * parent directory ("..") +// +// It does not understand relative paths, so dont try something like this: +// ("../my/new/path") +// +// Once the new directory is specified, it attempts to open the directory +// to make sure it exists. If the new path is opened successfully, then +// the current working directory (cwd) is changed to the new path. +// +// In cases of error, the pui32Reason parameter will be written with one of +// the following values: +// +// NAME_TOO_LONG_ERROR - combination of paths are too long for the buffer +// OPENDIR_ERROR - there is some problem opening the new directory +// +//***************************************************************************** +static FRESULT +ChangeToDirectory(char *pcDirectory, uint32_t *pui32Reason) +{ + uint32_t ui32Idx; + FRESULT fresult; + + // + // Copy the current working path into a temporary buffer so + // it can be manipulated. + // + strcpy(g_pcTmpBuf, g_pcCwdBuf); + + // + // If the first character is /, then this is a fully specified + // path, and it should just be used as-is. + // + if(pcDirectory[0] == '/') + { + // + // Make sure the new path is not bigger than the cwd buffer. + // + if(strlen(pcDirectory) + 1 > sizeof(g_pcCwdBuf)) + { + *pui32Reason = NAME_TOO_LONG_ERROR; + return(FR_OK); + } + + // + // If the new path name (in argv[1]) is not too long, then + // copy it into the temporary buffer so it can be checked. + // + else + { + strncpy(g_pcTmpBuf, pcDirectory, sizeof(g_pcTmpBuf)); + } + } + + // + // If the argument is .. then attempt to remove the lowest level + // on the CWD. + // + else if(!strcmp(pcDirectory, "..")) + { + // + // Get the index to the last character in the current path. + // + ui32Idx = strlen(g_pcTmpBuf) - 1; + + // + // Back up from the end of the path name until a separator (/) + // is found, or until we bump up to the start of the path. + // + while((g_pcTmpBuf[ui32Idx] != '/') && (ui32Idx > 1)) + { + // + // Back up one character. + // + ui32Idx--; + } + + // + // Now we are either at the lowest level separator in the + // current path, or at the beginning of the string (root). + // So set the new end of string here, effectively removing + // that last part of the path. + // + g_pcTmpBuf[ui32Idx] = 0; + } + + // + // Otherwise this is just a normal path name from the current + // directory, and it needs to be appended to the current path. + // + else + { + // + // Test to make sure that when the new additional path is + // added on to the current path, there is room in the buffer + // for the full new path. It needs to include a new separator, + // and a trailing null character. + // + if(strlen(g_pcTmpBuf) + strlen(pcDirectory) + 1 + 1 > sizeof(g_pcCwdBuf)) + { + *pui32Reason = NAME_TOO_LONG_ERROR; + return(FR_INVALID_OBJECT); + } + + // + // The new path is okay, so add the separator and then append + // the new directory to the path. + // + else + { + // + // If not already at the root level, then append a / + // + if(strcmp(g_pcTmpBuf, "/")) + { + strcat(g_pcTmpBuf, "/"); + } + + // + // Append the new directory to the path. + // + strcat(g_pcTmpBuf, pcDirectory); + } + } + + // + // At this point, a candidate new directory path is in g_pcTmpBuf. + // Try to open it to make sure it is valid. + // + fresult = f_opendir(&g_sDirObject, g_pcTmpBuf); + + // + // If it can't be opened, then it is a bad path. Return an error. + // + if(fresult != FR_OK) + { + *pui32Reason = OPENDIR_ERROR; + return(fresult); + } + + // + // Otherwise, it is a valid new path, so copy it into the CWD. + // + else + { + strncpy(g_pcCwdBuf, g_pcTmpBuf, sizeof(g_pcCwdBuf)); + } + + // + // Return success. + // + return(FR_OK); +} + +//***************************************************************************** +// +// Sends a button/key press message to the slide menu widget that is showing +// files. +// +//***************************************************************************** +static void +SendWidgetKeyMessage(uint32_t ui32Msg) +{ + WidgetMessageQueueAdd(WIDGET_ROOT, + ui32Msg, (uint32_t)&g_sFileMenuWidget, 0, 1, 1); +} + +//***************************************************************************** +// +// This function performs actions that are common whenever the directory +// level is changed up or down. It populates the correct menu structure with +// the list of files in the directory. +// +//***************************************************************************** +static bool +ProcessDirChange(char *pcDir, uint32_t ui32Level) +{ + FRESULT fresult; + uint32_t ui32Reason; + uint32_t ui32FileCount; + + // + // Attempt to change to the new directory. + // + fresult = ChangeToDirectory(pcDir, &ui32Reason); + + // + // If the directory change was successful, populate the + // list of files for the new subdirectory. + // + if((fresult == FR_OK) && (ui32Level < MAX_SUBDIR_DEPTH)) + { + // + // Get a pointer to the current menu for this CWD. + // + tSlideMenu *psMenu = &g_psFileMenus[ui32Level]; + + // + // Populate the menu items with the file list for the new CWD. + // + ui32FileCount = PopulateFileList(ui32Level); + + // + // Initialize the file menu with the list of menu items, + // which are just files and dirs in the root directory + // + psMenu->psSlideMenuItems = g_psFileMenuItems[ui32Level & 1]; + psMenu->ui32Items = ui32FileCount; + + // + // Set the parent directory, if there is one. If at level 0 + // (CWD is root), then there is no parent directory. + // + if(ui32Level) + { + psMenu->psParent = &g_psFileMenus[ui32Level - 1]; + } + else + { + psMenu->psParent = 0; + } + + // + // If we are descending into a new subdir, then initialize the other + // menu item fields to default values. + // + if(ui32Level > g_ui32Level) + { + psMenu->ui32CenterIndex = 0; + psMenu->ui32FocusIndex = 0; + psMenu->bMultiSelectable = 0; + } + + // + // Return a success indication + // + return(true); + } + + // + // Directory change was not successful + // + else + { + // + // Return failure indication + // + return(false); + } +} + +//***************************************************************************** +// +// The program main function. It performs initialization, then handles wav +// file playback. +// +//***************************************************************************** +int +main(void) +{ + uint32_t ui32Temp; + uint32_t ui32Retcode; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the system clock to run at 50MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Configure the required pins for USB operation. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Configure SysTick for a 100Hz interrupt. + // + ROM_SysTickPeriodSet(SysCtlClockGet() / TICKS_PER_SECOND); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Enable Interrupts + // + ROM_IntMasterEnable(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the buttons driver. + // + ButtonsInit(); + + // + // Initialize two offscreen displays and assign the palette. These + // buffers are used by the slide menu widget to allow animation effects. + // + GrOffScreen4BPPInit(&g_sOffscreenDisplayA, g_pui8OffscreenBufA, 96, 40); + GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayA, g_pui32Palette, 0, + NUM_PALETTE_ENTRIES); + GrOffScreen4BPPInit(&g_sOffscreenDisplayB, g_pui8OffscreenBufB, 96, 40); + GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayB, g_pui32Palette, 0, + NUM_PALETTE_ENTRIES); + + // + // Add the compile-time defined widgets to the widget tree. + // + WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sHeading); + WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sStatus); + WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sFileMenuWidget); + + // + // Initialize the status text. + // + strcpy(g_pcStatusText, "No Device"); + + // + // Issue the initial paint request to the widgets then immediately call + // the widget manager to process the paint message. This ensures that the + // display is drawn as quickly as possible and saves the delay we would + // otherwise experience if we processed the paint message after mounting + // and reading the SD card. + // + WidgetPaint(WIDGET_ROOT); + WidgetMessageQueueProcess(); + + // + // Determine whether or not an SD Card is installed. If not, print a + // warning and have the user install one and restart. + // + ui32Retcode = disk_initialize(0); + + if(ui32Retcode != RES_OK) + { + g_pcStatusLines[0] = "No SD Card Found"; + g_pcStatusLines[1] = "Please insert"; + g_pcStatusLines[2] = "a card and"; + g_pcStatusLines[3] = "reset the board."; + ShowStatusScreen(g_pcStatusLines, 4); + return (1); + } + else + { + g_pcStatusLines[0] = "SD Card Found"; + ShowStatusScreen(g_pcStatusLines, 1); + + // + // Mount the file system, using logical disk 0. + // + f_mount(0, &g_sFatFs); + if(!FileInit()) + { + return(1); + } + } + + // + // Not playing anything right now. + // + g_ui32Flags = 0; + g_ui32SysTickCount = 0; + g_ui32LastTick = 0; + g_ui32CurrentVolume = INITIAL_VOLUME_PERCENT; + + // + // Configure the USB host output. + // + USBSoundInit(0, AudioEvent); + + // + // Enter an (almost) infinite loop for reading and processing commands from + // the user. + // + while(1) + { + uint32_t ui32LastTickCount = 0; + + // + // On connect change the device state to ready. + // + if(HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_CONNECT)) + { + HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_CONNECT) = 0; + + // + // Getting here means the device is ready. + // Reset the CWD to the root directory. + // + g_pcCwdBuf[0] = '/'; + g_pcCwdBuf[1] = 0; + + // + // Set the initial directory level to the root + // + g_ui32Level = 0; + + // + // We need to reset the indexes of the root menu to 0, so that + // it will start at the top of the file list, and reset the + // slide menu widget to start with the root menu. + // + g_psFileMenus[g_ui32Level].ui32CenterIndex = 0; + g_psFileMenus[g_ui32Level].ui32FocusIndex = 0; + SlideMenuMenuSet(&g_sFileMenuWidget, &g_psFileMenus[g_ui32Level]); + + // + // Initiate a directory change to the root. This will + // populate a menu structure representing the root directory. + // + if(ProcessDirChange("/", g_ui32Level)) + { + // + // Request a repaint so the file menu will be shown + // + WidgetPaint(WIDGET_ROOT); + } + else + { + g_pcStatusLines[0] = "ERROR"; + g_pcStatusLines[1] = "Unable to change"; + g_pcStatusLines[2] = "directory."; + ShowStatusScreen(g_pcStatusLines, 3); + return(1); + } + + // + // Attempt to set the audio format to 44100 16 bit stereo by + // default otherwise try 48000 16 bit stereo. + // + if(USBSoundOutputFormatSet(44100, 16, 2) == 0) + { + ui32Temp = 44100; + } + else if(USBSoundOutputFormatSet(48000, 16, 2) == 0) + { + ui32Temp = 48000; + } + else + { + ui32Temp = 0; + } + + // + // If the audio device was support put the sample rate in the + // status line. + // + if(ui32Temp != 0) + { + // + // Calculate the number of bytes per USB frame. + // + g_ui32TransferSize = (ui32Temp * 4) / 1000; + + // + // Calculate the size of the audio buffer. + // + g_ui32BufferSize = AUDIO_BUFFERS * g_ui32TransferSize; + + // + // Print the time string in the format mm.ss/mm.ss + // + + if(ui32Temp == 44100) + { + usprintf(g_pcStatusText, "44.1 kHz Ready"); + } + else if(ui32Temp == 48000) + { + usprintf(g_pcStatusText, "48 kHz Ready"); + } + + HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_READY) = 1; + } + else + { + strcpy(g_pcStatusText, "Not Supported"); + return (1); + } + + // + // Set initial volume. + // + USBSoundVolumeSet(g_ui32CurrentVolume); + + // + // Update the status line. + // + WidgetPaint((tWidget *)&g_sStatus); + } + + // + // Process occurrence of timer tick. Check for user input + // once each tick. + // + if((g_ui32SysTickCount != ui32LastTickCount) && + HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_READY) && + (HWREGBITW(&g_ui32Flags, FLAGS_PLAY_SCREEN) == 0)) + { + uint8_t ui8ButtonState; + uint8_t ui8ButtonChanged; + + ui32LastTickCount = g_ui32SysTickCount; + + // + // Get the current debounced state of the buttons. + // + ui8ButtonState = ButtonsPoll(&ui8ButtonChanged, 0); + + // + // If select button or right button is pressed, then we + // are trying to descend into another directory + // + if(BUTTON_PRESSED(SELECT_BUTTON, + ui8ButtonState, ui8ButtonChanged) || + BUTTON_PRESSED(RIGHT_BUTTON, + ui8ButtonState, ui8ButtonChanged)) + { + uint32_t ui32NewLevel; + uint32_t ui32ItemIdx; + char *pcItemName; + + // + // Get a pointer to the current menu for this CWD. + // + tSlideMenu *psMenu = &g_psFileMenus[g_ui32Level]; + + // + // Get the highlighted index in the current file list. + // This is the currently highlighted file or dir + // on the display. Then get the name of the file at + // this index. + // + ui32ItemIdx = SlideMenuFocusItemGet(psMenu); + pcItemName = psMenu->psSlideMenuItems[ui32ItemIdx].pcText; + + // + // Make sure we are not yet past the maximum tree + // depth. + // + if(g_ui32Level < MAX_SUBDIR_DEPTH) + { + // + // Potential new level is one greater than the + // current level. + // + ui32NewLevel = g_ui32Level + 1; + + // + // Process the directory change to the new + // directory. This function will populate a menu + // structure with the files and subdirs in the new + // directory. + // + if(ProcessDirChange(pcItemName, ui32NewLevel)) + { + // + // If the change was successful, then update + // the level. + // + g_ui32Level = ui32NewLevel; + + // + // Now that all the prep is done, send the + // KEY_RIGHT message to the widget and it will + // "slide" from the previous file list to the + // new file list of the CWD. + // + SendWidgetKeyMessage(WIDGET_MSG_KEY_RIGHT); + + } + + // + // We have selected a file to play. Display + // the file information and if it is a valid + // wav file, allow playback. + // + else + { + + // + // Update the file name information. + // + strncpy(g_pcFileName, pcItemName, 16); + + if(WavOpen(g_pcFileName, &g_sWavFile) == 0) + { + // + // Read the .wav file format. + // + WavGetFormat(&g_sWavFile, &g_sWavHeader); + + // + // Print the formatted string so that it can be + // displayed. + // + usprintf(g_pcFormat, "%d Hz %d bit ", + g_sWavHeader.ui32SampleRate / 1000, + g_sWavHeader.ui16BitsPerSample); + + // + // Concatenate the number of channels. + // + if(g_sWavHeader.ui16NumChannels == 1) + { + strcat(g_pcFormat, "Mo"); + } + else + { + strcat(g_pcFormat, "St"); + } + + // + // Calculate the minutes and seconds in the file. + // + g_ui16Seconds = g_sWavHeader.ui32DataSize / + g_sWavHeader.ui32AvgByteRate; + g_ui16Minutes = g_ui16Seconds / 60; + g_ui16Seconds -= g_ui16Minutes * 60; + + // + // Close the file, it will be re-opened on play. + // + WavClose(&g_sWavFile); + + // + // Update the file time information. + // + DisplayTime(1); + + // + // Update the volume information + // + DisplayVolume(); + } + else + { + // + // Set the time and volume strings to null strings. + // + g_pcTime[0] = 0; + g_pcVolume[0] = 0; + + // + // Print message about invalid wav format + // + usprintf(g_pcFormat, "Invalid Wav"); + } + + // + // Update the file name line. + // + WidgetPaint((tWidget *)&g_sWaveInfoBackground); + + // + // Set a flag to change the button functions. + // + HWREGBITW(&g_ui32Flags, FLAGS_PLAY_SCREEN) = 1; + } + } + } + + // + // If the UP button is pressed, just pass it to the widget + // which will handle scrolling the list of files. + // + if(BUTTON_PRESSED(UP_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_UP); + } + + // + // If the DOWN button is pressed, just pass it to the widget + // which will handle scrolling the list of files. + // + if(BUTTON_PRESSED(DOWN_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_DOWN); + } + + // + // If the LEFT button is pressed, then we are attempting + // to go up a level in the file system. + // + if(BUTTON_PRESSED(LEFT_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + uint32_t ui32NewLevel; + + // + // Make sure we are not already at the top of the + // directory tree (at root). + // + if(g_ui32Level) + { + // + // Potential new level is one less than the + // current level. + // + ui32NewLevel = g_ui32Level - 1; + + // + // Process the directory change to the new + // directory. This function will populate a menu + // structure with the files and subdirs in the new + // directory. + // + if(ProcessDirChange("..", ui32NewLevel)) + { + // + // If the change was successful, then update + // the level. + // + g_ui32Level = ui32NewLevel; + + // + // Now that all the prep is done, send the + // KEY_LEFT message to the widget and it will + // "slide" from the previous file list to the + // new file list of the CWD. + // + SendWidgetKeyMessage(WIDGET_MSG_KEY_LEFT); + } + } + } + } + + // + // If we are in the play back screen, change the function of the + // buttons. + // + if((g_ui32SysTickCount != ui32LastTickCount) && + HWREGBITW(&g_ui32Flags, FLAGS_DEVICE_READY) && + (HWREGBITW(&g_ui32Flags, FLAGS_PLAY_SCREEN))) + { + uint8_t ui8ButtonState; + uint8_t ui8ButtonChanged; + + ui32LastTickCount = g_ui32SysTickCount; + + // + // Get the current debounced state of the buttons. + // + ui8ButtonState = ButtonsPoll(&ui8ButtonChanged, 0); + + // + // If the left button is pressed, we need to return to + // the file menu. + // + if(BUTTON_PRESSED(LEFT_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + // + // It is possible we have already started playback. + // + WaveStop(); + + // + // Redraw the menu over the play screen. + // + HWREGBITW(&g_ui32Flags, FLAGS_PLAY_SCREEN) = 0; + WidgetPaint(WIDGET_ROOT); + } + + // + // If the select or right button is pressed, we will + // start play back of the wav file. + // + if(BUTTON_PRESSED(SELECT_BUTTON, + ui8ButtonState, ui8ButtonChanged) || + BUTTON_PRESSED(RIGHT_BUTTON, + ui8ButtonState, ui8ButtonChanged)) + { + // + // If we are stopped, then start playing. + // + if(HWREGBITW(&g_ui32Flags, FLAGS_PLAYING) == 0) + { + HWREGBITW(&g_ui32Flags, FLAGS_PLAYING) = 1; + // + // Don't play anything but 16 bit audio since most USB + // devices do not support 8 bit formats. + // + if(g_sWavHeader.ui16BitsPerSample != 16) + { + return(1); + } + + // + // See if this is a valid .wav file that can be opened. + // + if(WavOpen(g_pcFileName, &g_sWavFile) == 0) + { + // + // Change the text on the button to playing. + // + strcpy(g_pcStatusText, "Playing"); + WidgetPaint((tWidget *)&g_sStatus); + + // + // Indicate that wave play back should start. + // + HWREGBITW(&g_ui32Flags, FLAGS_PLAYING) = 1; + } + else + { + HWREGBITW(&g_ui32Flags, FLAGS_PLAYING) = 0; + return(1); + } + + // + // Initialize the read and write pointers. + // + g_pui8Read = g_pui8AudioBuffer; + g_pui8Write = g_pui8AudioBuffer; + g_ui32ValidBytes = 0; + + // + // Fill the audio buffer from the file. + // + FillAudioBuffer(); + + // + // Start the audio playback. + // + USBSoundBufferOut(g_pui8Read, g_ui32TransferSize, + USBAudioOutCallback); + } + + // + // Stop play back if we are playing. + // + else + { + WaveStop(); + } + } + + // + // If the UP button is pressed, increase the volume by 5%. + // + if(BUTTON_PRESSED(UP_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + if(g_ui32CurrentVolume < 100) + { + g_ui32CurrentVolume += 5; + USBSoundVolumeSet(g_ui32CurrentVolume); + DisplayVolume(); + } + } + + // + // If the DOWN button is pressed, decrease the volume by 5%. + // + if(BUTTON_PRESSED(DOWN_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + if((g_ui32CurrentVolume <= 100) && (g_ui32CurrentVolume > 0)) + { + g_ui32CurrentVolume -= 5; + USBSoundVolumeSet(g_ui32CurrentVolume); + DisplayVolume(); + } + } + } + + // + // Handle the case when the wave file is playing. + // + if(HWREGBITW(&g_ui32Flags, FLAGS_PLAYING)) + { + // + // Handle the transmit complete event. + // + if(HWREGBITW(&g_ui32Flags, FLAGS_TX_COMPLETE)) + { + // + // Clear the transmit complete flag. + // + HWREGBITW(&g_ui32Flags, FLAGS_TX_COMPLETE) = 0; + + // + // If there is space available then fill the buffer. + // + FillAudioBuffer(); + + // + // If we run out of valid bytes then stop the playback. + // + if(g_ui32ValidBytes == 0) + { + // + // No more data or error so stop playing. + // + WaveStop(); + } + + // + // Update the real display time. + // + DisplayTime(0); + } + } + + // + // Need to periodically call the USBMain() routine so that + // non-interrupt gets a chance to run. + // + USBMain(GetTickms()); + + // + // Process any messages in the widget message queue. + // + WidgetMessageQueueProcess(); + } +} + diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewd b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewp b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewp new file mode 100644 index 0000000..3394ff6 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ewp @@ -0,0 +1,820 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\buttons.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\src\ff.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + + + $PROJ_DIR$\..\drivers\slidemenuwidget.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\usb_host_audio.c + + + $PROJ_DIR$\..\drivers\usb_sound.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + $PROJ_DIR$\..\..\..\..\utils\wavfile.c + + + diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.icf b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.icf new file mode 100644 index 0000000..f668415 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_host_audio.icf - Linker configuration file for usb_host_audio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ld b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ld new file mode 100644 index 0000000..28a44ca --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_host_audio.ld - Linker configuration file for usb_host_audio. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.sct b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.sct new file mode 100644 index 0000000..4071bfc --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_host_audio.sct - Linker configuration file for usb_host_audio. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvopt b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvopt new file mode 100644 index 0000000..859e739 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvopt @@ -0,0 +1,429 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_host_audio + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\buttons.c + buttons.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\src\ff.c + ff.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + mmc-ek-lm4f232.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\slidemenuwidget.c + slidemenuwidget.c + + + 1 + 6 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 7 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_host_audio.c + usb_host_audio.c + + + 1 + 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\usb_sound.c + usb_sound.c + + + 1 + 9 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + 1 + 10 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\wavfile.c + wavfile.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 11 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 12 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 13 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 14 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvproj b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvproj new file mode 100644 index 0000000..bfe740f --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio.uvproj @@ -0,0 +1,474 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_host_audio + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_host_audio + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_host_audio.bin .\rvmdk\usb_host_audio.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..;..\..\..\..\third_party;..\..\..\..\utils; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_host_audio.sct + + + --entry Reset_Handler + + + + + + + + Source + + + buttons.c + 1 + ..\drivers\buttons.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + ff.c + 1 + ..\..\..\..\third_party\fatfs\src\ff.c + + + mmc-ek-lm4f232.c + 1 + ..\..\..\..\third_party\fatfs\port\mmc-ek-lm4f232.c + + + slidemenuwidget.c + 1 + ..\drivers\slidemenuwidget.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + usb_host_audio.c + 1 + .\usb_host_audio.c + + + usb_sound.c + 1 + ..\drivers\usb_sound.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + wavfile.c + 1 + ..\..\..\..\utils\wavfile.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_audio/usb_host_audio_ccs.cmd b/boards/ek-lm4f232/usb_host_audio/usb_host_audio_ccs.cmd new file mode 100644 index 0000000..5419fd5 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_audio/usb_host_audio_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_host_audio_ccs.cmd - CCS linker configuration file for usb_host_audio. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 2048; diff --git a/boards/ek-lm4f232/usb_host_keyboard/Makefile b/boards/ek-lm4f232/usb_host_keyboard/Makefile new file mode 100644 index 0000000..7aa4ee0 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/Makefile @@ -0,0 +1,90 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB host keyboard example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the USB host keyboard example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_host_keyboard.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB host keyboard example. +# +${COMPILER}/usb_host_keyboard.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_host_keyboard.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_host_keyboard.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_host_keyboard.axf: ${COMPILER}/usb_host_keyboard.o +${COMPILER}/usb_host_keyboard.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_host_keyboard.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_host_keyboard.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_host_keyboard.axf: usb_host_keyboard.ld +SCATTERgcc_usb_host_keyboard=usb_host_keyboard.ld +ENTRY_usb_host_keyboard=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsimportspec new file mode 100644 index 0000000..daa301e --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsproject b/boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/.cproject b/boards/ek-lm4f232/usb_host_keyboard/ccs/.cproject new file mode 100644 index 0000000..9348458 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/ccs/.cproject @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/.project b/boards/ek-lm4f232/usb_host_keyboard/ccs/.project new file mode 100644 index 0000000..c41f744 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/ccs/.project @@ -0,0 +1,60 @@ + + + usb_host_keyboard + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_keyboard/startup_ccs.c + + + usb_host_keyboard.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.c + + + usb_host_keyboard_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard_ccs.cmd + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_host_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.bin b/boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.bin new file mode 100644 index 0000000..d369fd1 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.out b/boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.out new file mode 100644 index 0000000..564400d Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/ccs/Debug/usb_host_keyboard.out differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_host_keyboard/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_host_keyboard/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_host_keyboard/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.bin b/boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.bin new file mode 100644 index 0000000..497d42b Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.out b/boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.out new file mode 100644 index 0000000..8c52e92 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/ewarm/Exe/usb_host_keyboard.out differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.axf b/boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.axf new file mode 100644 index 0000000..ec1b6dd Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.axf differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.bin b/boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.bin new file mode 100644 index 0000000..46bdb39 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/gcc/usb_host_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/readme.txt b/boards/ek-lm4f232/usb_host_keyboard/readme.txt new file mode 100644 index 0000000..a2a8af9 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/readme.txt @@ -0,0 +1,30 @@ +USB HID Keyboard Host + +This example application demonstrates how to support a USB keyboard +attached to the evaluation kit board. The display will show if a keyboard +is currently connected and the current state of the Caps Lock key on the +keyboard that is connected on the bottom status area of the screen. +Pressing any keys on the keyboard will cause them to be printed on the +screen and to be sent out the UART at 115200 baud with no parity, 8 bits +and 1 stop bit. Any keyboard that supports the USB HID BIOS protocol +should work with this demo application. + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.axf b/boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.axf new file mode 100644 index 0000000..50100a9 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.axf differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.bin b/boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.bin new file mode 100644 index 0000000..4a4b124 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_keyboard/rvmdk/usb_host_keyboard.bin differ diff --git a/boards/ek-lm4f232/usb_host_keyboard/startup_ccs.c b/boards/ek-lm4f232/usb_host_keyboard/startup_ccs.c new file mode 100644 index 0000000..5dfcc4e --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/startup_ccs.c @@ -0,0 +1,303 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_keyboard/startup_ewarm.c b/boards/ek-lm4f232/usb_host_keyboard/startup_ewarm.c new file mode 100644 index 0000000..9fc3087 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/startup_ewarm.c @@ -0,0 +1,334 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_keyboard/startup_gcc.c b/boards/ek-lm4f232/usb_host_keyboard/startup_gcc.c new file mode 100644 index 0000000..fc4e734 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/startup_gcc.c @@ -0,0 +1,350 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_keyboard/startup_rvmdk.S b/boards/ek-lm4f232/usb_host_keyboard/startup_rvmdk.S new file mode 100644 index 0000000..679bc9b --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickIntHandler + EXTERN USB0OTGModeIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickIntHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0OTGModeIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.c b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.c new file mode 100644 index 0000000..9c0ffca --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.c @@ -0,0 +1,1143 @@ +//***************************************************************************** +// +// usb_host_keyboard.c - main application code for the host keyboard example. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/pin_map.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/rom.h" +#include "driverlib/uart.h" +#include "grlib/grlib.h" +#include "usblib/usblib.h" +#include "usblib/usbhid.h" +#include "usblib/host/usbhost.h" +#include "usblib/host/usbhhid.h" +#include "usblib/host/usbhhidkeyboard.h" +#include "utils/uartstdio.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB HID Keyboard Host (usb_host_keyboard)

+//! +//! This example application demonstrates how to support a USB keyboard +//! attached to the evaluation kit board. The display will show if a keyboard +//! is currently connected and the current state of the Caps Lock key on the +//! keyboard that is connected on the bottom status area of the screen. +//! Pressing any keys on the keyboard will cause them to be printed on the +//! screen and to be sent out the UART at 115200 baud with no parity, 8 bits +//! and 1 stop bit. Any keyboard that supports the USB HID BIOS protocol +//! should work with this demo application. +// +//***************************************************************************** + +//***************************************************************************** +// +// The ASCII code for a backspace character. +// +//***************************************************************************** +#define ASCII_BACKSPACE 0x08 + +//***************************************************************************** +// +// The size of the host controller's memory pool in bytes. +// +//***************************************************************************** +#define HCD_MEMORY_SIZE 128 + +//***************************************************************************** +// +// The memory pool to provide to the Host controller driver. +// +//***************************************************************************** +uint8_t g_pui8HCDPool[HCD_MEMORY_SIZE]; + +//***************************************************************************** +// +// The size of the keyboard device interface's memory pool in bytes. +// +//***************************************************************************** +#define KEYBOARD_MEMORY_SIZE 128 + +//***************************************************************************** +// +// The memory pool to provide to the keyboard device. +// +//***************************************************************************** +uint8_t g_pui8Buffer[KEYBOARD_MEMORY_SIZE]; + +//***************************************************************************** +// +// Declare the USB Events driver interface. +// +//***************************************************************************** +DECLARE_EVENT_DRIVER(g_sUSBEventDriver, 0, 0, USBHCDEvents); + +//***************************************************************************** +// +// The global that holds all of the host drivers in use in the application. +// In this case, only the Keyboard class is loaded. +// +//***************************************************************************** +static tUSBHostClassDriver const * const g_ppHostClassDrivers[] = +{ + &g_sUSBHIDClassDriver, + &g_sUSBEventDriver +}; + +//***************************************************************************** +// +// This global holds the number of class drivers in the g_ppHostClassDrivers +// list. +// +//***************************************************************************** +static const uint32_t g_ui32NumHostClassDrivers = + sizeof(g_ppHostClassDrivers) / sizeof(tUSBHostClassDriver *); + +//***************************************************************************** +// +// The number of SysTick ticks per second. +// +//***************************************************************************** +#define TICKS_PER_SECOND 100 +#define MS_PER_SYSTICK (1000 / TICKS_PER_SECOND) + +//***************************************************************************** +// +// Our running system tick counter and a global used to determine the time +// elapsed since last call to GetTickms(). +// +//***************************************************************************** +uint32_t g_ui32SysTickCount; +uint32_t g_ui32LastTick; + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// The global value used to store the keyboard instance value. +// +//***************************************************************************** +static tUSBHKeyboard *g_psKeyboardInstance; + +//***************************************************************************** +// +// This enumerated type is used to hold the states of the keyboard. +// +//***************************************************************************** +enum +{ + // + // No device is present. + // + STATE_NO_DEVICE, + + // + // Keyboard has been detected and needs to be initialized in the main + // loop. + // + STATE_KEYBOARD_INIT, + + // + // Keyboard is connected and waiting for events. + // + STATE_KEYBOARD_CONNECTED, + + // + // Keyboard has received a key press that requires updating the keyboard + // in the main loop. + // + STATE_KEYBOARD_UPDATE, + + // + // An unsupported device has been attached. + // + STATE_UNKNOWN_DEVICE, + + // + // A power fault has occurred. + // + STATE_POWER_FAULT +} +g_eUSBState; + +extern const tHIDKeyboardUsageTable g_sUSKeyboardMap; + +//***************************************************************************** +// +// The current USB operating mode - Host, Device or unknown. +// +//***************************************************************************** +tUSBMode g_eCurrentUSBMode; + +//***************************************************************************** +// +// These defines are used to define the screen constraints to the application. +// +//***************************************************************************** +#define DISPLAY_BANNER_HEIGHT 10 +#define DISPLAY_BANNER_BG ClrDarkBlue +#define DISPLAY_TEXT_BORDER 2 +#define DISPLAY_TEXT_FG ClrWhite +#define DISPLAY_TEXT_BG ClrBlack + +//***************************************************************************** +// +// This variable holds the current status of the modifiers keys. +// +//***************************************************************************** +uint32_t g_ui32Modifiers = 0; + +//***************************************************************************** +// +// This is the number of characters that will fit on a line in the text area. +// +//***************************************************************************** +uint32_t g_ui32CharsPerLine; + +//***************************************************************************** +// +// This is the number of lines that will fit in the text area. +// +//***************************************************************************** +uint32_t g_ui32LinesPerScreen; + +//***************************************************************************** +// +// This is the current line for printing in the text area. +// +//***************************************************************************** +uint32_t g_ui32Line = 0; + +//***************************************************************************** +// +// This is the current column for printing in the text area. +// +//***************************************************************************** +uint32_t g_ui32Column = 0; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. +// +//***************************************************************************** +void +SysTickIntHandler(void) +{ + // + // Update our tick counter. + // + g_ui32SysTickCount++; +} + +//***************************************************************************** +// +// This function prints the character out the UART and into the text area of +// the screen. +// +// \param cChar is the character to print out. +// +// This function handles all of the detail of printing a character to both the +// UART and to the text area of the screen on the evaluation board. The text +// area of the screen will be cleared any time the text goes beyond the end +// of the text area. +// +// \return None. +// +//***************************************************************************** +void +PrintChar(const char cChar) +{ + tRectangle sRect; + + // + // If both the line and column have gone to zero then clear the screen. + // + if((g_ui32Line == 0) && (g_ui32Column == 0)) + { + // + // Form the rectangle that makes up the text box. + // + sRect.i16XMin = 0; + sRect.i16YMin = (2 * DISPLAY_BANNER_HEIGHT) + DISPLAY_TEXT_BORDER; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - DISPLAY_TEXT_BORDER; + sRect.i16YMax = GrContextDpyHeightGet(&g_sContext) - + DISPLAY_BANNER_HEIGHT - DISPLAY_TEXT_BORDER; + + // + // Change the foreground color to black and draw black rectangle to + // clear the screen. + // + GrContextForegroundSet(&g_sContext, DISPLAY_TEXT_BG); + GrRectFill(&g_sContext, &sRect); + + // + // Reset the foreground color to the text color. + // + GrContextForegroundSet(&g_sContext, DISPLAY_TEXT_FG); + } + + // + // Send the character to the UART. + // + UARTprintf("%c", cChar); + + // + // Allow new lines to cause the column to go back to zero. + // + if(cChar != '\n') + { + // + // Did we get a backspace character? + // + if(cChar != ASCII_BACKSPACE) + { + // + // This is not a backspace so print the character to the screen. + // + GrStringDraw(&g_sContext, &cChar, 1, + GrFontMaxWidthGet(g_psFontFixed6x8) * g_ui32Column, + (2 * DISPLAY_BANNER_HEIGHT) + DISPLAY_TEXT_BORDER + + (g_ui32Line * GrFontHeightGet(g_psFontFixed6x8)), 0); + } + else + { + // + // We got a backspace. If we are at the top left of the screen, + // return since we don't need to do anything. + // + if(g_ui32Column || g_ui32Line) + { + // + // Adjust the cursor position to erase the last character. + // + if(g_ui32Column) + { + g_ui32Column--; + } + else + { + g_ui32Column = g_ui32CharsPerLine; + g_ui32Line--; + } + + // + // Print a space at this position then return without fixing up + // the cursor again. + // + GrStringDraw(&g_sContext, " ", 1, + GrFontMaxWidthGet(g_psFontFixed6x8) * g_ui32Column, + (2 * DISPLAY_BANNER_HEIGHT) + DISPLAY_TEXT_BORDER + + (g_ui32Line * GrFontHeightGet(g_psFontFixed6x8)), + true); + } + return; + } + } + else + { + // + // This will allow the code below to properly handle the new line. + // + g_ui32Column = g_ui32CharsPerLine; + } + + // + // Update the text row and column that the next character will use. + // + if(g_ui32Column < g_ui32CharsPerLine) + { + // + // No line wrap yet so move one column over. + // + g_ui32Column++; + } + else + { + // + // Line wrapped so go back to the first column and update the line. + // + g_ui32Column = 0; + g_ui32Line++; + + // + // The line has gone past the end so go back to the first line. + // + if(g_ui32Line >= g_ui32LinesPerScreen) + { + g_ui32Line = 0; + } + } +} + +//***************************************************************************** +// +// This function updates the status area of the screen. It uses the current +// state of the application to print the status bar. +// +//***************************************************************************** +void +UpdateStatus(void) +{ + tRectangle sRect; + + // + // Fill the bottom rows of the screen with blue to create the status area. + // + sRect.i16XMin = 0; + sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - + DISPLAY_BANNER_HEIGHT - 1; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT; + + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); + GrRectFill(&g_sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + GrRectDraw(&g_sContext, &sRect); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + + // + // Update the status on the screen. + // + if(g_eUSBState == STATE_NO_DEVICE) + { + // + // Keyboard is currently disconnected. + // + GrStringDrawCentered(&g_sContext, "no device", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + } + else if(g_eUSBState == STATE_UNKNOWN_DEVICE) + { + // + // Unknown device is currently connected. + // + GrStringDrawCentered(&g_sContext, "unknown device", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + } + else if(g_eUSBState == STATE_POWER_FAULT) + { + // + // Something caused a power fault. + // + GrStringDrawCentered(&g_sContext, "power fault", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + } + else if((g_eUSBState == STATE_KEYBOARD_CONNECTED) || + (g_eUSBState == STATE_KEYBOARD_UPDATE)) + { + // + // Keyboard is connected. + // + GrStringDrawCentered(&g_sContext, "connected", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + + // + // Update the CAPS Lock status. + // + if(g_ui32Modifiers & HID_KEYB_CAPS_LOCK) + { + GrStringDrawCentered(&g_sContext, "C", + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16XMax - 10, + sRect.i16YMin + 5, 0); + } + } +} + +//***************************************************************************** +// +// This is the generic callback from host stack. +// +// pvData is actually a pointer to a tEventInfo structure. +// +// This function will be called to inform the application when a USB event has +// occurred that is outside those related to the keyboard device. At this +// point this is used to detect unsupported devices being inserted and removed. +// It is also used to inform the application when a power fault has occurred. +// This function is required when the g_USBGenericEventDriver is included in +// the host controller driver array that is passed in to the +// USBHCDRegisterDrivers() function. +// +//***************************************************************************** +void +USBHCDEvents(void *pvData) +{ + tEventInfo *pEventInfo; + + // + // Cast this pointer to its actual type. + // + pEventInfo = (tEventInfo *)pvData; + + switch(pEventInfo->ui32Event) + { + // + // New keyboard detected. + // + case USB_EVENT_CONNECTED: + { + // + // See if this is a HID Keyboard. + // + if((USBHCDDevClass(pEventInfo->ui32Instance, 0) == USB_CLASS_HID) && + (USBHCDDevProtocol(pEventInfo->ui32Instance, 0) == + USB_HID_PROTOCOL_KEYB)) + { + // + // Indicate that the keyboard has been detected. + // + UARTprintf("Keyboard Connected\n"); + + // + // Proceed to the STATE_KEYBOARD_INIT state so that the main + // loop can finish initialized the mouse since + // USBHKeyboardInit() cannot be called from within a callback. + // + g_eUSBState = STATE_KEYBOARD_INIT; + } + + break; + } + // + // Unsupported device detected. + // + case USB_EVENT_UNKNOWN_CONNECTED: + { + UARTprintf("Unsupported Device Class (0x%02x) Connected.\n", + pEventInfo->ui32Instance); + + // + // An unknown device was detected. + // + g_eUSBState = STATE_UNKNOWN_DEVICE; + + UpdateStatus(); + + break; + } + // + // Device has been unplugged. + // + case USB_EVENT_DISCONNECTED: + { + // + // Indicate that the device has been disconnected. + // + UARTprintf("Device Disconnected\n"); + + // + // Change the state so that the main loop knows that the device + // is no longer present. + // + g_eUSBState = STATE_NO_DEVICE; + + // + // Update the screen. + // + UpdateStatus(); + + break; + } + // + // Power Fault occurred. + // + case USB_EVENT_POWER_FAULT: + { + UARTprintf("Power Fault\n"); + + // + // No power means no device is present. + // + g_eUSBState = STATE_POWER_FAULT; + + UpdateStatus(); + + break; + } + default: + { + break; + } + } +} + +//***************************************************************************** +// +// USB Mode callback +// +// \param ui32Index is the zero-based index of the USB controller making the +// callback. +// \param eMode indicates the new operating mode. +// +// This function is called by the USB library whenever an OTG mode change +// occurs and, if a connection has been made, informs us of whether we are to +// operate as a host or device. +// +// \return None. +// +//***************************************************************************** +void +ModeCallback(uint32_t ui32Index, tUSBMode eMode) +{ + // + // Save the new mode. + // + g_eCurrentUSBMode = eMode; + + switch(eMode) + { + case eUSBModeHost: + { + UARTprintf("\nHost Mode.\n"); + break; + } + case eUSBModeDevice: + { + UARTprintf("\nDevice Mode.\n"); + break; + } + case eUSBModeNone: + { + UARTprintf("\nIdle Mode.\n"); + break; + } + default: + { + UARTprintf("ERROR: Bad Mode!\n"); + break; + } + } +} + +//***************************************************************************** +// +// This is the callback from the USB HID keyboard handler. +// +// \param psKbInstance is ignored by this function. +// \param ui32Event is one of the valid events for a keyboard device. +// \param ui32MsgParam is defined by the event that occurs. +// \param pvMsgData is a pointer to data that is defined by the event that +// occurs. +// +// This function will be called to inform the application when a keyboard has +// been plugged in or removed and any time a key is pressed or released. +// +// \return None. +// +//***************************************************************************** +void +KeyboardCallback(tUSBHKeyboard *psKbInstance, uint32_t ui32Event, + uint32_t ui32MsgParam, void *pvMsgData) +{ + char cChar; + + switch(ui32Event) + { + // + // New Key press detected. + // + case USBH_EVENT_HID_KB_PRESS: + { + // + // If this was a Caps Lock key then update the Caps Lock state. + // + if(ui32MsgParam == HID_KEYB_USAGE_CAPSLOCK) + { + // + // The main loop needs to update the keyboard's Caps Lock + // state. + // + g_eUSBState = STATE_KEYBOARD_UPDATE; + + // + // Toggle the current Caps Lock state. + // + g_ui32Modifiers ^= HID_KEYB_CAPS_LOCK; + + // + // Update the screen based on the Caps Lock status. + // + UpdateStatus(); + } + else if(ui32MsgParam == HID_KEYB_USAGE_SCROLLOCK) + { + // + // The main loop needs to update the keyboard's Scroll Lock + // state. + // + g_eUSBState = STATE_KEYBOARD_UPDATE; + + // + // Toggle the current Scroll Lock state. + // + g_ui32Modifiers ^= HID_KEYB_SCROLL_LOCK; + } + else if(ui32MsgParam == HID_KEYB_USAGE_NUMLOCK) + { + // + // The main loop needs to update the keyboard's Scroll Lock + // state. + // + g_eUSBState = STATE_KEYBOARD_UPDATE; + + // + // Toggle the current Num Lock state. + // + g_ui32Modifiers ^= HID_KEYB_NUM_LOCK; + } + else + { + // + // Was this the backspace key? + // + if((uint8_t)ui32MsgParam == HID_KEYB_USAGE_BACKSPACE) + { + // + // Yes - set the ASCII code for a backspace key. This is + // not returned by USBHKeyboardUsageToChar since this only + // returns printable characters. + // + cChar = ASCII_BACKSPACE; + } + else + { + // + // This is not backspace so try to map the usage code to a + // printable ASCII character. + // + cChar = (char) + USBHKeyboardUsageToChar(g_psKeyboardInstance, + &g_sUSKeyboardMap, + (uint8_t)ui32MsgParam); + } + + // + // A zero value indicates there was no textual mapping of this + // usage code. + // + if(cChar != 0) + { + PrintChar(cChar); + } + } + break; + } + case USBH_EVENT_HID_KB_MOD: + { + // + // This application ignores the state of the shift or control + // and other special keys. + // + break; + } + case USBH_EVENT_HID_KB_REL: + { + // + // This applications ignores the release of keys as well. + // + break; + } + } +} + +//***************************************************************************** +// +// This function returns the number of ticks since the last time this function +// was called. +// +//***************************************************************************** +uint32_t +GetTickms(void) +{ + uint32_t ui32RetVal; + uint32_t ui32Saved; + + ui32RetVal = g_ui32SysTickCount; + ui32Saved = ui32RetVal; + + if(ui32Saved > g_ui32LastTick) + { + ui32RetVal = ui32Saved - g_ui32LastTick; + } + else + { + ui32RetVal = g_ui32LastTick - ui32Saved; + } + + // + // This could miss a few milliseconds but the timings here are on a + // much larger scale. + // + g_ui32LastTick = ui32Saved; + + // + // Return the number of milliseconds since the last time this was called. + // + return(ui32RetVal * MS_PER_SYSTICK); +} + +//***************************************************************************** +// +// Configure the UART and its pins. This must be called before UARTprintf(). +// +//***************************************************************************** +void +ConfigureUART(void) +{ + // + // Enable the GPIO Peripheral used by the UART. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Enable UART0 + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Configure GPIO Pins for UART mode. + // + ROM_GPIOPinConfigure(GPIO_PA0_U0RX); + ROM_GPIOPinConfigure(GPIO_PA1_U0TX); + ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Use the internal 16MHz oscillator as the UART clock source. + // + UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); + + // + // Initialize the UART for console I/O. + // + UARTStdioConfig(0, 115200, 16000000); +} + +//***************************************************************************** +// +// This is the main loop that runs the application. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + tUSBMode eLastMode; + char *pcString; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the system clock to run at 50MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initially wait for device connection. + // + g_eUSBState = STATE_NO_DEVICE; + eLastMode = eUSBModeOTG; + g_eCurrentUSBMode = eUSBModeOTG; + + // + // Enable Clocking to the USB controller. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); + + // + // Configure the required pins for USB operation. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Configure SysTick for a 100Hz interrupt. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Enable Interrupts + // + ROM_IntMasterEnable(); + + // + // Configure UART0 for debug output. + // + ConfigureUART(); + + // + // Initialize the USB stack mode and pass in a mode callback. + // + USBStackModeSet(0, eUSBModeOTG, ModeCallback); + + // + // Register the host class drivers. + // + USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); + + // + // Open an instance of the keyboard driver. The keyboard does not need + // to be present at this time, this just save a place for it and allows + // the applications to be notified when a keyboard is present. + // + g_psKeyboardInstance = USBHKeyboardOpen(KeyboardCallback, g_pui8Buffer, + KEYBOARD_MEMORY_SIZE); + + // + // Initialize the power configuration. This sets the power enable signal + // to be active high and does not enable the power fault. + // + USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); + + // + // Initialize the USB controller for OTG operation with a 2ms polling + // rate. + // + USBOTGModeInit(0, 2000, g_pui8HCDPool, HCD_MEMORY_SIZE); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = (2 * DISPLAY_BANNER_HEIGHT) - 1; + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, DISPLAY_TEXT_FG); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "usb-host-", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + GrStringDrawCentered(&g_sContext, "keyboard", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 14, 0); + + + // + // Calculate the number of characters that will fit on a line. + // Make sure to leave a small border for the text box. + // + g_ui32CharsPerLine = (GrContextDpyWidthGet(&g_sContext) - 4) / + GrFontMaxWidthGet(g_psFontFixed6x8); + + // + // Calculate the number of lines per usable text screen. This requires + // taking off space for the top and bottom banners and adding a small bit + // for a border. + // + g_ui32LinesPerScreen = (GrContextDpyHeightGet(&g_sContext) - + (3*(DISPLAY_BANNER_HEIGHT + 1)))/ + GrFontHeightGet(g_psFontFixed6x8); + + // + // Open and instance of the keyboard class driver. + // + UARTprintf("Host Keyboard Application\n"); + + // + // Initial update of the screen. + // + UpdateStatus(); + + // + // The main loop for the application. + // + while(1) + { + // + // Tell the OTG library code how much time has passed in + // milliseconds since the last call. + // + USBOTGMain(GetTickms()); + + // + // Has the USB mode changed since last time we checked? + // + if(g_eCurrentUSBMode != eLastMode) + { + // + // Remember the new mode. + // + eLastMode = g_eCurrentUSBMode; + + switch(eLastMode) + { + case eUSBModeHost: + pcString = "HOST"; + break; + + case eUSBModeDevice: + pcString = "DEVICE"; + break; + + case eUSBModeNone: + pcString = "NONE"; + break; + + default: + pcString = "UNKNOWN"; + break; + } + + UARTprintf("USB mode changed to %s\n", pcString); + } + + switch(g_eUSBState) + { + // + // This state is entered when they keyboard is first detected. + // + case STATE_KEYBOARD_INIT: + { + // + // Initialized the newly connected keyboard. + // + USBHKeyboardInit(g_psKeyboardInstance); + + // + // Proceed to the keyboard connected state. + // + g_eUSBState = STATE_KEYBOARD_CONNECTED; + + // + // Update the screen now that the keyboard has been + // initialized. + // + UpdateStatus(); + + USBHKeyboardModifierSet(g_psKeyboardInstance, g_ui32Modifiers); + + break; + } + case STATE_KEYBOARD_UPDATE: + { + // + // If the application detected a change that required an + // update to be sent to the keyboard to change the modifier + // state then call it and return to the connected state. + // + g_eUSBState = STATE_KEYBOARD_CONNECTED; + + USBHKeyboardModifierSet(g_psKeyboardInstance, g_ui32Modifiers); + + break; + } + case STATE_KEYBOARD_CONNECTED: + { + // + // Nothing is currently done in the main loop when the keyboard + // is connected. + // + break; + } + + case STATE_UNKNOWN_DEVICE: + { + // + // Nothing to do as the device is unknown. + // + break; + } + + case STATE_NO_DEVICE: + { + // + // Nothing is currently done in the main loop when the keyboard + // is not connected. + // + break; + } + default: + { + break; + } + } + } +} diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewd b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewp b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewp new file mode 100644 index 0000000..1502b89 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ewp @@ -0,0 +1,798 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_host_keyboard.c + + + diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.icf b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.icf new file mode 100644 index 0000000..502cc1b --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_host_keyboard.icf - Linker configuration file for usb_host_keyboard. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ld b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ld new file mode 100644 index 0000000..cf67207 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_host_keyboard.ld - Linker configuration file for usb_host_keyboard. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.sct b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.sct new file mode 100644 index 0000000..ad0c39b --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_host_keyboard.sct - Linker configuration file for usb_host_keyboard. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvopt b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvopt new file mode 100644 index 0000000..9487f5d --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvopt @@ -0,0 +1,345 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_host_keyboard + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_host_keyboard.c + usb_host_keyboard.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 8 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvproj b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvproj new file mode 100644 index 0000000..6746b89 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard.uvproj @@ -0,0 +1,444 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_host_keyboard + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_host_keyboard + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_host_keyboard.bin .\rvmdk\usb_host_keyboard.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_host_keyboard.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_host_keyboard.c + 1 + .\usb_host_keyboard.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard_ccs.cmd b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard_ccs.cmd new file mode 100644 index 0000000..23775c7 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_keyboard/usb_host_keyboard_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_host_keyboard_ccs.cmd - CCS linker configuration file for usb_host_keyboard. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/usb_host_mouse/Makefile b/boards/ek-lm4f232/usb_host_mouse/Makefile new file mode 100644 index 0000000..f67d0a0 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/Makefile @@ -0,0 +1,91 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB host mouse example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=../ +IPATH+=../../../.. + +# +# The default rule, which causes the USB host mouse example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_host_mouse.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB host mouse example. +# +${COMPILER}/usb_host_mouse.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_host_mouse.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_host_mouse.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_host_mouse.axf: ${COMPILER}/usb_host_mouse.o +${COMPILER}/usb_host_mouse.axf: ${COMPILER}/ustdlib.o +${COMPILER}/usb_host_mouse.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_host_mouse.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_host_mouse.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_host_mouse.axf: usb_host_mouse.ld +SCATTERgcc_usb_host_mouse=usb_host_mouse.ld +ENTRY_usb_host_mouse=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_host_mouse/ccs/.ccsimportspec new file mode 100644 index 0000000..fab5ea4 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/.ccsproject b/boards/ek-lm4f232/usb_host_mouse/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/.cproject b/boards/ek-lm4f232/usb_host_mouse/ccs/.cproject new file mode 100644 index 0000000..1510fab --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/ccs/.cproject @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/.project b/boards/ek-lm4f232/usb_host_mouse/ccs/.project new file mode 100644 index 0000000..efed34e --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/ccs/.project @@ -0,0 +1,65 @@ + + + usb_host_mouse + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_mouse/startup_ccs.c + + + usb_host_mouse.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.c + + + usb_host_mouse_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse_ccs.cmd + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_host_mouse/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.bin b/boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.bin new file mode 100644 index 0000000..76dfa0b Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.bin differ diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.out b/boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.out new file mode 100644 index 0000000..8763904 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/ccs/Debug/usb_host_mouse.out differ diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_host_mouse/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_host_mouse/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_host_mouse/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.bin b/boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.bin new file mode 100644 index 0000000..268c5d3 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.bin differ diff --git a/boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.out b/boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.out new file mode 100644 index 0000000..b38334c Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/ewarm/Exe/usb_host_mouse.out differ diff --git a/boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.axf b/boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.axf new file mode 100644 index 0000000..beae157 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.axf differ diff --git a/boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.bin b/boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.bin new file mode 100644 index 0000000..75ead31 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/gcc/usb_host_mouse.bin differ diff --git a/boards/ek-lm4f232/usb_host_mouse/readme.txt b/boards/ek-lm4f232/usb_host_mouse/readme.txt new file mode 100644 index 0000000..c6194c4 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/readme.txt @@ -0,0 +1,25 @@ +USB HID Mouse Host + +This application demonstrates the handling of a USB mouse attached to the +evaluation kit. Once attached, the position of the mouse pointer and the +state of the mouse buttons are output to the display. + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.axf b/boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.axf new file mode 100644 index 0000000..546a9d3 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.axf differ diff --git a/boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.bin b/boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.bin new file mode 100644 index 0000000..194c1be Binary files /dev/null and b/boards/ek-lm4f232/usb_host_mouse/rvmdk/usb_host_mouse.bin differ diff --git a/boards/ek-lm4f232/usb_host_mouse/startup_ccs.c b/boards/ek-lm4f232/usb_host_mouse/startup_ccs.c new file mode 100644 index 0000000..5dfcc4e --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/startup_ccs.c @@ -0,0 +1,303 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_mouse/startup_ewarm.c b/boards/ek-lm4f232/usb_host_mouse/startup_ewarm.c new file mode 100644 index 0000000..9fc3087 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/startup_ewarm.c @@ -0,0 +1,334 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_mouse/startup_gcc.c b/boards/ek-lm4f232/usb_host_mouse/startup_gcc.c new file mode 100644 index 0000000..fc4e734 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/startup_gcc.c @@ -0,0 +1,350 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickIntHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickIntHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_mouse/startup_rvmdk.S b/boards/ek-lm4f232/usb_host_mouse/startup_rvmdk.S new file mode 100644 index 0000000..679bc9b --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickIntHandler + EXTERN USB0OTGModeIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickIntHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0OTGModeIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.c b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.c new file mode 100644 index 0000000..8ef61ef --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.c @@ -0,0 +1,803 @@ +//***************************************************************************** +// +// usb_host_mouse.c - main application code for the host mouse example. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom.h" +#include "driverlib/sysctl.h" +#include "usblib/usblib.h" +#include "usblib/usbhid.h" +#include "grlib/grlib.h" +#include "usblib/host/usbhost.h" +#include "usblib/host/usbhhid.h" +#include "usblib/host/usbhhidmouse.h" +#include "utils/ustdlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB HID Mouse Host (usb_host_mouse)

+//! +//! This application demonstrates the handling of a USB mouse attached to the +//! evaluation kit. Once attached, the position of the mouse pointer and the +//! state of the mouse buttons are output to the display. +// +//***************************************************************************** + +//***************************************************************************** +// +// The number of SysTick ticks per second. +// +//***************************************************************************** +#define TICKS_PER_SECOND 100 +#define MS_PER_SYSTICK (1000 / TICKS_PER_SECOND) + +//***************************************************************************** +// +// Graphics context used to show text on the CSTN display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// Our running system tick counter and a global used to determine the time +// elapsed since last call to GetTickms(). +// +//***************************************************************************** +uint32_t g_ui32SysTickCount; +uint32_t g_ui32LastTick; + +//***************************************************************************** +// +// The size of the host controller's memory pool in bytes. +// +//***************************************************************************** +#define HCD_MEMORY_SIZE 128 + +//***************************************************************************** +// +// The memory pool to provide to the Host controller driver. +// +//***************************************************************************** +uint8_t g_pui8HCDPool[HCD_MEMORY_SIZE]; + +//***************************************************************************** +// +// The size of the mouse device interface's memory pool in bytes. +// +//***************************************************************************** +#define MOUSE_MEMORY_SIZE 128 + +//***************************************************************************** +// +// These defines are used to define the screen constraints to the application. +// +//***************************************************************************** +#define DISPLAY_BANNER_HEIGHT 10 +#define DISPLAY_BANNER_BG ClrDarkBlue +#define DISPLAY_TEXT_BORDER 2 +#define DISPLAY_TEXT_FG ClrWhite +#define DISPLAY_TEXT_BG ClrBlack + +//***************************************************************************** +// +// The memory pool to provide to the mouse device. +// +//***************************************************************************** +uint8_t g_pui8Buffer[MOUSE_MEMORY_SIZE]; + +//***************************************************************************** +// +// Declare the USB Events driver interface. +// +//***************************************************************************** +DECLARE_EVENT_DRIVER(g_sUSBEventDriver, 0, 0, USBHCDEvents); + +//***************************************************************************** +// +// The global that holds all of the host drivers in use in the application. +// In this case, only the Mouse class is loaded. +// +//***************************************************************************** +static tUSBHostClassDriver const * const g_ppHostClassDrivers[] = +{ + &g_sUSBHIDClassDriver, + &g_sUSBEventDriver +}; + +//***************************************************************************** +// +// This global holds the number of class drivers in the g_ppHostClassDrivers +// list. +// +//***************************************************************************** +static const uint32_t g_ui32NumHostClassDrivers = + sizeof(g_ppHostClassDrivers) / sizeof(tUSBHostClassDriver *); + +//***************************************************************************** +// +// The global value used to store the mouse instance value. +// +//***************************************************************************** +static tUSBHMouse *g_psMouseInstance; + +//***************************************************************************** +// +// The global values used to store the mouse state. +// +//***************************************************************************** +static uint32_t g_ui32Buttons; +static int32_t g_i32CursorX; +static int32_t g_i32CursorY; + +//***************************************************************************** +// +// The current USB operating mode - Host, Device or unknown. +// +//***************************************************************************** +tUSBMode g_eCurrentUSBMode; + +//***************************************************************************** +// +// This enumerated type is used to hold the states of the mouse. +// +//***************************************************************************** +enum +{ + // + // No device is present. + // + STATE_NO_DEVICE, + + // + // Mouse has been detected and needs to be initialized in the main + // loop. + // + STATE_MOUSE_INIT, + + // + // Mouse is connected and waiting for events. + // + STATE_MOUSE_CONNECTED, + + // + // An unsupported device has been attached. + // + STATE_UNKNOWN_DEVICE, + + // + // A power fault has occured. + // + STATE_POWER_FAULT +} +g_eUSBState; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// This is the generic callback from host stack. +// +// pvData is actually a pointer to a tEventInfo structure. +// +// This function will be called to inform the application when a USB event has +// occurred that is outside those related to the mouse device. At this +// point this is used to detect unsupported devices being inserted and removed. +// It is also used to inform the application when a power fault has occurred. +// This function is required when the g_USBGenericEventDriver is included in +// the host controller driver array that is passed in to the +// USBHCDRegisterDrivers() function. +// +//***************************************************************************** +void +USBHCDEvents(void *pvData) +{ + tEventInfo *pEventInfo; + tRectangle sRect; + + // + // Fill the bottom rows of the screen with blue to create the status area. + // + sRect.i16XMin = 0; + sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - + DISPLAY_BANNER_HEIGHT - 1; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT; + + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); + GrRectFill(&g_sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + GrRectDraw(&g_sContext, &sRect); + + // + // Set the font for the status message + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + + // + // Cast this pointer to its actual type. + // + pEventInfo = (tEventInfo *)pvData; + + switch(pEventInfo->ui32Event) + { + // + // New mouse detected. + // + case USB_EVENT_CONNECTED: + { + // + // See if this is a HID Mouse. + // + if((USBHCDDevClass(pEventInfo->ui32Instance, 0) == USB_CLASS_HID) && + (USBHCDDevProtocol(pEventInfo->ui32Instance, 0) == + USB_HID_PROTOCOL_MOUSE)) + { + // + // Indicate that the mouse has been detected. + // + GrStringDrawCentered(&g_sContext, "Mouse Connected", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + + // + // Set initial mouse information. + // + GrStringDrawCentered(&g_sContext, "0,0", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 26, 1); + GrStringDrawCentered(&g_sContext, "000", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 46, 1); + + // + // Proceed to the STATE_MOUSE_INIT state so that the main loop + // can finish initialized the mouse since USBHMouseInit() + // cannot be called from within a callback. + // + g_eUSBState = STATE_MOUSE_INIT; + } + + break; + } + // + // Unsupported device detected. + // + case USB_EVENT_UNKNOWN_CONNECTED: + { + GrStringDrawCentered(&g_sContext, "Unknown Device", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + // + // An unknown device was detected. + // + g_eUSBState = STATE_UNKNOWN_DEVICE; + + break; + } + // + // Device has been unplugged. + // + case USB_EVENT_DISCONNECTED: + { + // + // Indicate that the device has been disconnected. + // + GrStringDrawCentered(&g_sContext, "No Device", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + + // + // Reset the mouse information. + // + GrStringDrawCentered(&g_sContext, " -,- ", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 26, 1); + GrStringDrawCentered(&g_sContext, "---", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 46, 1); + + // + // Change the state so that the main loop knows that the device is + // no longer present. + // + g_eUSBState = STATE_NO_DEVICE; + + // + // Reset the button state. + // + g_ui32Buttons = 0; + + break; + } + // + // Power Fault has occurred. + // + case USB_EVENT_POWER_FAULT: + { + // + // Indicate that there has been a power fault. + // + GrStringDrawCentered(&g_sContext, "Power Fault", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + + // + // Reset the mouse information. + // + GrStringDrawCentered(&g_sContext, " -,- ", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 26, 1); + GrStringDrawCentered(&g_sContext, "---", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 46, 1); + + // + // No power means no device is present. + // + g_eUSBState = STATE_POWER_FAULT; + + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. +// +//***************************************************************************** +void +SysTickIntHandler(void) +{ + // + // Update our tick counter. + // + g_ui32SysTickCount++; +} + +//***************************************************************************** +// +// This function returns the number of ticks since the last time this function +// was called. +// +//***************************************************************************** +uint32_t +GetTickms(void) +{ + uint32_t ui32RetVal; + uint32_t ui32Saved; + + ui32RetVal = g_ui32SysTickCount; + ui32Saved = ui32RetVal; + + if(ui32Saved > g_ui32LastTick) + { + ui32RetVal = ui32Saved - g_ui32LastTick; + } + else + { + ui32RetVal = g_ui32LastTick - ui32Saved; + } + + // + // This could miss a few milliseconds but the timings here are on a + // much larger scale. + // + g_ui32LastTick = ui32Saved; + + // + // Return the number of milliseconds since the last time this was called. + // + return(ui32RetVal * MS_PER_SYSTICK); +} + +//***************************************************************************** +// +// USB Mode callback +// +// \param ui32Index is the zero-based index of the USB controller making the +// callback. +// \param eMode indicates the new operating mode. +// +// This function is called by the USB library whenever an OTG mode change +// occurs and, if a connection has been made, informs us of whether we are to +// operate as a host or device. +// +// \return None. +// +//***************************************************************************** +void +ModeCallback(uint32_t ui32Index, tUSBMode eMode) +{ + // + // Save the new mode. + // + g_eCurrentUSBMode = eMode; +} + +//***************************************************************************** +// +// This is the callback from the USB HID mouse handler. +// +// \param psMsInstance is ignored by this function. +// \param ui32Event is one of the valid events for a mouse device. +// \param ui32MsgParam is defined by the event that occurs. +// \param pvMsgData is a pointer to data that is defined by the event that +// occurs. +// +// This function will be called to inform the application when a mouse has +// been plugged in or removed and any time mouse movement or button pressed +// is detected. +// +// \return None. +// +//***************************************************************************** +void +MouseCallback(tUSBHMouse *psMsInstance, uint32_t ui32Event, + uint32_t ui32MsgParam, void *pvMsgData) +{ + int32_t i32DoUpdate; + char pcBuffer[20]; + + // + // Do an update unless there is no reason to. + // + i32DoUpdate = 1; + + switch(ui32Event) + { + // + // Mouse button press detected. + // + case USBH_EVENT_HID_MS_PRESS: + { + // + // Save the new button that was pressed. + // + g_ui32Buttons |= ui32MsgParam; + + break; + } + + // + // Mouse button release detected. + // + case USBH_EVENT_HID_MS_REL: + { + // + // Remove the button from the pressed state. + // + g_ui32Buttons &= ~ui32MsgParam; + + break; + } + + // + // Mouse X movement detected. + // + case USBH_EVENT_HID_MS_X: + { + // + // Update the cursor X position. + // + g_i32CursorX += (int8_t)ui32MsgParam; + + // + // Cap the value to not cause an overflow. + // + if(g_i32CursorX > 9999) + { + g_i32CursorX = 9999; + } + + if(g_i32CursorX < -9999) + { + g_i32CursorX = -9999; + } + + break; + } + + // + // Mouse Y movement detected. + // + case USBH_EVENT_HID_MS_Y: + { + // + // Update the cursor Y position. + // + g_i32CursorY += (int8_t)ui32MsgParam; + + // + // Cap the value to not cause an overflow. + // + if(g_i32CursorY > 9999) + { + g_i32CursorY = 9999; + } + + if(g_i32CursorY < -9999) + { + g_i32CursorY = -9999; + } + + break; + } + default: + { + // + // No reason to update. + // + i32DoUpdate = 0; + + break; + } + } + + // + // Display the current mouse position and button state if there was an + // update. + // + if(i32DoUpdate) + { + GrStringDrawCentered(&g_sContext, "Position:", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 16, 0); + usprintf(pcBuffer, " %d,%d ", g_i32CursorX, g_i32CursorY); + GrStringDrawCentered(&g_sContext, pcBuffer, -1, + GrContextDpyWidthGet(&g_sContext) / 2, 26, 1); + GrStringDrawCentered(&g_sContext, "Buttons:", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 36, 0); + usprintf(pcBuffer, "%d%d%d", g_ui32Buttons & 1, (g_ui32Buttons & 2) >> 1, + (g_ui32Buttons & 4) >> 2); + GrStringDrawCentered(&g_sContext, pcBuffer, -1, + GrContextDpyWidthGet(&g_sContext) / 2, 46, 1); + } +} + +//***************************************************************************** +// +// This is the main loop that runs the application. +// +//***************************************************************************** +int +main(void) +{ + tRectangle sRect; + + // + // Set the clocking to run from the PLL at 50MHz. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = (DISPLAY_BANNER_HEIGHT) - 1; + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, DISPLAY_TEXT_FG); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "usb-host-mouse", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 4, 0); + + // + // Display default information about the mouse + // + GrStringDrawCentered(&g_sContext, "Position:", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 16, 0); + GrStringDrawCentered(&g_sContext, "-,-", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 26, 1); + GrStringDrawCentered(&g_sContext, "Buttons:", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 36, 0); + GrStringDrawCentered(&g_sContext, "---", -1, + GrContextDpyWidthGet(&g_sContext) / 2, 46, 1); + + // + // Fill the bottom rows of the screen with blue to create the status area. + // + sRect.i16XMin = 0; + sRect.i16YMin = GrContextDpyHeightGet(&g_sContext) - + DISPLAY_BANNER_HEIGHT - 1; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = sRect.i16YMin + DISPLAY_BANNER_HEIGHT; + + GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); + GrRectFill(&g_sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + GrRectDraw(&g_sContext, &sRect); + + // + // Print a no device message a placeholder for the message printed + // during an event. + // + GrStringDrawCentered(&g_sContext, "No Device", -1, + GrContextDpyWidthGet(&g_sContext) / 2, + sRect.i16YMin + 5, 0); + + // + // Configure SysTick for a 100Hz interrupt. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Enable Clocking to the USB controller. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); + + // + // Configure the required pins for USB operation. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Initially wait for device connection. + // + g_eUSBState = STATE_NO_DEVICE; + + // + // Initialize the USB stack mode and pass in a mode callback. + // + USBStackModeSet(0, eUSBModeOTG, ModeCallback); + + // + // Register the host class drivers. + // + USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); + + // + // Initialized the cursor. + // + g_ui32Buttons = 0; + g_i32CursorX = 0; + g_i32CursorY = 0; + + // + // Open an instance of the mouse driver. The mouse does not need + // to be present at this time, this just saves a place for it and allows + // the applications to be notified when a mouse is present. + // + g_psMouseInstance = + USBHMouseOpen(MouseCallback, g_pui8Buffer, MOUSE_MEMORY_SIZE); + + // + // Initialize the power configuration. This sets the power enable signal + // to be active high and does not enable the power fault. + // + USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); + + // + // Initialize the USB controller for OTG operation with a 2ms polling + // rate. + // + USBOTGModeInit(0, 2000, g_pui8HCDPool, HCD_MEMORY_SIZE); + + // + // The main loop for the application. + // + while(1) + { + // + // Tell the OTG state machine how much time has passed in + // milliseconds since the last call. + // + USBOTGMain(GetTickms()); + + switch(g_eUSBState) + { + // + // This state is entered when the mouse is first detected. + // + case STATE_MOUSE_INIT: + { + // + // Initialize the newly connected mouse. + // + USBHMouseInit(g_psMouseInstance); + + // + // Proceed to the mouse connected state. + // + g_eUSBState = STATE_MOUSE_CONNECTED; + + break; + } + + case STATE_MOUSE_CONNECTED: + { + // + // Nothing is currently done in the main loop when the mouse + // is connected. + // + break; + } + + case STATE_NO_DEVICE: + { + // + // The mouse is not connected so nothing needs to be done here. + // + break; + } + + default: + { + break; + } + } + } +} diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewd b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewp b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewp new file mode 100644 index 0000000..90a929a --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ewp @@ -0,0 +1,801 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_host_mouse.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.icf b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.icf new file mode 100644 index 0000000..9a53879 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_host_mouse.icf - Linker configuration file for usb_host_mouse. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ld b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ld new file mode 100644 index 0000000..100f187 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_host_mouse.ld - Linker configuration file for usb_host_mouse. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.sct b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.sct new file mode 100644 index 0000000..f00d4fa --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_host_mouse.sct - Linker configuration file for usb_host_mouse. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvopt b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvopt new file mode 100644 index 0000000..0f0fa7b --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvopt @@ -0,0 +1,359 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_host_mouse + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_host_mouse.c + usb_host_mouse.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 7 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 8 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 9 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvproj b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvproj new file mode 100644 index 0000000..c2a1d91 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse.uvproj @@ -0,0 +1,449 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_host_mouse + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_host_mouse + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_host_mouse.bin .\rvmdk\usb_host_mouse.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..\;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_host_mouse.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_host_mouse.c + 1 + .\usb_host_mouse.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse_ccs.cmd b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse_ccs.cmd new file mode 100644 index 0000000..6090768 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_mouse/usb_host_mouse_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_host_mouse_ccs.cmd - CCS linker configuration file for usb_host_mouse. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/usb_host_msc/Makefile b/boards/ek-lm4f232/usb_host_msc/Makefile new file mode 100644 index 0000000..db3fb3b --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/Makefile @@ -0,0 +1,98 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB host mass storage example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers +VPATH+=../../../../third_party/fatfs/port +VPATH+=../../../../third_party/fatfs/src +VPATH+=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. +IPATH+=../../../../third_party + +# +# The default rule, which causes the USB host mass storage example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_host_msc.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB host mass storage example. +# +${COMPILER}/usb_host_msc.axf: ${COMPILER}/buttons.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/fat_usbmsc.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/ff.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/slidemenuwidget.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/uartstdio.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/usb_host_msc.o +${COMPILER}/usb_host_msc.axf: ${COMPILER}/ustdlib.o +${COMPILER}/usb_host_msc.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_host_msc.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_host_msc.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_host_msc.axf: usb_host_msc.ld +SCATTERgcc_usb_host_msc=usb_host_msc.ld +ENTRY_usb_host_msc=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_host_msc/ccs/.ccsimportspec new file mode 100644 index 0000000..252e9bb --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/.ccsproject b/boards/ek-lm4f232/usb_host_msc/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/.cproject b/boards/ek-lm4f232/usb_host_msc/ccs/.cproject new file mode 100644 index 0000000..14b0357 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/ccs/.cproject @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/.project b/boards/ek-lm4f232/usb_host_msc/ccs/.project new file mode 100644 index 0000000..b2c50c4 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/ccs/.project @@ -0,0 +1,85 @@ + + + usb_host_msc + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_msc/startup_ccs.c + + + usb_host_msc.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_msc/usb_host_msc.c + + + usb_host_msc_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_host_msc/usb_host_msc_ccs.cmd + + + drivers/buttons.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/buttons.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + drivers/slidemenuwidget.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/slidemenuwidget.c + + + utils/uartstdio.c + 1 + SW_ROOT/utils/uartstdio.c + + + utils/ustdlib.c + 1 + SW_ROOT/utils/ustdlib.c + + + third_party/fatfs/port/fat_usbmsc.c + 1 + SW_ROOT/third_party/fatfs/port/fat_usbmsc.c + + + third_party/fatfs/src/ff.c + 1 + SW_ROOT/third_party/fatfs/src/ff.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.bin b/boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.bin new file mode 100644 index 0000000..21027db Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.bin differ diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.out b/boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.out new file mode 100644 index 0000000..4163025 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/ccs/Debug/usb_host_msc.out differ diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_host_msc/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_host_msc/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_host_msc/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.bin b/boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.bin new file mode 100644 index 0000000..55e182d Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.bin differ diff --git a/boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.out b/boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.out new file mode 100644 index 0000000..3930fd5 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/ewarm/Exe/usb_host_msc.out differ diff --git a/boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.axf b/boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.axf new file mode 100644 index 0000000..55bb898 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.axf differ diff --git a/boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.bin b/boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.bin new file mode 100644 index 0000000..132a5c9 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/gcc/usb_host_msc.bin differ diff --git a/boards/ek-lm4f232/usb_host_msc/readme.txt b/boards/ek-lm4f232/usb_host_msc/readme.txt new file mode 100644 index 0000000..2d6d871 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/readme.txt @@ -0,0 +1,29 @@ +USB Mass Storage Class Host Example + +This example application demonstrates reading a file system from +a USB flash disk. It makes use of FatFs, a FAT file system driver. It +provides a simple widget-based display for showing and navigating the file +system on a USB stick. + +For additional details about FatFs, see the following site: +http://elm-chan.org/fsw/ff/00index_e.html + +------------------------------------------------------------------------------- + +Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.axf b/boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.axf new file mode 100644 index 0000000..17ed001 Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.axf differ diff --git a/boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.bin b/boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.bin new file mode 100644 index 0000000..b3ebbca Binary files /dev/null and b/boards/ek-lm4f232/usb_host_msc/rvmdk/usb_host_msc.bin differ diff --git a/boards/ek-lm4f232/usb_host_msc/startup_ccs.c b/boards/ek-lm4f232/usb_host_msc/startup_ccs.c new file mode 100644 index 0000000..1298b8a --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/startup_ccs.c @@ -0,0 +1,303 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_msc/startup_ewarm.c b/boards/ek-lm4f232/usb_host_msc/startup_ewarm.c new file mode 100644 index 0000000..24b9e87 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/startup_ewarm.c @@ -0,0 +1,334 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[512] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_msc/startup_gcc.c b/boards/ek-lm4f232/usb_host_msc/startup_gcc.c new file mode 100644 index 0000000..ab9b746 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/startup_gcc.c @@ -0,0 +1,350 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void SysTickHandler(void); +extern void USB0OTGModeIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[512]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + SysTickHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0OTGModeIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_host_msc/startup_rvmdk.S b/boards/ek-lm4f232/usb_host_msc/startup_rvmdk.S new file mode 100644 index 0000000..41abc68 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000800 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN SysTickHandler + EXTERN USB0OTGModeIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD SysTickHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0OTGModeIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.c b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.c new file mode 100644 index 0000000..50858a5 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.c @@ -0,0 +1,1549 @@ +//***************************************************************************** +// +// usb_host_msc.c - Example program for reading files from a USB flash drive. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/systick.h" +#include "driverlib/udma.h" +#include "driverlib/rom.h" +#include "driverlib/pin_map.h" +#include "grlib/grlib.h" +#include "grlib/widget.h" +#include "utils/ustdlib.h" +#include "usblib/usblib.h" +#include "usblib/usbmsc.h" +#include "usblib/host/usbhost.h" +#include "usblib/host/usbhmsc.h" +#include "third_party/fatfs/src/ff.h" +#include "third_party/fatfs/src/diskio.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/buttons.h" +#include "drivers/slidemenuwidget.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB Mass Storage Class Host Example (usb_host_msc)

+//! +//! This example application demonstrates reading a file system from +//! a USB flash disk. It makes use of FatFs, a FAT file system driver. It +//! provides a simple widget-based display for showing and navigating the file +//! system on a USB stick. +//! +//! For additional details about FatFs, see the following site: +//! http://elm-chan.org/fsw/ff/00index_e.html +// +//***************************************************************************** + +//***************************************************************************** +// +// Defines the number of times to call to check if the attached device is +// ready. +// +//***************************************************************************** +#define USBMSC_DRIVE_RETRY 4 + +//***************************************************************************** +// +// The following are data structures used by FatFs. +// +//***************************************************************************** +static FATFS g_sFatFs; +static DIR g_sDirObject; +static FILINFO g_sFileInfo; + +//***************************************************************************** +// +// A structure that holds a mapping between an FRESULT numerical code, +// and a string representation. FRESULT codes are returned from the FatFs +// FAT file system driver. +// +//***************************************************************************** +typedef struct +{ + FRESULT fresult; + char *pcResultStr; +} +tFresultString; + +//***************************************************************************** +// +// A macro to make it easy to add result codes to the table. +// +//***************************************************************************** +#define FRESULT_ENTRY(f) { (f), (#f) } + +//***************************************************************************** +// +// A table that holds a mapping between the numerical FRESULT code and +// it's name as a string. This is used for looking up error codes and +// providing a human-readable string. +// +//***************************************************************************** +tFresultString g_sFresultStrings[] = +{ + FRESULT_ENTRY(FR_OK), + FRESULT_ENTRY(FR_DISK_ERR), + FRESULT_ENTRY(FR_INT_ERR), + FRESULT_ENTRY(FR_NOT_READY), + FRESULT_ENTRY(FR_NO_FILE), + FRESULT_ENTRY(FR_NO_PATH), + FRESULT_ENTRY(FR_INVALID_NAME), + FRESULT_ENTRY(FR_DENIED), + FRESULT_ENTRY(FR_EXIST), + FRESULT_ENTRY(FR_INVALID_OBJECT), + FRESULT_ENTRY(FR_WRITE_PROTECTED), + FRESULT_ENTRY(FR_INVALID_DRIVE), + FRESULT_ENTRY(FR_NOT_ENABLED), + FRESULT_ENTRY(FR_NO_FILESYSTEM), + FRESULT_ENTRY(FR_MKFS_ABORTED), + FRESULT_ENTRY(FR_TIMEOUT), + FRESULT_ENTRY(FR_LOCKED), + FRESULT_ENTRY(FR_NOT_ENOUGH_CORE), + FRESULT_ENTRY(FR_TOO_MANY_OPEN_FILES), + FRESULT_ENTRY(FR_INVALID_PARAMETER), +}; + +//***************************************************************************** +// +// A macro that holds the number of result codes. +// +//***************************************************************************** +#define NUM_FRESULT_CODES (sizeof(g_sFresultStrings) / sizeof(tFresultString)) + +//***************************************************************************** +// +// Error reasons returned by ChangeToDirectory(). +// +//***************************************************************************** +#define NAME_TOO_LONG_ERROR 1 +#define OPENDIR_ERROR 2 + +//***************************************************************************** +// +// The number of SysTick ticks per second. +// +//***************************************************************************** +#define TICKS_PER_SECOND 100 +#define MS_PER_SYSTICK (1000 / TICKS_PER_SECOND) + +//***************************************************************************** +// +// A counter for system clock ticks, used for simple timing. +// +//***************************************************************************** +static uint32_t g_ui32SysTickCount; + +//***************************************************************************** +// +// Holds global flags for the system. +// +//***************************************************************************** +static uint32_t g_ui32Flags = 0; + +//***************************************************************************** +// +// Flag indicating that some USB device is connected. +// +//***************************************************************************** +#define FLAGS_DEVICE_PRESENT 0x00000001 + +//***************************************************************************** +// +// Hold the current state for the application. +// +//***************************************************************************** +volatile enum +{ + // + // No device is present. + // + STATE_NO_DEVICE, + + // + // Mass storage device is being enumerated. + // + STATE_DEVICE_ENUM, + + // + // Mass storage device is ready. + // + STATE_DEVICE_READY, + + // + // An unsupported device has been attached. + // + STATE_UNKNOWN_DEVICE, + + // + // A mass storage device was connected but failed to ever report ready. + // + STATE_TIMEOUT_DEVICE, + + // + // A power fault has occurred. + // + STATE_POWER_FAULT +} +g_eState; + +//***************************************************************************** +// +// The size of the host controller's memory pool in bytes. +// +//***************************************************************************** +#define HCD_MEMORY_SIZE 128 + +//***************************************************************************** +// +// The memory pool to provide to the Host controller driver. +// +//***************************************************************************** +uint8_t g_pui8HCDPool[HCD_MEMORY_SIZE]; + +//***************************************************************************** +// +// The instance data for the MSC driver. +// +//***************************************************************************** +tUSBHMSCInstance *g_psMSCInstance = 0; + +//***************************************************************************** +// +// Declare the USB Events driver interface. +// +//***************************************************************************** +DECLARE_EVENT_DRIVER(g_sUSBEventDriver, 0, 0, USBHCDEvents); + +//***************************************************************************** +// +// The global that holds all of the host drivers in use in the application. +// In this case, only the MSC class is loaded. +// +//***************************************************************************** +static tUSBHostClassDriver const * const g_ppHostClassDrivers[] = +{ + &g_sUSBHostMSCClassDriver, + &g_sUSBEventDriver +}; + +//***************************************************************************** +// +// This global holds the number of class drivers in the g_ppHostClassDrivers +// list. +// +//***************************************************************************** +static const uint32_t g_ui32NumHostClassDrivers = + sizeof(g_ppHostClassDrivers) / sizeof(tUSBHostClassDriver *); + +//***************************************************************************** +// +// The control table used by the uDMA controller. This table must be aligned +// to a 1024 byte boundary. In this application uDMA is only used for USB, +// so only the first 6 channels are needed. +// +//***************************************************************************** +#if defined(ewarm) +#pragma data_alignment=1024 +tDMAControlTable g_psDMAControlTable[6]; +#elif defined(ccs) +#pragma DATA_ALIGN(g_psDMAControlTable, 1024) +tDMAControlTable g_psDMAControlTable[6]; +#else +tDMAControlTable g_psDMAControlTable[6] __attribute__ ((aligned(1024))); +#endif + +//***************************************************************************** +// +// Define a pair of buffers that are used for holding path information. +// The buffer size must be large enough to hold the longest expected +// full path name, including the file name, and a trailing null character. +// The initial path is set to root "/". +// +//***************************************************************************** +#define PATH_BUF_SIZE 80 +static char g_pcCwdBuf[PATH_BUF_SIZE] = "/"; +static char g_pcTmpBuf[PATH_BUF_SIZE]; + +//***************************************************************************** +// +// A set of string pointers that are used for showing status on the display. +// Five lines of text are accommodated, which is the reasonable limit for +// this display. +// +//***************************************************************************** +static char *g_pcStatusLines[5]; + +//***************************************************************************** +// +// A variable to track the current level in the directory tree. The root +// level is level 0. +// +//***************************************************************************** +static uint32_t g_ui32Level; + +//***************************************************************************** +// +// Declare a pair of off-screen buffers and associated display structures. +// These are used by the slide menu widget for animated menu effects. +// +//***************************************************************************** +#define OFFSCREEN_BUF_SIZE GrOffScreen4BPPSize(96, 64) +static uint8_t g_pui8OffscreenBufA[OFFSCREEN_BUF_SIZE]; +static uint8_t g_pui8OffscreenBufB[OFFSCREEN_BUF_SIZE]; +static tDisplay g_sOffscreenDisplayA; +static tDisplay g_sOffscreenDisplayB; + +//***************************************************************************** +// +// Create a palette that is used by the on-screen menus and anything else that +// uses the (above) off-screen buffers. This palette should contain any +// colors that are used by any widget using the offscreen buffers. There can +// be up to 16 colors in this palette. +// +//***************************************************************************** +static uint32_t g_pui32Palette[] = +{ + ClrBlack, + ClrWhite, + ClrDarkBlue, + ClrLightBlue, + ClrRed, + ClrDarkGreen, + ClrYellow, + ClrBlue +}; +#define NUM_PALETTE_ENTRIES (sizeof(g_pui32Palette) / sizeof(uint32_t)) + +//***************************************************************************** +// +// Define the maximum number of files that can appear at any directory level. +// This is used for allocating space for holding the file information. +// Define the maximum depth of subdirectories, also used to allocating space +// for directory structures. +// Define the maximum number of characters allowed to be stored for a file +// name. +// +//***************************************************************************** +#define MAX_FILES_PER_MENU 64 +#define MAX_SUBDIR_DEPTH 32 +#define MAX_FILENAME_STRING_LEN 16 + +//***************************************************************************** +// +// Declare a set of menu items and matching strings that are used to hold +// file information. There are two alternating sets. Two are needed because +// the file information must be retained for the current directory, and the +// new directory (up or down the tree). +// +//***************************************************************************** +static char g_pcFileNames[2][MAX_FILES_PER_MENU][MAX_FILENAME_STRING_LEN]; +static tSlideMenuItem g_psFileMenuItems[2][MAX_FILES_PER_MENU]; + +//***************************************************************************** +// +// Declare a set of menus, one for each level of directory. +// +//***************************************************************************** +static tSlideMenu g_psFileMenus[MAX_SUBDIR_DEPTH]; + +//***************************************************************************** +// +// Define the slide menu widget. This is the wigdet that is used for +// displaying the file information. +// +//***************************************************************************** +SlideMenu(g_sFileMenuWidget, WIDGET_ROOT, 0, 0, &g_sCFAL96x64x16, 0, 0, 96, 64, + &g_sOffscreenDisplayA, &g_sOffscreenDisplayB, 16, + ClrWhite, ClrDarkGreen, ClrBlack, &g_sFontFixed6x8, &g_psFileMenus[0], + 0); + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// This is the handler for this SysTick interrupt. It simply increments a +// counter that is used for timing. +// +//***************************************************************************** +void +SysTickHandler(void) +{ + // + // Update our tick counter. + // + g_ui32SysTickCount++; +} + +//***************************************************************************** +// +// This function returns a string representation of an error code +// that was returned from a function call to FatFs. It can be used +// for printing human readable error messages. +// +//***************************************************************************** +static const char * +StringFromFresult(FRESULT fresult) +{ + uint32_t ui32Idx; + + // + // Enter a loop to search the error code table for a matching + // error code. + // + for(ui32Idx = 0; ui32Idx < NUM_FRESULT_CODES; ui32Idx++) + { + // + // If a match is found, then return the string name of the + // error code. + // + if(g_sFresultStrings[ui32Idx].fresult == fresult) + { + return(g_sFresultStrings[ui32Idx].pcResultStr); + } + } + + // + // At this point no matching code was found, so return a + // string indicating unknown error. + // + return("UNKNOWN ERR"); +} + +//***************************************************************************** +// +// Initializes the file system module. +// +// \param None. +// +// This function initializes the third party FAT implementation. +// +// \return Returns \e true on success or \e false on failure. +// +//***************************************************************************** +static bool +FileInit(void) +{ + // + // Mount the file system, using logical disk 0. + // + if(f_mount(0, &g_sFatFs) != FR_OK) + { + return(false); + } + return(true); +} + +//***************************************************************************** +// +// This is the callback from the MSC driver. +// +// \param ui32Instance is the driver instance which is needed when communicating +// with the driver. +// \param ui32Event is one of the events defined by the driver. +// \param pvData is a pointer to data passed into the initial call to register +// the callback. +// +// This function handles callback events from the MSC driver. The only events +// currently handled are the MSC_EVENT_OPEN and MSC_EVENT_CLOSE. This allows +// the main routine to know when an MSC device has been detected and +// enumerated and when an MSC device has been removed from the system. +// +// \return None +// +//***************************************************************************** +static void +MSCCallback(tUSBHMSCInstance *ps32Instance, uint32_t ui32Event, void *pvData) +{ + // + // Determine the event. + // + switch(ui32Event) + { + // + // Called when the device driver has successfully enumerated an MSC + // device. + // + case MSC_EVENT_OPEN: + { + // + // Proceed to the enumeration state. + // + g_eState = STATE_DEVICE_ENUM; + + break; + } + + // + // Called when the device driver has been unloaded due to error or + // the device is no longer present. + // + case MSC_EVENT_CLOSE: + { + // + // Go back to the "no device" state and wait for a new connection. + // + g_eState = STATE_NO_DEVICE; + + // + // Re-initialize the file system. + // + FileInit(); + + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// This is the generic callback from host stack. +// +// pvData is actually a pointer to a tEventInfo structure. +// +// This function will be called to inform the application when a USB event has +// occurred that is outside those related to the mass storage device. At this +// point this is used to detect unsupported devices being inserted and removed. +// It is also used to inform the application when a power fault has occurred. +// This function is required when the g_USBGenericEventDriver is included in +// the host controller driver array that is passed in to the +// USBHCDRegisterDrivers() function. +// +//***************************************************************************** +void +USBHCDEvents(void *pvData) +{ + tEventInfo *pEventInfo; + + // + // Cast this pointer to its actual type. + // + pEventInfo = (tEventInfo *)pvData; + + // + // Process each kind of event + // + switch(pEventInfo->ui32Event) + { + // + // An unknown device has been connected. + // + case USB_EVENT_UNKNOWN_CONNECTED: + { + // + // An unknown device was detected. + // + g_eState = STATE_UNKNOWN_DEVICE; + break; + } + + // + // The unknown device has been been unplugged. + // + case USB_EVENT_DISCONNECTED: + { + // + // Unknown device has been removed. + // + g_eState = STATE_NO_DEVICE; + break; + } + + // + // A bus power fault was detected. + // + case USB_EVENT_POWER_FAULT: + { + // + // No power means no device is present. + // + g_eState = STATE_POWER_FAULT; + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// This function shows a status screen. It draws a banner at the top of the +// screen with the name of the application, and then up to 5 lines of text +// in the remaining screen area. The caller specifies a pointer to a set of +// strings, and the count of number of lines of text (up to 5). This +// function attempts to vertically center the strings on the display. +// +//***************************************************************************** +static void +ShowStatusScreen(char *pcStatus[], uint32_t ui32Count) +{ + tContext sContext; + tRectangle sRect; + uint32_t ui32Idx; + int32_t i32Y; + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Fill the rest of the display with black, to clear whatever was there + // before. + // + sRect.i16YMin = 10; + sRect.i16YMax = 63; + GrContextForegroundSet(&sContext, ClrBlack); + GrRectFill(&sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "usb-host-msc", -1, + GrContextDpyWidthGet(&sContext) / 2, 4, 0); + + // + // Cap the max number of status lines to 5 + // + ui32Count = (ui32Count > 5) ? 5 : ui32Count; + + // + // Compute the starting Y coordinate based on the number of lines. + // + i32Y = 40 - (ui32Count * 5); + + // + // Display the status lines + // + for(ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++) + { + GrStringDrawCentered(&sContext, pcStatus[ui32Idx], -1, + GrContextDpyWidthGet(&sContext) / 2, i32Y, 0); + i32Y += 10; + } +} + +//***************************************************************************** +// +// This function is called to read the contents of the current directory from +// the USB stick and populate a set of menu items, one for each file in the +// directory. A subdirectory within the directory counts as a file item. +// +// This function returns the number of file items that were found, or 0 if +// there is any error detected. +// +//***************************************************************************** +static uint32_t +PopulateFileList(uint32_t ui32Level) +{ + uint32_t ui32ItemCount; + FRESULT fresult; + + // + // Open the current directory for access. + // + fresult = f_opendir(&g_sDirObject, g_pcCwdBuf); + + // + // Check for error and return if there is a problem. + // + if(fresult != FR_OK) + { + // + // Ensure that the error is reported. + // + g_pcStatusLines[0] = "Error from"; + g_pcStatusLines[1] = "USB disk"; + g_pcStatusLines[2] = (char *)StringFromFresult(fresult); + ShowStatusScreen(g_pcStatusLines, 3); + return(0); + } + + // + // Initialize the count of files in this directory + // + ui32ItemCount = 0; + + // + // Enter loop to enumerate through all directory entries. + // + for(;;) + { + // + // Read an entry from the directory. + // + fresult = f_readdir(&g_sDirObject, &g_sFileInfo); + + // + // Check for error and return if there is a problem. + // + if(fresult != FR_OK) + { + g_pcStatusLines[0] = "Error from"; + g_pcStatusLines[1] = "USB disk"; + g_pcStatusLines[2] = (char *)StringFromFresult(fresult); + ShowStatusScreen(g_pcStatusLines, 3); + return(0); + } + + // + // If the file name is blank, then this is the end of the + // listing. + // + if(!g_sFileInfo.fname[0]) + { + break; + } + + // + // Add the information to a menu item + // + if(ui32ItemCount < MAX_FILES_PER_MENU) + { + tSlideMenuItem *pMenuItem; + + // + // Get a pointer to the current menu item. Use the directory + // level to determine which of the two sets of menu items to use. + // (ui32Level & 1]. This lets us alternate between the current + // set of menu items and the new set (up or down the tree). + // + pMenuItem = &g_psFileMenuItems[ui32Level & 1][ui32ItemCount]; + + // + // Add the file name to the menu item + // + usnprintf(g_pcFileNames[ui32Level & 1][ui32ItemCount], + MAX_FILENAME_STRING_LEN, "%s", g_sFileInfo.fname); + pMenuItem->pcText = g_pcFileNames[ui32Level & 1][ui32ItemCount]; + + // + // If this is a directory, then add the next level menu so that + // when displayed it will be showed with a submenu option + // (next level down in directory tree). Otherwise it is a file + // so clear the child menu so that there is no submenu option + // shown. + // + pMenuItem->psChildMenu = (g_sFileInfo.fattrib & AM_DIR) ? + &g_psFileMenus[ui32Level + 1] : 0; + + // + // Move to the next entry in the item array we use to populate the + // list box. + // + ui32ItemCount++; + } + } + + // + // Made it to here, return the count of files that were populated. + // + return(ui32ItemCount); +} + +//***************************************************************************** +// +// This function is used to change to a new directory in the file system. +// It takes a parameter that specifies the directory to make the current +// working directory. +// Path separators must use a forward slash "/". The directory parameter +// can be one of the following: +// * root ("/") +// * a fully specified path ("/my/path/to/mydir") +// * a single directory name that is in the current directory ("mydir") +// * parent directory ("..") +// +// It does not understand relative paths, so dont try something like this: +// ("../my/new/path") +// +// Once the new directory is specified, it attempts to open the directory +// to make sure it exists. If the new path is opened successfully, then +// the current working directory (cwd) is changed to the new path. +// +// In cases of error, the pui32Reason parameter will be written with one of +// the following values: +// +// NAME_TOO_LONG_ERROR - combination of paths are too long for the buffer +// OPENDIR_ERROR - there is some problem opening the new directory +// +//***************************************************************************** +static FRESULT +ChangeToDirectory(char *pcDirectory, uint32_t *pui32Reason) +{ + uint32_t ui32Idx; + FRESULT fresult; + + // + // Copy the current working path into a temporary buffer so + // it can be manipulated. + // + strcpy(g_pcTmpBuf, g_pcCwdBuf); + + // + // If the first character is /, then this is a fully specified + // path, and it should just be used as-is. + // + if(pcDirectory[0] == '/') + { + // + // Make sure the new path is not bigger than the cwd buffer. + // + if(strlen(pcDirectory) + 1 > sizeof(g_pcCwdBuf)) + { + *pui32Reason = NAME_TOO_LONG_ERROR; + return(FR_OK); + } + + // + // If the new path name (in argv[1]) is not too long, then + // copy it into the temporary buffer so it can be checked. + // + else + { + strncpy(g_pcTmpBuf, pcDirectory, sizeof(g_pcTmpBuf)); + } + } + + // + // If the argument is .. then attempt to remove the lowest level + // on the CWD. + // + else if(!strcmp(pcDirectory, "..")) + { + // + // Get the index to the last character in the current path. + // + ui32Idx = strlen(g_pcTmpBuf) - 1; + + // + // Back up from the end of the path name until a separator (/) + // is found, or until we bump up to the start of the path. + // + while((g_pcTmpBuf[ui32Idx] != '/') && (ui32Idx > 1)) + { + // + // Back up one character. + // + ui32Idx--; + } + + // + // Now we are either at the lowest level separator in the + // current path, or at the beginning of the string (root). + // So set the new end of string here, effectively removing + // that last part of the path. + // + g_pcTmpBuf[ui32Idx] = 0; + } + + // + // Otherwise this is just a normal path name from the current + // directory, and it needs to be appended to the current path. + // + else + { + // + // Test to make sure that when the new additional path is + // added on to the current path, there is room in the buffer + // for the full new path. It needs to include a new separator, + // and a trailing null character. + // + if(strlen(g_pcTmpBuf) + strlen(pcDirectory) + 1 + 1 > sizeof(g_pcCwdBuf)) + { + *pui32Reason = NAME_TOO_LONG_ERROR; + return(FR_INVALID_OBJECT); + } + + // + // The new path is okay, so add the separator and then append + // the new directory to the path. + // + else + { + // + // If not already at the root level, then append a / + // + if(strcmp(g_pcTmpBuf, "/")) + { + strcat(g_pcTmpBuf, "/"); + } + + // + // Append the new directory to the path. + // + strcat(g_pcTmpBuf, pcDirectory); + } + } + + // + // At this point, a candidate new directory path is in g_pcTmpBuf. + // Try to open it to make sure it is valid. + // + fresult = f_opendir(&g_sDirObject, g_pcTmpBuf); + + // + // If it can't be opened, then it is a bad path. Return an error. + // + if(fresult != FR_OK) + { + *pui32Reason = OPENDIR_ERROR; + return(fresult); + } + + // + // Otherwise, it is a valid new path, so copy it into the CWD. + // + else + { + strncpy(g_pcCwdBuf, g_pcTmpBuf, sizeof(g_pcCwdBuf)); + } + + // + // Return success. + // + return(FR_OK); +} + +//***************************************************************************** +// +// Sends a button/key press message to the slide menu widget that is showing +// files. +// +//***************************************************************************** +static void +SendWidgetKeyMessage(uint32_t ui32Msg) +{ + WidgetMessageQueueAdd(WIDGET_ROOT, + ui32Msg, (uint32_t)&g_sFileMenuWidget, 0, 1, 1); +} + +//***************************************************************************** +// +// This function performs actions that are common whenever the directory +// level is changed up or down. It populates the correct menu structure with +// the list of files in the directory. +// +//***************************************************************************** +static bool +ProcessDirChange(char *pcDir, uint32_t ui32Level) +{ + FRESULT fresult; + uint32_t ui32Reason; + uint32_t ui32FileCount; + + // + // Attempt to change to the new directory. + // + fresult = ChangeToDirectory(pcDir, &ui32Reason); + + // + // If the directory change was successful, populate the + // list of files for the new subdirectory. + // + if((fresult == FR_OK) && (ui32Level < MAX_SUBDIR_DEPTH)) + { + // + // Get a pointer to the current menu for this CWD. + // + tSlideMenu *psMenu = &g_psFileMenus[ui32Level]; + + // + // Populate the menu items with the file list for the new CWD. + // + ui32FileCount = PopulateFileList(ui32Level); + + // + // Initialize the file menu with the list of menu items, + // which are just files and dirs in the root directory + // + psMenu->psSlideMenuItems = g_psFileMenuItems[ui32Level & 1]; + psMenu->ui32Items = ui32FileCount; + + // + // Set the parent directory, if there is one. If at level 0 + // (CWD is root), then there is no parent directory. + // + if(ui32Level) + { + psMenu->psParent = &g_psFileMenus[ui32Level - 1]; + } + else + { + psMenu->psParent = 0; + } + + // + // If we are descending into a new subdir, then initialize the other + // menu item fields to default values. + // + if(ui32Level > g_ui32Level) + { + psMenu->ui32CenterIndex = 0; + psMenu->ui32FocusIndex = 0; + psMenu->bMultiSelectable = 0; + } + + // + // Return a success indication + // + return(true); + } + + // + // Directory change was not successful + // + else + { + // + // Return failure indication + // + return(false); + } +} + +//***************************************************************************** +// +// The program main function. It performs initialization, then runs a loop to +// process USB activities and operate the user interface. +// +//***************************************************************************** +int +main(void) +{ + uint32_t ui32DriveTimeout; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the system clock to run at 50MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Configure the required pins for USB operation. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Configure SysTick for a 100Hz interrupt. + // + ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND); + ROM_SysTickEnable(); + ROM_SysTickIntEnable(); + + // + // Enable the uDMA controller and set up the control table base. + // The uDMA controller is used by the USB library. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); + ROM_uDMAEnable(); + ROM_uDMAControlBaseSet(g_psDMAControlTable); + + // + // Enable Interrupts + // + ROM_IntMasterEnable(); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the buttons driver. + // + ButtonsInit(); + + // + // Initialize two offscreen displays and assign the palette. These + // buffers are used by the slide menu widget to allow animation effects. + // + GrOffScreen4BPPInit(&g_sOffscreenDisplayA, g_pui8OffscreenBufA, 96, 64); + GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayA, g_pui32Palette, 0, + NUM_PALETTE_ENTRIES); + GrOffScreen4BPPInit(&g_sOffscreenDisplayB, g_pui8OffscreenBufB, 96, 64); + GrOffScreen4BPPPaletteSet(&g_sOffscreenDisplayB, g_pui32Palette, 0, + NUM_PALETTE_ENTRIES); + + // + // Show an initial status screen + // + g_pcStatusLines[0] = "Waiting"; + g_pcStatusLines[1] = "for device"; + ShowStatusScreen(g_pcStatusLines, 2); + + // + // Add the compile-time defined widgets to the widget tree. + // + WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sFileMenuWidget); + + // + // Initially wait for device connection. + // + g_eState = STATE_NO_DEVICE; + + // + // Initialize the USB stack for host mode. + // + USBStackModeSet(0, eUSBModeHost, 0); + + // + // Register the host class drivers. + // + USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); + + // + // Open an instance of the mass storage class driver. + // + g_psMSCInstance = USBHMSCDriveOpen(0, MSCCallback); + + // + // Initialize the drive timeout. + // + ui32DriveTimeout = USBMSC_DRIVE_RETRY; + + // + // Initialize the power configuration. This sets the power enable signal + // to be active high and does not enable the power fault. + // + USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); + + // + // Initialize the USB controller for host operation. + // + USBHCDInit(0, g_pui8HCDPool, HCD_MEMORY_SIZE); + + // + // Initialize the file system. + // + FileInit(); + + // + // Enter an infinite loop to run the user interface and process USB + // events. + // + while(1) + { + uint32_t ui32LastTickCount = 0; + + // + // Call the USB stack to keep it running. + // + USBHCDMain(); + + // + // Process any messages in the widget message queue. This keeps the + // display UI running. + // + WidgetMessageQueueProcess(); + + // + // Take action based on the application state. + // + switch(g_eState) + { + // + // A device has enumerated. + // + case STATE_DEVICE_ENUM: + { + // + // Check to see if the device is ready. If not then stay + // in this state and we will check it again on the next pass. + // + if(USBHMSCDriveReady(g_psMSCInstance) != 0) + { + // + // Wait about 500ms before attempting to check if the + // device is ready again. + // + ROM_SysCtlDelay(ROM_SysCtlClockGet()/(3)); + + // + // Decrement the retry count. + // + ui32DriveTimeout--; + + // + // If the timeout is hit then go to the + // STATE_TIMEOUT_DEVICE state. + // + if(ui32DriveTimeout == 0) + { + g_eState = STATE_TIMEOUT_DEVICE; + } + + break; + } + + // + // Getting here means the device is ready. + // Reset the CWD to the root directory. + // + g_pcCwdBuf[0] = '/'; + g_pcCwdBuf[1] = 0; + + // + // Set the initial directory level to the root + // + g_ui32Level = 0; + + // + // We need to reset the indexes of the root menu to 0, so that + // it will start at the top of the file list, and reset the + // slide menu widget to start with the root menu. + // + g_psFileMenus[g_ui32Level].ui32CenterIndex = 0; + g_psFileMenus[g_ui32Level].ui32FocusIndex = 0; + SlideMenuMenuSet(&g_sFileMenuWidget, &g_psFileMenus[g_ui32Level]); + + // + // Initiate a directory change to the root. This will + // populate a menu structure representing the root directory. + // + if(ProcessDirChange("/", g_ui32Level)) + { + // + // If there were no errors reported, we are ready for + // MSC operation. + // + g_eState = STATE_DEVICE_READY; + + // + // Set the Device Present flag. + // + g_ui32Flags = FLAGS_DEVICE_PRESENT; + + // + // Request a repaint so the file menu will be shown + // + WidgetPaint(WIDGET_ROOT); + } + + break; + } + + // + // If there is no device then just wait for one. + // + case STATE_NO_DEVICE: + { + if(g_ui32Flags == FLAGS_DEVICE_PRESENT) + { + // + // Show waiting message on screen + // + g_pcStatusLines[0] = "Waiting"; + g_pcStatusLines[1] = "for device"; + ShowStatusScreen(g_pcStatusLines, 2); + + // + // Clear the Device Present flag. + // + g_ui32Flags &= ~FLAGS_DEVICE_PRESENT; + } + break; + } + + // + // An unknown device was connected. + // + case STATE_UNKNOWN_DEVICE: + { + // + // If this is a new device then change the status. + // + if((g_ui32Flags & FLAGS_DEVICE_PRESENT) == 0) + { + // + // Clear the screen and indicate that an unknown device + // is present. + // + g_pcStatusLines[0] = "Unknown"; + g_pcStatusLines[1] = "device"; + ShowStatusScreen(g_pcStatusLines, 2); + } + + // + // Set the Device Present flag. + // + g_ui32Flags = FLAGS_DEVICE_PRESENT; + + break; + } + + // + // The connected mass storage device is not reporting ready. + // + case STATE_TIMEOUT_DEVICE: + { + // + // If this is the first time in this state then print a + // message. + // + if((g_ui32Flags & FLAGS_DEVICE_PRESENT) == 0) + { + // + // + // Clear the screen and indicate that an unknown device + // is present. + // + g_pcStatusLines[0] = "Device"; + g_pcStatusLines[1] = "Timeout"; + ShowStatusScreen(g_pcStatusLines, 2); + } + + // + // Set the Device Present flag. + // + g_ui32Flags = FLAGS_DEVICE_PRESENT; + + break; + } + + // + // The device is ready and in use. + // + case STATE_DEVICE_READY: + { + // + // Process occurrence of timer tick. Check for user input + // once each tick. + // + if(g_ui32SysTickCount != ui32LastTickCount) + { + uint8_t ui8ButtonState; + uint8_t ui8ButtonChanged; + + ui32LastTickCount = g_ui32SysTickCount; + + // + // Get the current debounced state of the buttons. + // + ui8ButtonState = ButtonsPoll(&ui8ButtonChanged, 0); + + // + // If select button or right button is pressed, then we + // are trying to descend into another directory + // + if(BUTTON_PRESSED(SELECT_BUTTON, + ui8ButtonState, ui8ButtonChanged) || + BUTTON_PRESSED(RIGHT_BUTTON, + ui8ButtonState, ui8ButtonChanged)) + { + uint32_t ui32NewLevel; + uint32_t ui32ItemIdx; + char *pcItemName; + + // + // Get a pointer to the current menu for this CWD. + // + tSlideMenu *psMenu = &g_psFileMenus[g_ui32Level]; + + // + // Get the highlighted index in the current file list. + // This is the currently highlighted file or dir + // on the display. Then get the name of the file at + // this index. + // + ui32ItemIdx = SlideMenuFocusItemGet(psMenu); + pcItemName = psMenu->psSlideMenuItems[ui32ItemIdx].pcText; + + // + // Make sure we are not yet past the maximum tree + // depth. + // + if(g_ui32Level < MAX_SUBDIR_DEPTH) + { + // + // Potential new level is one greater than the + // current level. + // + ui32NewLevel = g_ui32Level + 1; + + // + // Process the directory change to the new + // directory. This function will populate a menu + // structure with the files and subdirs in the new + // directory. + // + if(ProcessDirChange(pcItemName, ui32NewLevel)) + { + // + // If the change was successful, then update + // the level. + // + g_ui32Level = ui32NewLevel; + + // + // Now that all the prep is done, send the + // KEY_RIGHT message to the widget and it will + // "slide" from the previous file list to the + // new file list of the CWD. + // + SendWidgetKeyMessage(WIDGET_MSG_KEY_RIGHT); + + } + } + } + + // + // If the UP button is pressed, just pass it to the widget + // which will handle scrolling the list of files. + // + if(BUTTON_PRESSED(UP_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_UP); + } + + // + // If the DOWN button is pressed, just pass it to the widget + // which will handle scrolling the list of files. + // + if(BUTTON_PRESSED(DOWN_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + SendWidgetKeyMessage(WIDGET_MSG_KEY_DOWN); + } + + // + // If the LEFT button is pressed, then we are attempting + // to go up a level in the file system. + // + if(BUTTON_PRESSED(LEFT_BUTTON, ui8ButtonState, ui8ButtonChanged)) + { + uint32_t ui32NewLevel; + + // + // Make sure we are not already at the top of the + // directory tree (at root). + // + if(g_ui32Level) + { + // + // Potential new level is one less than the + // current level. + // + ui32NewLevel = g_ui32Level - 1; + + // + // Process the directory change to the new + // directory. This function will populate a menu + // structure with the files and subdirs in the new + // directory. + // + if(ProcessDirChange("..", ui32NewLevel)) + { + // + // If the change was successful, then update + // the level. + // + g_ui32Level = ui32NewLevel; + + // + // Now that all the prep is done, send the + // KEY_LEFT message to the widget and it will + // "slide" from the previous file list to the + // new file list of the CWD. + // + SendWidgetKeyMessage(WIDGET_MSG_KEY_LEFT); + } + } + } + } + break; + } + // + // Something has caused a power fault. + // + case STATE_POWER_FAULT: + { + // + // Clear the screen and show a power fault indication. + // + g_pcStatusLines[0] = "Power"; + g_pcStatusLines[1] = "fault"; + ShowStatusScreen(g_pcStatusLines, 2); + break; + } + + default: + { + break; + } + } + } +} diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewd b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewp b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewp new file mode 100644 index 0000000..7ccde98 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ewp @@ -0,0 +1,815 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\..\drivers\buttons.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + + + $PROJ_DIR$\..\..\..\..\third_party\fatfs\src\ff.c + + + $PROJ_DIR$\..\drivers\slidemenuwidget.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\..\..\..\..\utils\uartstdio.c + + + $PROJ_DIR$\usb_host_msc.c + + + $PROJ_DIR$\..\..\..\..\utils\ustdlib.c + + + diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.icf b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.icf new file mode 100644 index 0000000..935059d --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_host_msc.icf - Linker configuration file for usb_host_msc. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ld b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ld new file mode 100644 index 0000000..53a79c2 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_host_msc.ld - Linker configuration file for usb_host_msc. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.sct b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.sct new file mode 100644 index 0000000..db79891 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_host_msc.sct - Linker configuration file for usb_host_msc. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvopt b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvopt new file mode 100644 index 0000000..6fd19dc --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvopt @@ -0,0 +1,415 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_host_msc + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\buttons.c + buttons.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + fat_usbmsc.c + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\third_party\fatfs\src\ff.c + ff.c + + + 1 + 5 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\slidemenuwidget.c + slidemenuwidget.c + + + 1 + 6 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 7 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\uartstdio.c + uartstdio.c + + + 1 + 8 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_host_msc.c + usb_host_msc.c + + + 1 + 9 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\utils\ustdlib.c + ustdlib.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 10 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 11 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + 2 + 12 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 13 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvproj b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvproj new file mode 100644 index 0000000..76a6021 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc.uvproj @@ -0,0 +1,469 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_host_msc + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_host_msc + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_host_msc.bin .\rvmdk\usb_host_msc.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..;..\..\..\..\third_party; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_host_msc.sct + + + --entry Reset_Handler + + + + + + + + Source + + + buttons.c + 1 + ..\drivers\buttons.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + fat_usbmsc.c + 1 + ..\..\..\..\third_party\fatfs\port\fat_usbmsc.c + + + ff.c + 1 + ..\..\..\..\third_party\fatfs\src\ff.c + + + slidemenuwidget.c + 1 + ..\drivers\slidemenuwidget.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + uartstdio.c + 1 + ..\..\..\..\utils\uartstdio.c + + + usb_host_msc.c + 1 + .\usb_host_msc.c + + + ustdlib.c + 1 + ..\..\..\..\utils\ustdlib.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_host_msc/usb_host_msc_ccs.cmd b/boards/ek-lm4f232/usb_host_msc/usb_host_msc_ccs.cmd new file mode 100644 index 0000000..ffb2797 --- /dev/null +++ b/boards/ek-lm4f232/usb_host_msc/usb_host_msc_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_host_msc_ccs.cmd - CCS linker configuration file for usb_host_msc. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 2048; diff --git a/boards/ek-lm4f232/usb_stick_demo/Makefile b/boards/ek-lm4f232/usb_stick_demo/Makefile new file mode 100644 index 0000000..edba6bd --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/Makefile @@ -0,0 +1,87 @@ +#****************************************************************************** +# +# Makefile - Rules for building the usb_stick_demo example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the usb_stick_demo example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_stick_demo.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the usb_stick_demo example. +# +${COMPILER}/usb_stick_demo.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/usb_stick_demo.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_stick_demo.axf: ${COMPILER}/usb_stick_demo.o +${COMPILER}/usb_stick_demo.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/usb_stick_demo.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_stick_demo.axf: usb_stick_demo.ld +SCATTERgcc_usb_stick_demo=usb_stick_demo.ld +ENTRY_usb_stick_demo=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_stick_demo/ccs/.ccsimportspec new file mode 100644 index 0000000..64f9068 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/.ccsproject b/boards/ek-lm4f232/usb_stick_demo/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/.cproject b/boards/ek-lm4f232/usb_stick_demo/ccs/.cproject new file mode 100644 index 0000000..17ab136 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/.project b/boards/ek-lm4f232/usb_stick_demo/ccs/.project new file mode 100644 index 0000000..a993fdf --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/ccs/.project @@ -0,0 +1,55 @@ + + + usb_stick_demo + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_stick_demo/startup_ccs.c + + + usb_stick_demo.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.c + + + usb_stick_demo_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo_ccs.cmd + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_stick_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.bin b/boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.bin new file mode 100644 index 0000000..afa3138 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.bin differ diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.out b/boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.out new file mode 100644 index 0000000..a24de16 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/ccs/Debug/usb_stick_demo.out differ diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_stick_demo/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_stick_demo/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_stick_demo/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.bin b/boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.bin new file mode 100644 index 0000000..f07fa85 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.bin differ diff --git a/boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.out b/boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.out new file mode 100644 index 0000000..6e1213a Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/ewarm/Exe/usb_stick_demo.out differ diff --git a/boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.axf b/boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.axf new file mode 100644 index 0000000..5374b25 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.axf differ diff --git a/boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.bin b/boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.bin new file mode 100644 index 0000000..aa9065e Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/gcc/usb_stick_demo.bin differ diff --git a/boards/ek-lm4f232/usb_stick_demo/readme.txt b/boards/ek-lm4f232/usb_stick_demo/readme.txt new file mode 100644 index 0000000..a0ead70 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/readme.txt @@ -0,0 +1,39 @@ +USB Stick Update Demo + +An example to demonstrate the use of the flash-based USB stick update +program. This example is meant to be loaded into flash memory from a USB +memory stick, using the USB stick update program (usb_stick_update), +running on the microcontroller. + +After this program is built, the binary file (usb_stick_demo.bin), should +be renamed to the filename expected by usb_stick_update ("FIRMWARE.BIN" by +default) and copied to the root directory of a USB memory stick. Then, +when the memory stick is plugged into the eval board that is running the +usb_stick_update program, this example program will be loaded into flash +and then run on the microcontroller. + +This program simply displays a message on the screen and prompts the user +to press the select button. Once the button is pressed, control is passed +back to the usb_stick_update program which is still is flash, and it will +attempt to load another program from the memory stick. This shows how +a user application can force a new firmware update from the memory stick. + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.axf b/boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.axf new file mode 100644 index 0000000..6fb1ffb Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.axf differ diff --git a/boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.bin b/boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.bin new file mode 100644 index 0000000..9dcb832 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_demo/rvmdk/usb_stick_demo.bin differ diff --git a/boards/ek-lm4f232/usb_stick_demo/startup_ccs.c b/boards/ek-lm4f232/usb_stick_demo/startup_ccs.c new file mode 100644 index 0000000..6364a26 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/startup_ccs.c @@ -0,0 +1,295 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_stick_demo/startup_ewarm.c b/boards/ek-lm4f232/usb_stick_demo/startup_ewarm.c new file mode 100644 index 0000000..dfa868d --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/startup_ewarm.c @@ -0,0 +1,326 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_stick_demo/startup_gcc.c b/boards/ek-lm4f232/usb_stick_demo/startup_gcc.c new file mode 100644 index 0000000..5618b79 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/startup_gcc.c @@ -0,0 +1,342 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_stick_demo/startup_rvmdk.S b/boards/ek-lm4f232/usb_stick_demo/startup_rvmdk.S new file mode 100644 index 0000000..9018fc2 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/startup_rvmdk.S @@ -0,0 +1,351 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.c b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.c new file mode 100644 index 0000000..ee6fa6d --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.c @@ -0,0 +1,274 @@ +//***************************************************************************** +// +// usb_stick_demo.c - USB stick update demo. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_types.h" +#include "inc/hw_memmap.h" +#include "driverlib/sysctl.h" +#include "driverlib/rom.h" +#include "driverlib/rom_map.h" +#include "driverlib/gpio.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB Stick Update Demo (usb_stick_demo)

+//! +//! An example to demonstrate the use of the flash-based USB stick update +//! program. This example is meant to be loaded into flash memory from a USB +//! memory stick, using the USB stick update program (usb_stick_update), +//! running on the microcontroller. +//! +//! After this program is built, the binary file (usb_stick_demo.bin), should +//! be renamed to the filename expected by usb_stick_update ("FIRMWARE.BIN" by +//! default) and copied to the root directory of a USB memory stick. Then, +//! when the memory stick is plugged into the eval board that is running the +//! usb_stick_update program, this example program will be loaded into flash +//! and then run on the microcontroller. +//! +//! This program simply displays a message on the screen and prompts the user +//! to press the select button. Once the button is pressed, control is passed +//! back to the usb_stick_update program which is still is flash, and it will +//! attempt to load another program from the memory stick. This shows how +//! a user application can force a new firmware update from the memory stick. +// +//***************************************************************************** + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// Demonstrate the use of the USB stick update example. +// +//***************************************************************************** +int +main(void) +{ + uint_fast32_t ui32Count; + tContext sContext; + tRectangle sRect; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the system clock to run at 50MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display driver. + // + CFAL96x64x16Init(); + + // + // Initialize the graphics context. + // + GrContextInit(&sContext, &g_sCFAL96x64x16); + + // + // Fill the top 24 rows of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&sContext, ClrDarkBlue); + GrRectFill(&sContext, &sRect); + + // + // Put a white box around the banner. + // + GrContextForegroundSet(&sContext, ClrWhite); + GrRectDraw(&sContext, &sRect); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&sContext, g_psFontFixed6x8); + GrStringDrawCentered(&sContext, "usb-stick-demo", -1, + GrContextDpyWidthGet(&sContext) / 2, 4, 0); + + // + // Indicate what is happening. + // + GrStringDrawCentered(&sContext, "Press the", -1, + GrContextDpyWidthGet(&sContext) / 2, 20, 0); + GrStringDrawCentered(&sContext, "select button to", -1, + GrContextDpyWidthGet(&sContext) / 2, 30, 0); + GrStringDrawCentered(&sContext, "start the USB", -1, + GrContextDpyWidthGet(&sContext) / 2, 40, 0); + GrStringDrawCentered(&sContext, "stick updater.", -1, + GrContextDpyWidthGet(&sContext) / 2, 50, 0); + + // + // Flush any cached drawing operations. + // + GrFlush(&sContext); + + // + // Enable the GPIO module which the select button is attached to. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM); + + // + // Enable the GPIO pin to read the user button. + // + ROM_GPIODirModeSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN); + MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, + GPIO_PIN_TYPE_STD_WPU); + + // + // Wait for the pullup to take effect or the next loop will exist too soon. + // + SysCtlDelay(1000); + + // + // Wait until the select button has been pressed for ~40ms (in order to + // debounce the press). + // + ui32Count = 0; + while(1) + { + // + // See if the button is pressed. + // + if(ROM_GPIOPinRead(GPIO_PORTM_BASE, GPIO_PIN_4) == 0) + { + // + // Increment the count since the button is pressed. + // + ui32Count++; + + // + // If the count has reached 4, then the button has been debounced + // as being pressed. + // + if(ui32Count == 4) + { + break; + } + } + else + { + // + // Reset the count since the button is not pressed. + // + ui32Count = 0; + } + + // + // Delay for approximately 10ms. + // + SysCtlDelay(16000000 / (3 * 100)); + } + + // + // Wait until the select button has been released for ~40ms (in order to + // debounce the release). + // + ui32Count = 0; + while(1) + { + // + // See if the button is pressed. + // + if(ROM_GPIOPinRead(GPIO_PORTM_BASE, GPIO_PIN_4) != 0) + { + // + // Increment the count since the button is released. + // + ui32Count++; + + // + // If the count has reached 4, then the button has been debounced + // as being released. + // + if(ui32Count == 4) + { + break; + } + } + else + { + // + // Reset the count since the button is pressed. + // + ui32Count = 0; + } + + // + // Delay for approximately 10ms. + // + SysCtlDelay(16000000 / (3 * 100)); + } + + // + // Indicate that the updater is being called. + // + GrStringDrawCentered(&sContext, "The USB stick", -1, + GrContextDpyWidthGet(&sContext) / 2, 20, true); + GrStringDrawCentered(&sContext, "updater is now", -1, + GrContextDpyWidthGet(&sContext) / 2, 30, true); + GrStringDrawCentered(&sContext, "waiting for a", -1, + GrContextDpyWidthGet(&sContext) / 2, 40, true); + GrStringDrawCentered(&sContext, "USB stick.", -1, + GrContextDpyWidthGet(&sContext) / 2, 50, true); + + // + // Flush any cached drawing operations. + // + GrFlush(&sContext); + + // + // Call the updater so that it will search for an update on a memory stick. + // + (*((void (*)(void))(*(uint32_t *)0x2c)))(); + + // + // The updater should take control, so this should never be reached. + // Just in case, loop forever. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewd b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewp b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewp new file mode 100644 index 0000000..830853d --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ewp @@ -0,0 +1,792 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\usb_stick_demo.c + + + diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.icf b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.icf new file mode 100644 index 0000000..f68d397 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_stick_demo.icf - Linker configuration file for usb_stick_demo. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00004800 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ld b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ld new file mode 100644 index 0000000..eec0139 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_stick_demo.ld - Linker configuration file for usb_stick_demo. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00004800, LENGTH = 0x0003b800 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.sct b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.sct new file mode 100644 index 0000000..459f057 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_stick_demo.sct - Linker configuration file for usb_stick_demo. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00004800 0x0003b800 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00004800 0x0003b800 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvopt b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvopt new file mode 100644 index 0000000..816c607 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvopt @@ -0,0 +1,317 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_stick_demo + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_stick_demo.c + usb_stick_demo.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 6 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvproj b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvproj new file mode 100644 index 0000000..b28a48b --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo.uvproj @@ -0,0 +1,434 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_stick_demo + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_stick_demo + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_stick_demo.bin .\rvmdk\usb_stick_demo.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_stick_demo.sct + + + --entry Reset_Handler + + + + + + + + Source + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + usb_stick_demo.c + 1 + .\usb_stick_demo.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo_ccs.cmd b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo_ccs.cmd new file mode 100644 index 0000000..02e7574 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_demo/usb_stick_demo_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_stick_demo_ccs.cmd - CCS linker configuration file for usb_stick_demo. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00004800 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x0003b800 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; diff --git a/boards/ek-lm4f232/usb_stick_update/Makefile b/boards/ek-lm4f232/usb_stick_update/Makefile new file mode 100644 index 0000000..1ee3993 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/Makefile @@ -0,0 +1,86 @@ +#****************************************************************************** +# +# Makefile - Rules for building the USB memory stick updater example. +# +# Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../../../../utils + +# +# Where to find header files that do not live in the source directory. +# +IPATH=../../../.. + +# +# The default rule, which causes the USB memory stick updater example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/usb_stick_update.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the USB memory stick updater example. +# +${COMPILER}/usb_stick_update.axf: ${COMPILER}/simple_fs.o +${COMPILER}/usb_stick_update.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/usb_stick_update.axf: ${COMPILER}/usb_stick_update.o +${COMPILER}/usb_stick_update.axf: ${ROOT}/usblib/${COMPILER}/libusb.a +${COMPILER}/usb_stick_update.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/usb_stick_update.axf: usb_stick_update.ld +SCATTERgcc_usb_stick_update=usb_stick_update.ld +ENTRY_usb_stick_update=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/.ccsimportspec b/boards/ek-lm4f232/usb_stick_update/ccs/.ccsimportspec new file mode 100644 index 0000000..d225a1d --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/ccs/.ccsimportspec @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/.ccsproject b/boards/ek-lm4f232/usb_stick_update/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/.cproject b/boards/ek-lm4f232/usb_stick_update/ccs/.cproject new file mode 100644 index 0000000..e625362 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/ccs/.cproject @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/.project b/boards/ek-lm4f232/usb_stick_update/ccs/.project new file mode 100644 index 0000000..5c47659 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/ccs/.project @@ -0,0 +1,55 @@ + + + usb_stick_update + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + simple_fs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_stick_update/simple_fs.c + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_stick_update/startup_ccs.c + + + usb_stick_update.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_stick_update/usb_stick_update.c + + + usb_stick_update_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/usb_stick_update/usb_stick_update_ccs.cmd + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/usb_stick_update/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.bin b/boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.bin new file mode 100644 index 0000000..1207e5a Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.bin differ diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.out b/boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.out new file mode 100644 index 0000000..844c734 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/ccs/Debug/usb_stick_update.out differ diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/macros.ini_initial b/boards/ek-lm4f232/usb_stick_update/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/usb_stick_update/ccs/target_config.ccxml b/boards/ek-lm4f232/usb_stick_update/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.bin b/boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.bin new file mode 100644 index 0000000..b60df80 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.bin differ diff --git a/boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.out b/boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.out new file mode 100644 index 0000000..313ffa0 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/ewarm/Exe/usb_stick_update.out differ diff --git a/boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.axf b/boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.axf new file mode 100644 index 0000000..67e17c8 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.axf differ diff --git a/boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.bin b/boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.bin new file mode 100644 index 0000000..bd8ee8f Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/gcc/usb_stick_update.bin differ diff --git a/boards/ek-lm4f232/usb_stick_update/readme.txt b/boards/ek-lm4f232/usb_stick_update/readme.txt new file mode 100644 index 0000000..613808e --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/readme.txt @@ -0,0 +1,49 @@ +USB Memory Stick Updater + +This example application behaves the same way as a boot loader. It resides +at the beginning of flash, and will read a binary file from a USB memory +stick and program it into another location in flash. Once the user +application has been programmed into flash, this program will always start +the user application until requested to load a new application. + +When this application starts, if there is a user application already in +flash (at \b APP_START_ADDRESS), then it will just run the user application. +It will attempt to load a new application from a USB memory stick under +the following conditions: + +- no user application is present at \b APP_START_ADDRESS +- the user application has requested an update by transferring control +to the updater +- the user holds down the eval board push button when the board is reset + +When this application is attempting to perform an update, it will wait +forever for a USB memory stick to be plugged in. Once a USB memory stick +is found, it will search the root directory for a specific file name, which +is \e FIRMWARE.BIN by default. This file must be a binary image of the +program you want to load (the .bin file), linked to run from the correct +address, at \b APP_START_ADDRESS. + +The USB memory stick must be formatted as a FAT16 or FAT32 file system +(the normal case), and the binary file must be located in the root +directory. Other files can exist on the memory stick but they will be +ignored. + +------------------------------------------------------------------------------- + +Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.axf b/boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.axf new file mode 100644 index 0000000..2473347 Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.axf differ diff --git a/boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.bin b/boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.bin new file mode 100644 index 0000000..5b9101b Binary files /dev/null and b/boards/ek-lm4f232/usb_stick_update/rvmdk/usb_stick_update.bin differ diff --git a/boards/ek-lm4f232/usb_stick_update/simple_fs.c b/boards/ek-lm4f232/usb_stick_update/simple_fs.c new file mode 100644 index 0000000..9a0394f --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/simple_fs.c @@ -0,0 +1,865 @@ +//***************************************************************************** +// +// simple_fs.c - Functions for simple FAT file system support +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "simple_fs.h" + +//***************************************************************************** +// +// \addtogroup simple_fs_api +// @{ +// +// This file system API should be used as follows: +// - Initialize it by calling SimpleFsInit(). You must supply a pointer to a +// 512 byte buffer that will be used for storing device sector data. +// - "Open" a file by calling SimpleFsOpen() and passing the 8.3-style filename +// as an 11-character string. +// - Read successive sectors from the file by using the convenience macro +// SimpleFsReadFileSector(). +// +// This API does not use any file handles so there is no way to open more than +// one file at a time. There is also no random access into the file, each +// sector must be read in sequence. +// +// The client of this API supplies a 512-byte buffer for storage of data read +// from the device. But this file also maintains an additional, internal +// 512-byte buffer used for caching FAT sectors. This minimizes the amount +// of device reads required to fetch cluster chain entries from the FAT. +// +// The application code (the client) must also provide a function used for +// reading sectors from the storage device, whatever it may be. This allows +// the code in this file to be independent of the type of device used for +// storing the file system. The name of the function is +// SimpleFsReadMediaSector(). +// +//***************************************************************************** + +//***************************************************************************** +// +// Setup a macro for handling packed data structures. +// +//***************************************************************************** +#if defined(ccs) || \ + defined(codered) || \ + defined(gcc) || \ + defined(rvmdk) || \ + defined(__ARMCC_VERSION) || \ + defined(sourcerygxx) +#define PACKED __attribute__((packed)) +#elif defined(ewarm) +#define PACKED +#else +#error "Unrecognized COMPILER!" +#endif + +//***************************************************************************** +// +// Instruct the IAR compiler to pack the following structures. +// +//***************************************************************************** +#ifdef ewarm +#pragma pack(1) +#endif + +//***************************************************************************** +// +// Structures for mapping FAT file system +// +//***************************************************************************** + +//***************************************************************************** +// +// The FAT16 boot sector extension +// +//***************************************************************************** +typedef struct +{ + uint8_t ui8DriveNumber; + uint8_t ui8Reserved; + uint8_t ui8ExtSig; + uint32_t ui32Serial; + char pcVolumeLabel[11]; + char pcFsType[8]; + uint8_t ui8BootCode[448]; + uint16_t ui16Sig; +} +PACKED tBootExt16; + +//***************************************************************************** +// +// The FAT32 boot sector extension +// +//***************************************************************************** +typedef struct +{ + uint32_t ui32SectorsPerFAT; + uint16_t ui16Flags; + uint16_t ui16Version; + uint32_t ui32RootCluster; + uint16_t ui16InfoSector; + uint16_t ui16BootCopy; + uint8_t ui8Reserved[12]; + uint8_t ui8DriveNumber; + uint8_t ui8Reserved1; + uint8_t ui8ExtSig; + uint32_t ui32Serial; + char pcVolumeLabel[11]; + char pcFsType[8]; + uint8_t ui8BootCode[420]; + uint16_t ui16Sig; +} +PACKED tBootExt32; + +//***************************************************************************** +// +// The FAT16/32 boot sector main section +// +//***************************************************************************** +typedef struct +{ + uint8_t ui8Jump[3]; + uint8_t i8OEMName[8]; + uint16_t ui16BytesPerSector; + uint8_t ui8SectorsPerCluster; + uint16_t ui16ReservedSectors; + uint8_t ui8NumFATs; + uint16_t ui16NumRootEntries; + uint16_t ui16TotalSectorsSmall; + uint8_t ui8MediaDescriptor; + uint16_t ui16SectorsPerFAT; + uint16_t ui16SectorsPerTrack; + uint16_t ui16NumberHeads; + uint32_t ui32HiddenSectors; + uint32_t ui32TotalSectorsBig; + union + { + tBootExt16 sExt16; + tBootExt32 sExt32; + } + PACKED ext; +} +PACKED tBootSector; + +//***************************************************************************** +// +// The partition table +// +//***************************************************************************** +typedef struct +{ + uint8_t ui8Status; + uint8_t ui8CHSFirst[3]; + uint8_t ui8Type; + uint8_t ui8CHSLast[3]; + uint32_t ui32FirstSector; + uint32_t ui32NumBlocks; +} +PACKED tPartitionTable; + +//***************************************************************************** +// +// The master boot record (MBR) +// +//***************************************************************************** +typedef struct +{ + uint8_t ui8CodeArea[440]; + uint8_t ui8DiskSignature[4]; + uint8_t ui8Nulls[2]; + tPartitionTable sPartTable[4]; + uint16_t ui16Sig; +} +PACKED tMasterBootRecord; + +//***************************************************************************** +// +// The structure for a single directory entry +// +//***************************************************************************** +typedef struct +{ + char pcFileName[11]; + uint8_t ui8Attr; + uint8_t ui8Reserved; + uint8_t ui8CreateTime[5]; + uint8_t ui8LastDate[2]; + uint16_t ui16ClusterHi; + uint8_t ui8LastModified[4]; + uint16_t ui16Cluster; + uint32_t ui32FileSize; +} +PACKED tDirEntry; + +//***************************************************************************** +// +// Tell the IAR compiler that the remaining structures do not need to be +// packed. +// +//***************************************************************************** +#ifdef ewarm +#pragma pack() +#endif + +//***************************************************************************** +// +// This structure holds information about the layout of the file system +// +//***************************************************************************** +typedef struct +{ + uint32_t ui32FirstSector; + uint32_t ui32NumBlocks; + uint16_t ui16SectorsPerCluster; + uint16_t ui16MaxRootEntries; + uint32_t ui32SectorsPerFAT; + uint32_t ui32FirstFATSector; + uint32_t ui32LastFATSector; + uint32_t ui32FirstDataSector; + uint32_t ui32Type; + uint32_t ui32StartRootDir; +} +tPartitionInfo; + +static tPartitionInfo sPartInfo; + +//***************************************************************************** +// +// A pointer to the client provided sector buffer. +// +//***************************************************************************** +static uint8_t *g_pui8SectorBuf; + +//***************************************************************************** +// +// Initializes the simple file system +// +// \param pui8SectorBuf is a pointer to a caller supplied 512-byte buffer +// that will be used for holding sectors that are loaded from the media +// storage device. +// +// Reads the MBR, partition table, and boot record to find the logical +// structure of the file system. This function stores the file system +// structural data internally so that the remaining functions of the API +// can read the file system. +// +// To read data from the storage device, the function SimpleFsReadMediaSector() +// will be called. This function is not implemented here but must be +// implemented by the user of this simple file system. +// +// This file system support is extremely simple-minded. It will only +// find the first partition of a FAT16 or FAT32 formatted mass storage +// device. Only very minimal error checking is performed in order to save +// code space. +// +// \return Zero if successful, non-zero if there was an error. +// +//***************************************************************************** +uint32_t +SimpleFsInit(uint8_t *pui8SectorBuf) +{ + tMasterBootRecord *pMBR; + tPartitionTable *pPart; + tBootSector *pBoot; + + // + // Save the sector buffer pointer. The input parameter is assumed + // to be good. + // + g_pui8SectorBuf = pui8SectorBuf; + + // + // Get the MBR + // + if(SimpleFsReadMediaSector(0, pui8SectorBuf)) + { + return(1); + } + + // + // Verify MBR signature - bare minimum validation of MBR. + // + pMBR = (tMasterBootRecord *)pui8SectorBuf; + if(pMBR->ui16Sig != 0xAA55) + { + return(1); + } + + // + // See if this is a MBR or a boot sector. + // + pBoot = (tBootSector *)pui8SectorBuf; + if((strncmp(pBoot->ext.sExt16.pcFsType, "FAT", 3) != 0) && + (strncmp(pBoot->ext.sExt32.pcFsType, "FAT32", 5) != 0)) + { + // + // Get the first partition table + // + pPart = &(pMBR->sPartTable[0]); + + // + // Could optionally check partition type here ... + // + + // + // Get the partition location and size + // + sPartInfo.ui32FirstSector = pPart->ui32FirstSector; + sPartInfo.ui32NumBlocks = pPart->ui32NumBlocks; + + // + // Read the boot sector from the partition + // + if(SimpleFsReadMediaSector(sPartInfo.ui32FirstSector, pui8SectorBuf)) + { + return(1); + } + } + else + { + // + // Extract the number of sectors from the boot sector. + // + sPartInfo.ui32FirstSector = 0; + if(pBoot->ui16TotalSectorsSmall == 0) + { + sPartInfo.ui32NumBlocks = pBoot->ui32TotalSectorsBig; + } + else + { + sPartInfo.ui32NumBlocks = pBoot->ui16TotalSectorsSmall; + } + } + + // + // Get pointer to the boot sector + // + if(pBoot->ext.sExt16.ui16Sig != 0xAA55) + { + return(1); + } + + // + // Verify the sector size is 512. We can't deal with anything else + // + if(pBoot->ui16BytesPerSector != 512) + { + return(1); + } + + // + // Extract some info from the boot record + // + sPartInfo.ui16SectorsPerCluster = pBoot->ui8SectorsPerCluster; + sPartInfo.ui16MaxRootEntries = pBoot->ui16NumRootEntries; + + // + // Decide if we are dealing with FAT16 or FAT32. + // If number of root entries is 0, that suggests FAT32 + // + if(sPartInfo.ui16MaxRootEntries == 0) + { + // + // Confirm FAT 32 signature in the expected place + // + if(!strncmp(pBoot->ext.sExt32.pcFsType, "FAT32 ", 8)) + { + sPartInfo.ui32Type = 32; + } + else + { + return(1); + } + } + // + // Root entries is non-zero, suggests FAT16 + // + else + { + // + // Confirm FAT16 signature + // + if(!strncmp(pBoot->ext.sExt16.pcFsType, "FAT16 ", 8)) + { + sPartInfo.ui32Type = 16; + } + else + { + return(1); + } + } + + // + // Find the beginning of the FAT, in absolute sectors + // + sPartInfo.ui32FirstFATSector = sPartInfo.ui32FirstSector + + pBoot->ui16ReservedSectors; + + // + // Find the end of the FAT in absolute sectors. FAT16 and 32 + // are handled differently. + // + sPartInfo.ui32SectorsPerFAT = (sPartInfo.ui32Type == 16) ? + pBoot->ui16SectorsPerFAT : + pBoot->ext.sExt32.ui32SectorsPerFAT; + sPartInfo.ui32LastFATSector = sPartInfo.ui32FirstFATSector + + sPartInfo.ui32SectorsPerFAT - 1; + + // + // Find the start of the root directory and the data area. + // For FAT16, the root will be stored as an absolute sector number + // For FAT32, the root will be stored as the starting cluster of the root + // The data area start is the absolute first sector of the data area. + // + if(sPartInfo.ui32Type == 16) + { + sPartInfo.ui32StartRootDir = sPartInfo.ui32FirstFATSector + + (sPartInfo.ui32SectorsPerFAT * + pBoot->ui8NumFATs); + sPartInfo.ui32FirstDataSector = sPartInfo.ui32StartRootDir + + (sPartInfo.ui16MaxRootEntries / 16); + } + else + { + sPartInfo.ui32StartRootDir = pBoot->ext.sExt32.ui32RootCluster; + sPartInfo.ui32FirstDataSector = sPartInfo.ui32FirstFATSector + + (sPartInfo.ui32SectorsPerFAT * pBoot->ui8NumFATs); + } + + // + // At this point the file system has been initialized, so return + // success to the caller. + // + return(0); +} + +//***************************************************************************** +// +// Find the next cluster in a FAT chain +// +// \param ui32ThisCluster is the current cluster in the chain +// +// Reads the File Allocation Table (FAT) of the file system to find the +// next cluster in a chain of clusters. The current cluster is passed in +// and the next cluster in the chain will be returned. +// +// This function reads sectors from the storage device as needed in order +// to parse the FAT tables. Error handling is minimal since there is not +// much that can be done if an error is encountered. If any error is +// encountered, or if this is the last cluster in the chain, then 0 is +// returned. This signals the caller to stop traversing the chain (either +// due to error or end of chain). +// +// The function maintains a cache of a single sector from the FAT. It only +// reads in a new FAT sector if the requested cluster is not in the +// currently cached sector. +// +// \return Next cluster number if successful, 0 if this is the last cluster +// or any error is found. +// +//***************************************************************************** +static uint32_t +SimpleFsGetNextCluster(uint_fast32_t ui32ThisCluster) +{ + static uint8_t ui8FATCache[512]; + static uint_fast32_t ui32CachedFATSector = (uint32_t)-1; + uint_fast32_t ui32ClustersPerFATSector; + uint_fast32_t ui32ClusterIdx; + uint_fast32_t ui32FATSector; + uint_fast32_t ui32NextCluster; + uint_fast32_t ui32MaxCluster; + + // + // Compute the maximum possible reasonable cluster number + // + ui32MaxCluster = sPartInfo.ui32NumBlocks / sPartInfo.ui16SectorsPerCluster; + + // + // Make sure cluster input number is reasonable. If not then return + // 0 indicating error. + // + if((ui32ThisCluster < 2) || (ui32ThisCluster > ui32MaxCluster)) + { + return(0); + } + + // + // Compute the index of the requested cluster within the sector. + // Also compute the sector number within the FAT that contains the + // entry for the requested cluster. + // + ui32ClustersPerFATSector = (sPartInfo.ui32Type == 16) ? 256 : 128; + ui32ClusterIdx = ui32ThisCluster % ui32ClustersPerFATSector; + ui32FATSector = ui32ThisCluster / ui32ClustersPerFATSector; + + // + // Check to see if the FAT sector we need is already cached + // + if(ui32FATSector != ui32CachedFATSector) + { + // + // FAT sector we need is not cached, so read it in + // + if(SimpleFsReadMediaSector(sPartInfo.ui32FirstFATSector + ui32FATSector, + ui8FATCache) != 0) + { + // + // There was an error so mark cache as unavailable and return + // an error. + // + ui32CachedFATSector = (uint32_t)-1; + return(0); + } + + // + // Remember which FAT sector was just loaded into the cache. + // + ui32CachedFATSector = ui32FATSector; + } + + // + // Now look up the next cluster value from the cached sector, using this + // requested cluster as an index. It needs to be indexed as 16 or 32 + // bit values depending on whether it is FAT16 or 32 + // If the cluster value means last cluster, then return 0 + // + if(sPartInfo.ui32Type == 16) + { + ui32NextCluster = ((uint16_t *)ui8FATCache)[ui32ClusterIdx]; + if(ui32NextCluster >= 0xFFF8) + { + return(0); + } + } + else + { + ui32NextCluster = ((uint32_t *)ui8FATCache)[ui32ClusterIdx]; + if(ui32NextCluster >= 0x0FFFFFF8) + { + return(0); + } + } + + // + // Check new cluster value to make sure it is reasonable. If not then + // return 0 to indicate an error. + // + if((ui32NextCluster >= 2) && (ui32NextCluster <= ui32MaxCluster)) + { + return(ui32NextCluster); + } + else + { + return(0); + } +} + +//***************************************************************************** +// +// Read a single sector from a file into the sector buffer +// +// \param ui32StartCluster is the first cluster of the file, used to +// initialize the file read. Use 0 for successive sectors. +// +// Reads sectors in sequence from a file and stores the data in the sector +// buffer that was passed in the initial call to SimpleFsInit(). The function +// is initialized with the file to read by passing the starting cluster of +// the file. The function will initialize some static data and return. It +// does not read any file data when passed a starting cluster (and +// returns 0 - this is normal). +// +// Once the function has been initialized with the file's starting cluster, +// then successive calls should be made, passing a value of 0 for the +// cluster number. This tells the function to read the next sector from the +// file and store it in the sector buffer. The function remembers the last +// sector that was read, and each time it is called with a cluster value of +// 0, it will read the next sector. The function will traverse the FAT +// chain as needed to read all the sectors. When a sector has been +// successfully read from a file, the function will return non-zero. When +// there are no more sectors to read, or any error is encountered, the +// function will return 0. +// +// Note that the function always reads a whole sector, even if the end of +// a file does not fill the last sector. It is the responsibility of the +// caller to track the file size and to deal with a partially full last +// sector. +// +// \return Non-zero if a sector was read into the sector buffer, or +// 0 if there are no more sectors or if any error occurred. +// +//***************************************************************************** +uint32_t +SimpleFsGetNextFileSector(uint_fast32_t ui32StartCluster) +{ + static uint_fast32_t ui32WorkingCluster = 0; + static uint_fast32_t ui32WorkingSector; + uint_fast32_t ui32ReadSector; + + // + // If user specified starting cluster, then init the working cluster + // and sector values + // + if(ui32StartCluster) + { + ui32WorkingCluster = ui32StartCluster; + ui32WorkingSector = 0; + return(0); + } + + // + // Otherwise, make sure there is a valid working cluster already + // + else if(ui32WorkingCluster == 0) + { + return(0); + } + + // + // If the current working sector is the same as sectors per cluster, + // then that means that the next cluster needs to be loaded. + // + if(ui32WorkingSector == sPartInfo.ui16SectorsPerCluster) + { + // + // Get the next cluster in the chain for this file. + // + ui32WorkingCluster = SimpleFsGetNextCluster(ui32WorkingCluster); + + // + // If the next cluster is valid, then reset the working sector + // + if(ui32WorkingCluster) + { + ui32WorkingSector = 0; + } + + // + // Next cluster is not valid, or this was the end of the chain. + // Clear the working cluster and return an indication that no new + // sector data was loaded. + // + else + { + ui32WorkingCluster = 0; + return(0); + } + } + + // + // Calculate the sector to read from. It is the sector of the start + // of the working cluster, plus the working sector (the sector within + // the cluster), plus the offset to the start of the data area. + // Note that the cluster needs to be reduced by 2 in order to index + // properly into the data area. That is a feature of FAT file system. + // + ui32ReadSector = (ui32WorkingCluster - 2) * sPartInfo.ui16SectorsPerCluster; + ui32ReadSector += ui32WorkingSector; + ui32ReadSector += sPartInfo.ui32FirstDataSector; + + // + // Attempt to read the next sector from the cluster. If not successful, + // then clear the working cluster and return a non-success indication. + // + if(SimpleFsReadMediaSector(ui32ReadSector, g_pui8SectorBuf) != 0) + { + ui32WorkingCluster = 0; + return(0); + } + else + { + // + // Read was successful. Increment to the next sector of the cluster + // and return a success indication. + // + ui32WorkingSector++; + return(1); + } +} + +//***************************************************************************** +// +// Find a file in the root directory of the file system and open it for +// reading. +// +// \param pcName83 is an 11-character string that represents the 8.3 file +// name of the file to open. +// +// This function traverses the root directory of the file system to find +// the file name specified by the caller. Note that the file name must be +// an 8.3 file name that is 11 characters int32_t. The first 8 characters are +// the base name and the last 3 characters are the extension. If there are +// fewer characters in the base name or extension, the name should be padded +// with spaces. For example "myfile.bn" has fewer than 11 characters, and +// should be passed with padding like this: "myfile bn ". Note the extra +// spaces, and that the dot ('.') is not part of the string that is passed +// to this function. +// +// If the file is found, then it initializes the file for reading, and returns +// the file length. The file can be read by making successive calls to +// SimpleFsReadFileSector(). +// +// The function only searches the root directory and ignores any +// subdirectories. It also ignores any int32_t file name entries, looking only +// at the 8.3 file name for a match. +// +// \return The size of the file if it is found, or 0 if the file could not +// be found. +// +//***************************************************************************** +uint32_t +SimpleFsOpen(char *pcName83) +{ + tDirEntry *pDirEntry; + uint_fast32_t ui32DirSector; + uint_fast32_t ui32FirstCluster; + + // + // Find starting root dir sector, only used for FAT16 + // If FAT32 then this is the first cluster of root dir + // + ui32DirSector = sPartInfo.ui32StartRootDir; + + // + // For FAT32, root dir is like a file, so init a file read of the root dir + // + if(sPartInfo.ui32Type == 32) + { + SimpleFsGetNextFileSector(ui32DirSector); + } + + // + // Search the root directory entry for the firmware file + // + while(1) + { + // + // Read in a directory block. + // + if(sPartInfo.ui32Type == 16) + { + // + // For FAT16, read in a sector of the root directory + // + if(SimpleFsReadMediaSector(ui32DirSector, g_pui8SectorBuf)) + { + return(0); + } + } + else + { + // + // For FAT32, the root directory is treated like a file. + // The root directory sector will be loaded into the sector buf + // + if(SimpleFsGetNextFileSector(0) == 0) + { + return(0); + } + } + + // + // Initialize the directory entry pointer to the first entry of + // this sector. + // + pDirEntry = (tDirEntry *)g_pui8SectorBuf; + + // + // Iterate through all the directory entries in this sector + // + while((uint8_t *)pDirEntry < &g_pui8SectorBuf[512]) + { + // + // If the 8.3 filename of this entry matches the firmware + // file name, then we have a match, so return a pointer to + // this entry. + // + if(!strncmp(pDirEntry->pcFileName, pcName83, 11)) + { + // + // Compute the starting cluster of the file + // + ui32FirstCluster = pDirEntry->ui16Cluster; + if(sPartInfo.ui32Type == 32) + { + // + // For FAT32, add in the upper word of the + // starting cluster number + // + ui32FirstCluster += pDirEntry->ui16ClusterHi << 16; + } + + // + // Initialize the start of the file + // + SimpleFsGetNextFileSector(ui32FirstCluster); + return(pDirEntry->ui32FileSize); + } + + // + // Advance to the next entry in this sector. + // + pDirEntry++; + } + + // + // Need to get the next sector in the directory. Handled + // differently depending on if this is FAT16 or 32 + // + if(sPartInfo.ui32Type == 16) + { + // + // FAT16: advance sectors as int32_t as there are more possible + // entries. + // + sPartInfo.ui16MaxRootEntries -= 512 / 32; + if(sPartInfo.ui16MaxRootEntries) + { + ui32DirSector++; + } + else + { + // + // Ran out of directory entries and didn't find the file, + // so return a null. + // + return(0); + } + } + else + { + // + // FAT32: there is nothing to compute here. The next root + // dir sector will be fetched at the top of the loop + // + } + } +} + +//***************************************************************************** +// +// Close the Doxygen group. +// @} +// +//***************************************************************************** diff --git a/boards/ek-lm4f232/usb_stick_update/simple_fs.h b/boards/ek-lm4f232/usb_stick_update/simple_fs.h new file mode 100644 index 0000000..08f7894 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/simple_fs.h @@ -0,0 +1,105 @@ +//***************************************************************************** +// +// simple_fs.h - Header for simple FAT file system support +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#ifndef __SIMPLE_FS_H__ +#define __SIMPLE_FS_H__ + +//***************************************************************************** +// +// \addtogroup simple_fs_api +// @{ +// +//***************************************************************************** + +//***************************************************************************** +// +// Macro to read a single sector from a file that was opened with +// SimpleFsOpen() +// +// This convenience macro maps to the function SimpleFsGetNextFileSector() +// called with a parameter of 0. It should be used to read successive +// sectors from a file after the file has been opened with SimpleFsOpen(). +// +// When a sector is read, it is loaded into the sector buffer that was passed +// when SimpleFsInit() was called. +// +// A non-zero value will be returned to the caller as int32_t as successive +// sectors are successfully read into the sector buffer. At the end of the +// file, or if there is any error, then a value of 0 is returned. +// +// Note that the a whole sector is always loaded, even if the end of +// a file does not fill the last sector. It is the responsibility of the +// caller to track the file size and to deal with a partially full last +// sector. +// +// \return Non-zero if a sector was read into the sector buffer, or +// 0 if there are no more sectors or if any error occurred. +// +//***************************************************************************** +#define SimpleFsReadFileSector() SimpleFsGetNextFileSector(0) + +//***************************************************************************** +// +// Read a single sector from the application-specific storage device into +// the sector buffer. +// +// \param ui32Sector is the absolute sector number to read from the storage +// device +// \param pui8SectorBuf is a pointer to a 512 byte buffer where the sector +// data should be written +// +// This function is used by the simple file system functions to read a sector +// of data from a storage device. It must be implemented as part of the +// application specific code. For example, it could be used to read sectors +// from a USB mass storage device, or from an SD card, or any device that can +// be used to store a FAT file system. Note that the sector size is always +// assumed to be 512 bytes. +// +// \return Zero value if a sector of data was successfully read from the +// device and stored in the sector buffer, non-zero if not successful. +// +//***************************************************************************** +// +// This function to be supplied by the client +// +extern uint32_t SimpleFsReadMediaSector(uint_fast32_t ui32Sector, + uint8_t *pui8SectorBuf); + +//***************************************************************************** +// +// Close the Doxygen group. +// @} +// +//***************************************************************************** + +//***************************************************************************** +// +// Functions to help with accessing the FAT file system on a storage device +// +//**************************************************************************** +extern uint32_t SimpleFsInit(uint8_t *pui8SectorBuf); +extern uint32_t SimpleFsOpen(char *pcName83); +extern uint32_t SimpleFsGetNextFileSector(uint_fast32_t ui32StartCluster); + +#endif // __SIMPLE_FS_H__ diff --git a/boards/ek-lm4f232/usb_stick_update/startup_ccs.c b/boards/ek-lm4f232/usb_stick_update/startup_ccs.c new file mode 100644 index 0000000..49bc1f5 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/startup_ccs.c @@ -0,0 +1,303 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void AppForceUpdate(void); +extern void USB0HostIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + AppForceUpdate, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0HostIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_stick_update/startup_ewarm.c b/boards/ek-lm4f232/usb_stick_update/startup_ewarm.c new file mode 100644 index 0000000..9eb457b --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/startup_ewarm.c @@ -0,0 +1,334 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void AppForceUpdate(void); +extern void USB0HostIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + AppForceUpdate, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0HostIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_stick_update/startup_gcc.c b/boards/ek-lm4f232/usb_stick_update/startup_gcc.c new file mode 100644 index 0000000..5784463 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/startup_gcc.c @@ -0,0 +1,350 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declarations for the interrupt handlers used by the application. +// +//***************************************************************************** +extern void AppForceUpdate(void); +extern void USB0HostIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[256]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + AppForceUpdate, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + IntDefaultHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + USB0HostIntHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/usb_stick_update/startup_rvmdk.S b/boards/ek-lm4f232/usb_stick_update/startup_rvmdk.S new file mode 100644 index 0000000..3b73160 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/startup_rvmdk.S @@ -0,0 +1,359 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000400 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declarations for the interrupt handlers used by the application. +; +;****************************************************************************** + EXTERN AppForceUpdate + EXTERN USB0HostIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD AppForceUpdate ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD IntDefaultHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD USB0HostIntHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.c b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.c new file mode 100644 index 0000000..971d315 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.c @@ -0,0 +1,929 @@ +//***************************************************************************** +// +// usb_stick_update.c - Example to update flash from a USB memory stick. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include +#include "inc/hw_flash.h" +#include "inc/hw_gpio.h" +#include "inc/hw_memmap.h" +#include "inc/hw_nvic.h" +#include "inc/hw_sysctl.h" +#include "inc/hw_types.h" +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom.h" +#include "driverlib/rom_map.h" +#include "driverlib/sysctl.h" +#include "driverlib/udma.h" +#include "usblib/usblib.h" +#include "usblib/usbmsc.h" +#include "usblib/host/usbhost.h" +#include "usblib/host/usbhmsc.h" +#include "simple_fs.h" + +//***************************************************************************** +// +// Defines the number of times to call to check if the attached device is +// ready. +// +//***************************************************************************** +#define USBMSC_DRIVE_RETRY 4 + +//***************************************************************************** +// +//! \addtogroup example_list +//!

USB Memory Stick Updater (usb_stick_update)

+//! +//! This example application behaves the same way as a boot loader. It resides +//! at the beginning of flash, and will read a binary file from a USB memory +//! stick and program it into another location in flash. Once the user +//! application has been programmed into flash, this program will always start +//! the user application until requested to load a new application. +//! +//! When this application starts, if there is a user application already in +//! flash (at \b APP_START_ADDRESS), then it will just run the user application. +//! It will attempt to load a new application from a USB memory stick under +//! the following conditions: +//! +//! - no user application is present at \b APP_START_ADDRESS +//! - the user application has requested an update by transferring control +//! to the updater +//! - the user holds down the eval board push button when the board is reset +//! +//! When this application is attempting to perform an update, it will wait +//! forever for a USB memory stick to be plugged in. Once a USB memory stick +//! is found, it will search the root directory for a specific file name, which +//! is \e FIRMWARE.BIN by default. This file must be a binary image of the +//! program you want to load (the .bin file), linked to run from the correct +//! address, at \b APP_START_ADDRESS. +//! +//! The USB memory stick must be formatted as a FAT16 or FAT32 file system +//! (the normal case), and the binary file must be located in the root +//! directory. Other files can exist on the memory stick but they will be +//! ignored. +// +//***************************************************************************** + +//***************************************************************************** +// +// The name of the binary firmware file on the USB stick. This is the user +// application that will be searched for and loaded into flash if it is found. +// Note that the name of the file must be 11 characters total, 8 for the base +// name and 3 for the extension. If the actual file name has fewer characters +// then it must be padded with spaces. This macro should not contain the dot +// "." for the extension. +// +// Examples: firmware.bin --> "FIRMWAREBIN" +// myfile.bn --> "MYFILE BN " +// +//***************************************************************************** +#define USB_UPDATE_FILENAME "FIRMWAREBIN" + +//***************************************************************************** +// +// The size of the flash for this microcontroller. +// +//***************************************************************************** +#define FLASH_SIZE (256 * 1024) + +//***************************************************************************** +// +// The starting address for the application that will be loaded into flash +// memory from the USB stick. This address must be high enough to be above +// the USB stick updater, and must be on a 1K boundary. +// Note that the application that will be loaded must also be linked to run +// from this address. +// +//***************************************************************************** +#define APP_START_ADDRESS 0x4800 + +//***************************************************************************** +// +// A memory location and value that is used to indicate that the application +// wants to force an update. +// +//***************************************************************************** +#define FORCE_UPDATE_ADDR 0x20004000 +#define FORCE_UPDATE_VALUE 0x1234cdef + +//***************************************************************************** +// +// The prototype for the function that is used to call the user application. +// +//***************************************************************************** +void CallApplication(uint_fast32_t ui32StartAddr); + +//***************************************************************************** +// +// The control table used by the uDMA controller. This table must be aligned +// to a 1024 byte boundary. In this application uDMA is only used for USB, +// so only the first 6 channels are needed. +// +//***************************************************************************** +#if defined(ewarm) +#pragma data_alignment=1024 +tDMAControlTable g_sDMAControlTable[6]; +#elif defined(ccs) +#pragma DATA_ALIGN(g_sDMAControlTable, 1024) +tDMAControlTable g_sDMAControlTable[6]; +#else +tDMAControlTable g_sDMAControlTable[6] __attribute__ ((aligned(1024))); +#endif + +//***************************************************************************** +// +// The global that holds all of the host drivers in use in the application. +// In this case, only the MSC class is loaded. +// +//***************************************************************************** +static tUSBHostClassDriver const * const g_ppHostClassDrivers[] = +{ + &g_sUSBHostMSCClassDriver +}; + +//***************************************************************************** +// +// This global holds the number of class drivers in the g_ppHostClassDrivers +// list. +// +//***************************************************************************** +#define NUM_CLASS_DRIVERS (sizeof(g_ppHostClassDrivers) / \ + sizeof(g_ppHostClassDrivers[0])) + +//***************************************************************************** +// +// Hold the current state for the application. +// +//***************************************************************************** +volatile enum +{ + // + // No device is present. + // + STATE_NO_DEVICE, + + // + // Mass storage device is being enumerated. + // + STATE_DEVICE_ENUM, +} +g_eState; + +//***************************************************************************** +// +// The instance data for the MSC driver. +// +//***************************************************************************** +tUSBHMSCInstance *g_psMSCInstance = 0; + +//***************************************************************************** +// +// The size of the host controller's memory pool in bytes. +// +//***************************************************************************** +#define HCD_MEMORY_SIZE 128 + +//***************************************************************************** +// +// The memory pool to provide to the Host controller driver. +// +//***************************************************************************** +uint8_t g_pHCDPool[HCD_MEMORY_SIZE]; + +//***************************************************************************** +// +// A buffer for holding sectors read from the storage device +// +//***************************************************************************** +static uint8_t g_ui8SectorBuf[512]; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ + for(;;) + { + } +} +#endif + +//***************************************************************************** +// +// Read a sector from the USB mass storage device. +// +// \param ui32Sector is the sector to read from the connected USB mass storage +// device (memory stick) +// \param pui8Buf is a pointer to the buffer where the sector data should be +// stored +// +// This is the application-specific implementation of a function to read +// sectors from a storage device, in this case a USB mass storage device. +// This function is called from the \e simple_fs.c file when it needs to read +// data from the storage device. +// +// \return Non-zero if data was read from the device, 0 if no data was read. +// +//***************************************************************************** +uint32_t +SimpleFsReadMediaSector(uint_fast32_t ui32Sector, uint8_t *pui8Buf) +{ + // + // Return the requested sector from the connected USB mass storage + // device. + // + return(USBHMSCBlockRead(g_psMSCInstance, ui32Sector, pui8Buf, 1)); +} + +//***************************************************************************** +// +// This is the callback from the MSC driver. +// +// \param ui32Instance is the driver instance which is needed when communicating +// with the driver. +// \param ui32Event is one of the events defined by the driver. +// \param pvData is a pointer to data passed into the initial call to register +// the callback. +// +// This function handles callback events from the MSC driver. The only events +// currently handled are the \b MSC_EVENT_OPEN and \b MSC_EVENT_CLOSE. This +// allows the main routine to know when an MSC device has been detected and +// enumerated and when an MSC device has been removed from the system. +// +// \return Returns \e true on success or \e false on failure. +// +//***************************************************************************** +static void +MSCCallback(tUSBHMSCInstance *psMSCInstance, uint32_t ui32Event, void *pvData) +{ + // + // Determine the event. + // + switch(ui32Event) + { + // + // Called when the device driver has successfully enumerated an MSC + // device. + // + case MSC_EVENT_OPEN: + { + // + // Proceed to the enumeration state. + // + g_eState = STATE_DEVICE_ENUM; + break; + } + + // + // Called when the device driver has been unloaded due to error or + // the device is no longer present. + // + case MSC_EVENT_CLOSE: + { + // + // Go back to the "no device" state and wait for a new connection. + // + g_eState = STATE_NO_DEVICE; + break; + } + + default: + { + break; + } + } +} + +//***************************************************************************** +// +// Read the application image from the file system and program it into flash. +// +// This function will attempt to open and read the firmware image file from +// the mass storage device. If the file is found it will be programmed into +// flash. The name of the file to be read is configured by the macro +// \b USB_UPDATE_FILENAME. It will be programmed into flash starting at the +// address specified by APP_START_ADDRESS. +// +// \return Zero if successful or non-zero if the file cannot be read or +// programmed. +// +//***************************************************************************** +uint32_t +ReadAppAndProgram(void) +{ + uint_fast32_t ui32FlashEnd; + uint_fast32_t ui32FileSize; + uint_fast32_t ui32DataSize; + uint_fast32_t ui32Remaining; + uint_fast32_t ui32ProgAddr; + uint_fast32_t ui32SavedRegs[2]; + volatile uint_fast32_t ui32Idx; + uint_fast32_t ui32DriveTimeout; + + // + // Initialize the drive timeout. + // + ui32DriveTimeout = USBMSC_DRIVE_RETRY; + + // + // Check to see if the mass storage device is ready. Some large drives + // take a while to be ready, so retry until they are ready. + // + while(USBHMSCDriveReady(g_psMSCInstance)) + { + // + // Wait about 500ms before attempting to check if the + // device is ready again. + // + SysCtlDelay(SysCtlClockGet()/(3*2)); + + // + // Decrement the retry count. + // + ui32DriveTimeout--; + + // + // If the timeout is hit then return with a failure. + // + if(ui32DriveTimeout == 0) + { + return(1); + } + } + + // + // Initialize the file system and return if error. + // + if(SimpleFsInit(g_ui8SectorBuf)) + { + return(1); + } + + // + // Attempt to open the firmware file, retrieving the file/image size. + // A file size of error means the file was not there, or there was an + // error. + // + ui32FileSize = SimpleFsOpen(USB_UPDATE_FILENAME); + if(ui32FileSize == 0) + { + return(1); + } + + // + // Get the size of flash. This is the ending address of the flash. + // If reserved space is configured, then the ending address is reduced + // by the amount of the reserved block. + // + ui32FlashEnd = FLASH_SIZE; +#ifdef FLASH_RSVD_SPACE + ui32FlashEnd -= FLASH_RSVD_SPACE; +#endif + + // + // If flash code protection is not used, then change the ending address + // to be the ending of the application image. This will be the highest + // flash page that will be erased and so only the necessary pages will + // be erased. If flash code protection is enabled, then all of the + // application area pages will be erased. + // +#ifndef FLASH_CODE_PROTECTION + ui32FlashEnd = ui32FileSize + APP_START_ADDRESS; +#endif + + // + // Check to make sure the file size is not too large to fit in the flash. + // If it is too large, then return an error. + // + if((ui32FileSize + APP_START_ADDRESS) > ui32FlashEnd) + { + return(1); + } + + // + // Enter a loop to erase all the requested flash pages beginning at the + // application start address (above the USB stick updater). + // + for(ui32Idx = APP_START_ADDRESS; ui32Idx < ui32FlashEnd; ui32Idx += 1024) + { + ROM_FlashErase(ui32Idx); + } + + // + // Enter a loop to read sectors from the application image file and + // program into flash. Start at the user app start address (above the USB + // stick updater). + // + ui32ProgAddr = APP_START_ADDRESS; + ui32Remaining = ui32FileSize; + while(SimpleFsReadFileSector()) + { + // + // Compute how much data was read from this sector and adjust the + // remaining amount. + // + ui32DataSize = ui32Remaining >= 512 ? 512 : ui32Remaining; + ui32Remaining -= ui32DataSize; + + // + // Special handling for the first block of the application. + // This block contains as the first two location the application's + // initial stack pointer and instruction pointer. The USB updater + // relied on the values in these locations to determine if a valid + // application is present. When there is a valid application the + // updater runs the user application. Otherwise the updater attempts + // to load a new application. + // In order to prevent a partially programmed imaged (due to some + // error occurring while programming), the first two locations are + // not programmed until all of the rest of the image has been + // successfully loaded into the flash. This way if there is some error, + // the updater will detect that a user application is not present and + // will not attempt to run it. + // + // For the first block, do not program the first two word locations + // (8 bytes). These two words will be programmed later, after + // everything else. + // + if(ui32ProgAddr == APP_START_ADDRESS) + { + uint32_t *pui32Temp; + + pui32Temp = (uint32_t *)g_ui8SectorBuf; + ui32SavedRegs[0] = pui32Temp[0]; + ui32SavedRegs[1] = pui32Temp[1]; + + // + // Call the function to program a block of flash. Skip the first + // two words (8 bytes) since these contain the initial SP and PC. + // + ROM_FlashProgram((uint32_t *)&g_ui8SectorBuf[8], + ui32ProgAddr + 8, + ((ui32DataSize - 8) + 3) & ~3); + } + + // + // All other blocks except the first block + // + else + { + // + // Call the function to program a block of flash. The length of the + // block passed to the flash function must be divisible by 4. + // + ROM_FlashProgram((uint32_t *)g_ui8SectorBuf, ui32ProgAddr, + (ui32DataSize + 3) & ~3); + } + + // + // If there is more image to program, then update the programming + // address. Progress will continue to the next iteration of + // the while loop. + // + if(ui32Remaining) + { + ui32ProgAddr += ui32DataSize; + } + + // + // Otherwise we are done programming so perform final steps. + // Program the first two words of the image that were saved earlier, + // and return a success indication. + // + else + { + ROM_FlashProgram((uint32_t *)ui32SavedRegs, APP_START_ADDRESS, + 8); + + return(0); + } + } + + // + // If we make it here, that means that an attempt to read a sector of + // data from the device was not successful. That means that the complete + // user app has not been programmed into flash, so just return an error + // indication. + // + return(1); +} + +//***************************************************************************** +// +// This is the main routine for performing an update from a mass storage +// device. +// +// This function forms the main loop of the USB stick updater. It polls for +// a USB mass storage device to be connected, Once a device is connected +// it will attempt to read a firmware image from the device and load it into +// flash. +// +// \return None. +// +//***************************************************************************** +void +UpdaterUSB(void) +{ + // + // Loop forever, running the USB host driver. + // + while(1) + { + USBHCDMain(); + + // + // Check for a state change from the USB driver. + // + switch(g_eState) + { + // + // This state means that a mass storage device has been + // plugged in and enumerated. + // + case STATE_DEVICE_ENUM: + { + // + // Attempt to read the application image from the storage + // device and load it into flash memory. + // + if(ReadAppAndProgram()) + { + // + // There was some error reading or programming the app, + // so reset the state to no device which will cause a + // wait for a new device to be plugged in. + // + g_eState = STATE_NO_DEVICE; + } + else + { + // + // User app load and programming was successful, so reboot + // the micro. Perform a software reset request. This + // will cause the microcontroller to reset; no further + // code will be executed. + // + HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | + NVIC_APINT_SYSRESETREQ; + + // + // The microcontroller should have reset, so this should + // never be reached. Just in case, loop forever. + // + while(1) + { + } + } + break; + } + + // + // This state means that there is no device present, so just + // do nothing until something is plugged in. + // + case STATE_NO_DEVICE: + { + break; + } + } + } +} + +//***************************************************************************** +// +// Configure the USB controller and power the bus. +// +// This function configures the USB controller for host operation. +// It is assumed that the main system clock has been configured at this point. +// +// \return None. +// +//***************************************************************************** +void +ConfigureUSBInterface(void) +{ + // + // Enable the uDMA controller and set up the control table base. + // This is required by usblib. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); + uDMAEnable(); + uDMAControlBaseSet(g_sDMAControlTable); + + // + // Enable the USB controller. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); + + // + // Set the USB pins to be controlled by the USB controller. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN); + ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7); + ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Register the host class driver + // + USBHCDRegisterDrivers(0, g_ppHostClassDrivers, NUM_CLASS_DRIVERS); + + // + // Open an instance of the mass storage class driver. + // + g_psMSCInstance = USBHMSCDriveOpen(0, MSCCallback); + + // + // Initialize the power configuration. This sets the power enable signal + // to be active high and does not enable the power fault. + // + USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER); + + // + // Force the USB mode to host with no callback on mode changes since + // there should not be any. + // + USBStackModeSet(0, eUSBModeForceHost, 0); + + // + // Wait 10ms for the pin to go low. + // + SysCtlDelay(SysCtlClockGet()/100); + + // + // Initialize the host controller. + // + USBHCDInit(0, g_pHCDPool, HCD_MEMORY_SIZE); +} + +//***************************************************************************** +// +// Generic configuration is handled in this function. +// +// This function is called by the start up code to perform any configuration +// necessary before calling the update routine. It is responsible for setting +// the system clock to the expected rate and setting flash programming +// parameters prior to calling ConfigureUSBInterface() to set up the USB +// hardware. +// +// \return None. +// +//***************************************************************************** +void +UpdaterMain(void) +{ + // + // Make sure NVIC points at the correct vector table. + // + HWREG(NVIC_VTABLE) = 0; + + // + // Set the system clock to run at 50MHz from the PLL. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Configure the USB interface and power the bus. + // + ConfigureUSBInterface(); + + // + // Call the updater function. This will attempt to load a new image + // into flash from a USB memory stick. + // + UpdaterUSB(); +} + +//***************************************************************************** +// +// Main entry point for the USB stick update example. +// +// This function will check to see if a flash update should be performed from +// the USB memory stick, or if the user application should just be run without +// any update. +// +// The following checks are made, any of which mean that an update should be +// performed: +// - the PC and SP for the user app do not appear to be valid +// - a memory location contains a certain value, meaning the user app wants +// to force an update +// - the user button on the eval board is being pressed, meaning the user wants +// to force an update even if there is a valid user app in memory +// +// If any of the above checks are true, then that means that an update should +// be attempted. The USB stick updater will then wait for a USB stick to be +// plugged in, and once it is look for a firmware update file. +// +// If none of the above checks are true, then the user application that is +// already in flash is run and no update is performed. +// +// \return None. +// +//***************************************************************************** +int +main(void) +{ + uint32_t *pui32App; + + // + // See if the first location is 0xfffffffff or something that does not + // look like a stack pointer, or if the second location is 0xffffffff or + // something that does not look like a reset vector. + // + pui32App = (uint32_t *)APP_START_ADDRESS; + if((pui32App[0] == 0xffffffff) || + ((pui32App[0] & 0xfff00000) != 0x20000000) || + (pui32App[1] == 0xffffffff) || + ((pui32App[1] & 0xfff00001) != 0x00000001)) + { + // + // App starting stack pointer or PC is not valid, so force an update. + // + UpdaterMain(); + } + + // + // Check to see if the application has requested an update + // + if(HWREG(FORCE_UPDATE_ADDR) == FORCE_UPDATE_VALUE) + { + HWREG(FORCE_UPDATE_ADDR) = 0; + UpdaterMain(); + } + + // + // Enable the GPIO input for the user button. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM); + ROM_GPIODirModeSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN); + MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, + GPIO_PIN_TYPE_STD_WPU); + + // + // Check if the button is pressed, if so then force an update. + // + if(ROM_GPIOPinRead(GPIO_PORTM_BASE, GPIO_PIN_4) == 0) + { + UpdaterMain(); + } + + // + // If we get to here that means that none of the conditions that should + // cause an update are true. Therefore, call the application. + // + CallApplication(APP_START_ADDRESS); +} + +//***************************************************************************** +// +// This function is called from the application to request an update. The +// address of this function is stored in the SVC vector at offset 0x2C, so +// the user application can call it by using a statement like this: +// +// (*((void (*)(void))(*(uint32_t *)0x2c)))(); +// +//***************************************************************************** +void +AppForceUpdate(void) +{ + // + // Set a value in a memory location to indicate that the app requests + // an update. Then cause the processor to reset. + // + HWREG(FORCE_UPDATE_ADDR) = FORCE_UPDATE_VALUE; + HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ; +} + +//***************************************************************************** +// +// This function is used to call the user application. It will set the NVIC +// to point at the user app's vector table, load up the user app's stack +// pointer, and then jump to the application. +// +// This function must be programmed in assembly since it needs to directly +// manipulate the value in the stack pointer, and because it needs to perform +// a direct branch to the user app and not a function call (bl). +// +//***************************************************************************** +#if defined(codered) || defined(gcc) || defined(sourcerygxx) +void __attribute__((naked)) +CallApplication(uint_fast32_t ui32StartAddr) +{ + // + // Set the vector table to the beginning of the app in flash. + // + HWREG(NVIC_VTABLE) = ui32StartAddr; + + // + // Load the stack pointer from the application's vector table. + // + __asm(" ldr r1, [r0]\n" + " mov sp, r1"); + + // + // Load the initial PC from the application's vector table and branch to + // the application's entry point. + // + __asm(" ldr r0, [r0, #4]\n" + " bx r0\n"); +} +#elif defined(ewarm) +void +CallApplication(uint_fast32_t ui32StartAddr) +{ + // + // Set the vector table to the beginning of the app in flash. + // + HWREG(NVIC_VTABLE) = ui32StartAddr; + + // + // Load the stack pointer from the application's vector table. + // + __asm(" ldr r1, [r0]\n" + " mov sp, r1"); + + // + // Load the initial PC from the application's vector table and branch to + // the application's entry point. + // + __asm(" ldr r0, [r0, #4]\n" + " bx r0\n"); +} +#elif defined(rvmdk) || defined(__ARMCC_VERSION) +__asm void +CallApplication(uint_fast32_t ui32StartAddr) +{ + // + // Set the vector table address to the beginning of the application. + // + ldr r1, =0xe000ed08 + str r0, [r1] + + // + // Load the stack pointer from the application's vector table. + // + ldr r1, [r0] + mov sp, r1 + + // + // Load the initial PC from the application's vector table and branch to + // the application's entry point. + // + ldr r0, [r0, #4] + bx r0 +} +#elif defined(ccs) +void +CallApplication(uint_fast32_t ui32StartAddr) +{ + // + // Set the vector table to the beginning of the app in flash. + // + HWREG(NVIC_VTABLE) = ui32StartAddr; + + // + // Load the stack pointer from the application's vector table. + // + __asm(" ldr r1, [r0]\n" + " mov sp, r1\n"); + + // + // Load the initial PC from the application's vector table and branch to + // the application's entry point. + // + __asm(" ldr r0, [r0, #4]\n" + " bx r0\n"); +} +#else +#error Undefined compiler! +#endif + diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewd b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewp b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewp new file mode 100644 index 0000000..13ba7fc --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ewp @@ -0,0 +1,790 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\usblib\ewarm\Exe\usblib.a + + + + Source + + $PROJ_DIR$\simple_fs.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\usb_stick_update.c + + + diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.icf b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.icf new file mode 100644 index 0000000..38dc4e1 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// usb_stick_update.icf - Linker configuration file for usb_stick_update. +// +// Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ld b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ld new file mode 100644 index 0000000..8f08b67 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * usb_stick_update.ld - Linker configuration file for usb_stick_update. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.sct b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.sct new file mode 100644 index 0000000..20ec96d --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; usb_stick_update.sct - Linker configuration file for usb_stick_update. +; +; Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvopt b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvopt new file mode 100644 index 0000000..493928a --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvopt @@ -0,0 +1,317 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + usb_stick_update + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + simple_fs.c + simple_fs.c + + + 1 + 2 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\usb_stick_update.c + usb_stick_update.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 4 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\usblib\rvmdk\usblib.lib + usblib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 6 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvproj b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvproj new file mode 100644 index 0000000..ac7cace --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update.uvproj @@ -0,0 +1,434 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + usb_stick_update + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + usb_stick_update + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\usb_stick_update.bin .\rvmdk\usb_stick_update.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + usb_stick_update.sct + + + --entry Reset_Handler + + + + + + + + Source + + + simple_fs.c + 1 + simple_fs.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + usb_stick_update.c + 1 + .\usb_stick_update.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + usblib.lib + 4 + ..\..\..\..\usblib\rvmdk\usblib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/usb_stick_update/usb_stick_update_ccs.cmd b/boards/ek-lm4f232/usb_stick_update/usb_stick_update_ccs.cmd new file mode 100644 index 0000000..009f676 --- /dev/null +++ b/boards/ek-lm4f232/usb_stick_update/usb_stick_update_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * usb_stick_update_ccs.cmd - CCS linker configuration file for usb_stick_update. + * + * Copyright (c) 2012-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 1024; diff --git a/boards/ek-lm4f232/watchdog/Makefile b/boards/ek-lm4f232/watchdog/Makefile new file mode 100644 index 0000000..6dab20a --- /dev/null +++ b/boards/ek-lm4f232/watchdog/Makefile @@ -0,0 +1,88 @@ +#****************************************************************************** +# +# Makefile - Rules for building the watchdog example. +# +# Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +# Software License Agreement +# +# Texas Instruments (TI) is supplying this software for use solely and +# exclusively on TI's microcontroller products. The software is owned by +# TI and/or its suppliers, and is protected under applicable copyright +# laws. You may not combine this software with "viral" open-source +# software in order to form a larger program. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +# NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +# NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +# CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +# DAMAGES, FOR ANY REASON WHATSOEVER. +# +# This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +# +#****************************************************************************** + +# +# Defines the part type that this project uses. +# +PART=TM4C123GH6PGE + +# +# The base directory for TivaWare. +# +ROOT=../../../.. + +# +# Include the common make definitions. +# +include ${ROOT}/makedefs + +# +# Where to find source files that do not live in this directory. +# +VPATH=../drivers + +# +# Where to find header files that do not live in the source directory. +# +IPATH=.. +IPATH+=../../../.. + +# +# The default rule, which causes the watchdog example to be built. +# +all: ${COMPILER} +all: ${COMPILER}/watchdog.axf + +# +# The rule to clean out all the build products. +# +clean: + @rm -rf ${COMPILER} ${wildcard *~} + +# +# The rule to create the target directory. +# +${COMPILER}: + @mkdir -p ${COMPILER} + +# +# Rules for building the watchdog example. +# +${COMPILER}/watchdog.axf: ${COMPILER}/buttons.o +${COMPILER}/watchdog.axf: ${COMPILER}/cfal96x64x16.o +${COMPILER}/watchdog.axf: ${COMPILER}/startup_${COMPILER}.o +${COMPILER}/watchdog.axf: ${COMPILER}/watchdog.o +${COMPILER}/watchdog.axf: ${ROOT}/grlib/${COMPILER}/libgr.a +${COMPILER}/watchdog.axf: ${ROOT}/driverlib/${COMPILER}/libdriver.a +${COMPILER}/watchdog.axf: watchdog.ld +SCATTERgcc_watchdog=watchdog.ld +ENTRY_watchdog=ResetISR +CFLAGSgcc=-DTARGET_IS_TM4C123_RA1 + +# +# Include the automatically generated dependency files. +# +ifneq (${MAKECMDGOALS},clean) +-include ${wildcard ${COMPILER}/*.d} __dummy__ +endif diff --git a/boards/ek-lm4f232/watchdog/ccs/.ccsimportspec b/boards/ek-lm4f232/watchdog/ccs/.ccsimportspec new file mode 100644 index 0000000..6379126 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/ccs/.ccsimportspec @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/boards/ek-lm4f232/watchdog/ccs/.ccsproject b/boards/ek-lm4f232/watchdog/ccs/.ccsproject new file mode 100644 index 0000000..e423367 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/ccs/.ccsproject @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/boards/ek-lm4f232/watchdog/ccs/.cproject b/boards/ek-lm4f232/watchdog/ccs/.cproject new file mode 100644 index 0000000..c509d44 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/ccs/.cproject @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/watchdog/ccs/.project b/boards/ek-lm4f232/watchdog/ccs/.project new file mode 100644 index 0000000..349a44f --- /dev/null +++ b/boards/ek-lm4f232/watchdog/ccs/.project @@ -0,0 +1,60 @@ + + + watchdog + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + com.ti.ccstudio.core.ccsNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + startup_ccs.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/watchdog/startup_ccs.c + + + watchdog.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/watchdog/watchdog.c + + + watchdog_ccs.cmd + 1 + SW_ROOT/examples/boards/ek-lm4f232/watchdog/watchdog_ccs.cmd + + + drivers/buttons.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/buttons.c + + + drivers/cfal96x64x16.c + 1 + SW_ROOT/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c + + + + + SW_ROOT + $%7BPARENT-5-PROJECT_LOC%7D + + + diff --git a/boards/ek-lm4f232/watchdog/ccs/.settings/org.eclipse.cdt.codan.core.prefs b/boards/ek-lm4f232/watchdog/ccs/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000..98b6350 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/ccs/.settings/org.eclipse.cdt.codan.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +inEditor=false +onBuild=false diff --git a/boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.bin b/boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.bin new file mode 100644 index 0000000..7b6da9b Binary files /dev/null and b/boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.bin differ diff --git a/boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.out b/boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.out new file mode 100644 index 0000000..d2702e7 Binary files /dev/null and b/boards/ek-lm4f232/watchdog/ccs/Debug/watchdog.out differ diff --git a/boards/ek-lm4f232/watchdog/ccs/macros.ini_initial b/boards/ek-lm4f232/watchdog/ccs/macros.ini_initial new file mode 100644 index 0000000..31214b5 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/ccs/macros.ini_initial @@ -0,0 +1 @@ +SW_ROOT = ../../../../.. diff --git a/boards/ek-lm4f232/watchdog/ccs/target_config.ccxml b/boards/ek-lm4f232/watchdog/ccs/target_config.ccxml new file mode 100644 index 0000000..c8d43ba --- /dev/null +++ b/boards/ek-lm4f232/watchdog/ccs/target_config.ccxml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.bin b/boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.bin new file mode 100644 index 0000000..13d896c Binary files /dev/null and b/boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.bin differ diff --git a/boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.out b/boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.out new file mode 100644 index 0000000..6464c6c Binary files /dev/null and b/boards/ek-lm4f232/watchdog/ewarm/Exe/watchdog.out differ diff --git a/boards/ek-lm4f232/watchdog/gcc/watchdog.axf b/boards/ek-lm4f232/watchdog/gcc/watchdog.axf new file mode 100644 index 0000000..2f759ac Binary files /dev/null and b/boards/ek-lm4f232/watchdog/gcc/watchdog.axf differ diff --git a/boards/ek-lm4f232/watchdog/gcc/watchdog.bin b/boards/ek-lm4f232/watchdog/gcc/watchdog.bin new file mode 100644 index 0000000..a30fc8e Binary files /dev/null and b/boards/ek-lm4f232/watchdog/gcc/watchdog.bin differ diff --git a/boards/ek-lm4f232/watchdog/readme.txt b/boards/ek-lm4f232/watchdog/readme.txt new file mode 100644 index 0000000..bc3dbeb --- /dev/null +++ b/boards/ek-lm4f232/watchdog/readme.txt @@ -0,0 +1,28 @@ +Watchdog + +This example application demonstrates the use of the watchdog as a simple +heartbeat for the system. If the watchdog is not periodically fed, it will +reset the system. Each time the watchdog is fed, the LED is inverted so +that it is easy to see that it is being fed, which occurs once every +second. To stop the watchdog being fed and, hence, cause a system reset, +press the select button. + +------------------------------------------------------------------------------- + +Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +Software License Agreement + +Texas Instruments (TI) is supplying this software for use solely and +exclusively on TI's microcontroller products. The software is owned by +TI and/or its suppliers, and is protected under applicable copyright +laws. You may not combine this software with "viral" open-source +software in order to form a larger program. + +THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, FOR ANY REASON WHATSOEVER. + +This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. diff --git a/boards/ek-lm4f232/watchdog/rvmdk/watchdog.axf b/boards/ek-lm4f232/watchdog/rvmdk/watchdog.axf new file mode 100644 index 0000000..daa69b3 Binary files /dev/null and b/boards/ek-lm4f232/watchdog/rvmdk/watchdog.axf differ diff --git a/boards/ek-lm4f232/watchdog/rvmdk/watchdog.bin b/boards/ek-lm4f232/watchdog/rvmdk/watchdog.bin new file mode 100644 index 0000000..e51e150 Binary files /dev/null and b/boards/ek-lm4f232/watchdog/rvmdk/watchdog.bin differ diff --git a/boards/ek-lm4f232/watchdog/startup_ccs.c b/boards/ek-lm4f232/watchdog/startup_ccs.c new file mode 100644 index 0000000..0a8d385 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/startup_ccs.c @@ -0,0 +1,302 @@ +//***************************************************************************** +// +// startup_ccs.c - Startup code for use with TI's Code Composer Studio. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the reset handler that is to be called when the +// processor is started +// +//***************************************************************************** +extern void _c_int00(void); + +//***************************************************************************** +// +// Linker variable that marks the top of the stack. +// +//***************************************************************************** +extern uint32_t __STACK_TOP; + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void WatchdogIntHandler(void); + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000 or at the start of +// the program if located at a start address other than 0. +// +//***************************************************************************** +#pragma DATA_SECTION(g_pfnVectors, ".intvecs") +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)&__STACK_TOP), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + WatchdogIntHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Jump to the CCS C initialization routine. This will enable the + // floating-point unit as well, so that does not need to be done here. + // + __asm(" .global _c_int00\n" + " b.w _c_int00"); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/watchdog/startup_ewarm.c b/boards/ek-lm4f232/watchdog/startup_ewarm.c new file mode 100644 index 0000000..2d4de17 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/startup_ewarm.c @@ -0,0 +1,333 @@ +//***************************************************************************** +// +// startup_ewarm.c - Startup code for use with IAR's Embedded Workbench, +// version 5. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Enable the IAR extensions for this source file. +// +//***************************************************************************** +#pragma language=extended + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void WatchdogIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application startup code. +// +//***************************************************************************** +extern void __iar_program_start(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128] @ ".noinit"; + +//***************************************************************************** +// +// A union that describes the entries of the vector table. The union is needed +// since the first entry is the stack pointer and the remainder are function +// pointers. +// +//***************************************************************************** +typedef union +{ + void (*pfnHandler)(void); + uint32_t ui32Ptr; +} +uVectorEntry; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__root const uVectorEntry __vector_table[] @ ".intvec" = +{ + { .ui32Ptr = (uint32_t)pui32Stack + sizeof(pui32Stack) }, + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + WatchdogIntHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + __iar_program_start(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/watchdog/startup_gcc.c b/boards/ek-lm4f232/watchdog/startup_gcc.c new file mode 100644 index 0000000..50ea731 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/startup_gcc.c @@ -0,0 +1,349 @@ +//***************************************************************************** +// +// startup_gcc.c - Startup code for use with GNU tools. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include "inc/hw_nvic.h" +#include "inc/hw_types.h" + +//***************************************************************************** +// +// Forward declaration of the default fault handlers. +// +//***************************************************************************** +void ResetISR(void); +static void NmiSR(void); +static void FaultISR(void); +static void IntDefaultHandler(void); + +//***************************************************************************** +// +// External declaration for the interrupt handler used by the application. +// +//***************************************************************************** +extern void WatchdogIntHandler(void); + +//***************************************************************************** +// +// The entry point for the application. +// +//***************************************************************************** +extern int main(void); + +//***************************************************************************** +// +// Reserve space for the system stack. +// +//***************************************************************************** +static uint32_t pui32Stack[128]; + +//***************************************************************************** +// +// The vector table. Note that the proper constructs must be placed on this to +// ensure that it ends up at physical address 0x0000.0000. +// +//***************************************************************************** +__attribute__ ((section(".isr_vector"))) +void (* const g_pfnVectors[])(void) = +{ + (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), + // The initial stack pointer + ResetISR, // The reset handler + NmiSR, // The NMI handler + FaultISR, // The hard fault handler + IntDefaultHandler, // The MPU fault handler + IntDefaultHandler, // The bus fault handler + IntDefaultHandler, // The usage fault handler + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // SVCall handler + IntDefaultHandler, // Debug monitor handler + 0, // Reserved + IntDefaultHandler, // The PendSV handler + IntDefaultHandler, // The SysTick handler + IntDefaultHandler, // GPIO Port A + IntDefaultHandler, // GPIO Port B + IntDefaultHandler, // GPIO Port C + IntDefaultHandler, // GPIO Port D + IntDefaultHandler, // GPIO Port E + IntDefaultHandler, // UART0 Rx and Tx + IntDefaultHandler, // UART1 Rx and Tx + IntDefaultHandler, // SSI0 Rx and Tx + IntDefaultHandler, // I2C0 Master and Slave + IntDefaultHandler, // PWM Fault + IntDefaultHandler, // PWM Generator 0 + IntDefaultHandler, // PWM Generator 1 + IntDefaultHandler, // PWM Generator 2 + IntDefaultHandler, // Quadrature Encoder 0 + IntDefaultHandler, // ADC Sequence 0 + IntDefaultHandler, // ADC Sequence 1 + IntDefaultHandler, // ADC Sequence 2 + IntDefaultHandler, // ADC Sequence 3 + WatchdogIntHandler, // Watchdog timer + IntDefaultHandler, // Timer 0 subtimer A + IntDefaultHandler, // Timer 0 subtimer B + IntDefaultHandler, // Timer 1 subtimer A + IntDefaultHandler, // Timer 1 subtimer B + IntDefaultHandler, // Timer 2 subtimer A + IntDefaultHandler, // Timer 2 subtimer B + IntDefaultHandler, // Analog Comparator 0 + IntDefaultHandler, // Analog Comparator 1 + IntDefaultHandler, // Analog Comparator 2 + IntDefaultHandler, // System Control (PLL, OSC, BO) + IntDefaultHandler, // FLASH Control + IntDefaultHandler, // GPIO Port F + IntDefaultHandler, // GPIO Port G + IntDefaultHandler, // GPIO Port H + IntDefaultHandler, // UART2 Rx and Tx + IntDefaultHandler, // SSI1 Rx and Tx + IntDefaultHandler, // Timer 3 subtimer A + IntDefaultHandler, // Timer 3 subtimer B + IntDefaultHandler, // I2C1 Master and Slave + IntDefaultHandler, // Quadrature Encoder 1 + IntDefaultHandler, // CAN0 + IntDefaultHandler, // CAN1 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Hibernate + IntDefaultHandler, // USB0 + IntDefaultHandler, // PWM Generator 3 + IntDefaultHandler, // uDMA Software Transfer + IntDefaultHandler, // uDMA Error + IntDefaultHandler, // ADC1 Sequence 0 + IntDefaultHandler, // ADC1 Sequence 1 + IntDefaultHandler, // ADC1 Sequence 2 + IntDefaultHandler, // ADC1 Sequence 3 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port J + IntDefaultHandler, // GPIO Port K + IntDefaultHandler, // GPIO Port L + IntDefaultHandler, // SSI2 Rx and Tx + IntDefaultHandler, // SSI3 Rx and Tx + IntDefaultHandler, // UART3 Rx and Tx + IntDefaultHandler, // UART4 Rx and Tx + IntDefaultHandler, // UART5 Rx and Tx + IntDefaultHandler, // UART6 Rx and Tx + IntDefaultHandler, // UART7 Rx and Tx + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C2 Master and Slave + IntDefaultHandler, // I2C3 Master and Slave + IntDefaultHandler, // Timer 4 subtimer A + IntDefaultHandler, // Timer 4 subtimer B + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // Timer 5 subtimer A + IntDefaultHandler, // Timer 5 subtimer B + IntDefaultHandler, // Wide Timer 0 subtimer A + IntDefaultHandler, // Wide Timer 0 subtimer B + IntDefaultHandler, // Wide Timer 1 subtimer A + IntDefaultHandler, // Wide Timer 1 subtimer B + IntDefaultHandler, // Wide Timer 2 subtimer A + IntDefaultHandler, // Wide Timer 2 subtimer B + IntDefaultHandler, // Wide Timer 3 subtimer A + IntDefaultHandler, // Wide Timer 3 subtimer B + IntDefaultHandler, // Wide Timer 4 subtimer A + IntDefaultHandler, // Wide Timer 4 subtimer B + IntDefaultHandler, // Wide Timer 5 subtimer A + IntDefaultHandler, // Wide Timer 5 subtimer B + IntDefaultHandler, // FPU + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // I2C4 Master and Slave + IntDefaultHandler, // I2C5 Master and Slave + IntDefaultHandler, // GPIO Port M + IntDefaultHandler, // GPIO Port N + IntDefaultHandler, // Quadrature Encoder 2 + 0, // Reserved + 0, // Reserved + IntDefaultHandler, // GPIO Port P (Summary or P0) + IntDefaultHandler, // GPIO Port P1 + IntDefaultHandler, // GPIO Port P2 + IntDefaultHandler, // GPIO Port P3 + IntDefaultHandler, // GPIO Port P4 + IntDefaultHandler, // GPIO Port P5 + IntDefaultHandler, // GPIO Port P6 + IntDefaultHandler, // GPIO Port P7 + IntDefaultHandler, // GPIO Port Q (Summary or Q0) + IntDefaultHandler, // GPIO Port Q1 + IntDefaultHandler, // GPIO Port Q2 + IntDefaultHandler, // GPIO Port Q3 + IntDefaultHandler, // GPIO Port Q4 + IntDefaultHandler, // GPIO Port Q5 + IntDefaultHandler, // GPIO Port Q6 + IntDefaultHandler, // GPIO Port Q7 + IntDefaultHandler, // GPIO Port R + IntDefaultHandler, // GPIO Port S + IntDefaultHandler, // PWM 1 Generator 0 + IntDefaultHandler, // PWM 1 Generator 1 + IntDefaultHandler, // PWM 1 Generator 2 + IntDefaultHandler, // PWM 1 Generator 3 + IntDefaultHandler // PWM 1 Fault +}; + +//***************************************************************************** +// +// The following are constructs created by the linker, indicating where the +// the "data" and "bss" segments reside in memory. The initializers for the +// for the "data" segment resides immediately following the "text" segment. +// +//***************************************************************************** +extern uint32_t _etext; +extern uint32_t _data; +extern uint32_t _edata; +extern uint32_t _bss; +extern uint32_t _ebss; + +//***************************************************************************** +// +// This is the code that gets called when the processor first starts execution +// following a reset event. Only the absolutely necessary set is performed, +// after which the application supplied entry() routine is called. Any fancy +// actions (such as making decisions based on the reset cause register, and +// resetting the bits in that register) are left solely in the hands of the +// application. +// +//***************************************************************************** +void +ResetISR(void) +{ + uint32_t *pui32Src, *pui32Dest; + + // + // Copy the data segment initializers from flash to SRAM. + // + pui32Src = &_etext; + for(pui32Dest = &_data; pui32Dest < &_edata; ) + { + *pui32Dest++ = *pui32Src++; + } + + // + // Zero fill the bss segment. + // + __asm(" ldr r0, =_bss\n" + " ldr r1, =_ebss\n" + " mov r2, #0\n" + " .thumb_func\n" + "zero_loop:\n" + " cmp r0, r1\n" + " it lt\n" + " strlt r2, [r0], #4\n" + " blt zero_loop"); + + // + // Enable the floating-point unit. This must be done here to handle the + // case where main() uses floating-point and the function prologue saves + // floating-point registers (which will fault if floating-point is not + // enabled). Any configuration of the floating-point unit using DriverLib + // APIs must be done here prior to the floating-point unit being enabled. + // + // Note that this does not use DriverLib since it might not be included in + // this project. + // + HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & + ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | + NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); + + // + // Call the application's entry point. + // + main(); +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a NMI. This +// simply enters an infinite loop, preserving the system state for examination +// by a debugger. +// +//***************************************************************************** +static void +NmiSR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives a fault +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +FaultISR(void) +{ + // + // Enter an infinite loop. + // + while(1) + { + } +} + +//***************************************************************************** +// +// This is the code that gets called when the processor receives an unexpected +// interrupt. This simply enters an infinite loop, preserving the system state +// for examination by a debugger. +// +//***************************************************************************** +static void +IntDefaultHandler(void) +{ + // + // Go into an infinite loop. + // + while(1) + { + } +} diff --git a/boards/ek-lm4f232/watchdog/startup_rvmdk.S b/boards/ek-lm4f232/watchdog/startup_rvmdk.S new file mode 100644 index 0000000..1dfb47a --- /dev/null +++ b/boards/ek-lm4f232/watchdog/startup_rvmdk.S @@ -0,0 +1,358 @@ +; <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +; +; startup_rvmdk.S - Startup code for use with Keil's uVision. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +;****************************************************************************** +; +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Stack EQU 0x00000200 + +;****************************************************************************** +; +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; +;****************************************************************************** +Heap EQU 0x00000000 + +;****************************************************************************** +; +; Allocate space for the stack. +; +;****************************************************************************** + AREA STACK, NOINIT, READWRITE, ALIGN=3 +StackMem + SPACE Stack +__initial_sp + +;****************************************************************************** +; +; Allocate space for the heap. +; +;****************************************************************************** + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +HeapMem + SPACE Heap +__heap_limit + +;****************************************************************************** +; +; Indicate that the code in this file preserves 8-byte alignment of the stack. +; +;****************************************************************************** + PRESERVE8 + +;****************************************************************************** +; +; Place code into the reset code section. +; +;****************************************************************************** + AREA RESET, CODE, READONLY + THUMB + +;****************************************************************************** +; +; External declaration for the interrupt handler used by the application. +; +;****************************************************************************** + EXTERN WatchdogIntHandler + +;****************************************************************************** +; +; The vector table. +; +;****************************************************************************** + EXPORT __Vectors +__Vectors + DCD StackMem + Stack ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NmiSR ; NMI Handler + DCD FaultISR ; Hard Fault Handler + DCD IntDefaultHandler ; The MPU fault handler + DCD IntDefaultHandler ; The bus fault handler + DCD IntDefaultHandler ; The usage fault handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; SVCall handler + DCD IntDefaultHandler ; Debug monitor handler + DCD 0 ; Reserved + DCD IntDefaultHandler ; The PendSV handler + DCD IntDefaultHandler ; The SysTick handler + DCD IntDefaultHandler ; GPIO Port A + DCD IntDefaultHandler ; GPIO Port B + DCD IntDefaultHandler ; GPIO Port C + DCD IntDefaultHandler ; GPIO Port D + DCD IntDefaultHandler ; GPIO Port E + DCD IntDefaultHandler ; UART0 Rx and Tx + DCD IntDefaultHandler ; UART1 Rx and Tx + DCD IntDefaultHandler ; SSI0 Rx and Tx + DCD IntDefaultHandler ; I2C0 Master and Slave + DCD IntDefaultHandler ; PWM Fault + DCD IntDefaultHandler ; PWM Generator 0 + DCD IntDefaultHandler ; PWM Generator 1 + DCD IntDefaultHandler ; PWM Generator 2 + DCD IntDefaultHandler ; Quadrature Encoder 0 + DCD IntDefaultHandler ; ADC Sequence 0 + DCD IntDefaultHandler ; ADC Sequence 1 + DCD IntDefaultHandler ; ADC Sequence 2 + DCD IntDefaultHandler ; ADC Sequence 3 + DCD WatchdogIntHandler ; Watchdog timer + DCD IntDefaultHandler ; Timer 0 subtimer A + DCD IntDefaultHandler ; Timer 0 subtimer B + DCD IntDefaultHandler ; Timer 1 subtimer A + DCD IntDefaultHandler ; Timer 1 subtimer B + DCD IntDefaultHandler ; Timer 2 subtimer A + DCD IntDefaultHandler ; Timer 2 subtimer B + DCD IntDefaultHandler ; Analog Comparator 0 + DCD IntDefaultHandler ; Analog Comparator 1 + DCD IntDefaultHandler ; Analog Comparator 2 + DCD IntDefaultHandler ; System Control (PLL, OSC, BO) + DCD IntDefaultHandler ; FLASH Control + DCD IntDefaultHandler ; GPIO Port F + DCD IntDefaultHandler ; GPIO Port G + DCD IntDefaultHandler ; GPIO Port H + DCD IntDefaultHandler ; UART2 Rx and Tx + DCD IntDefaultHandler ; SSI1 Rx and Tx + DCD IntDefaultHandler ; Timer 3 subtimer A + DCD IntDefaultHandler ; Timer 3 subtimer B + DCD IntDefaultHandler ; I2C1 Master and Slave + DCD IntDefaultHandler ; Quadrature Encoder 1 + DCD IntDefaultHandler ; CAN0 + DCD IntDefaultHandler ; CAN1 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Hibernate + DCD IntDefaultHandler ; USB0 + DCD IntDefaultHandler ; PWM Generator 3 + DCD IntDefaultHandler ; uDMA Software Transfer + DCD IntDefaultHandler ; uDMA Error + DCD IntDefaultHandler ; ADC1 Sequence 0 + DCD IntDefaultHandler ; ADC1 Sequence 1 + DCD IntDefaultHandler ; ADC1 Sequence 2 + DCD IntDefaultHandler ; ADC1 Sequence 3 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port J + DCD IntDefaultHandler ; GPIO Port K + DCD IntDefaultHandler ; GPIO Port L + DCD IntDefaultHandler ; SSI2 Rx and Tx + DCD IntDefaultHandler ; SSI3 Rx and Tx + DCD IntDefaultHandler ; UART3 Rx and Tx + DCD IntDefaultHandler ; UART4 Rx and Tx + DCD IntDefaultHandler ; UART5 Rx and Tx + DCD IntDefaultHandler ; UART6 Rx and Tx + DCD IntDefaultHandler ; UART7 Rx and Tx + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C2 Master and Slave + DCD IntDefaultHandler ; I2C3 Master and Slave + DCD IntDefaultHandler ; Timer 4 subtimer A + DCD IntDefaultHandler ; Timer 4 subtimer B + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; Timer 5 subtimer A + DCD IntDefaultHandler ; Timer 5 subtimer B + DCD IntDefaultHandler ; Wide Timer 0 subtimer A + DCD IntDefaultHandler ; Wide Timer 0 subtimer B + DCD IntDefaultHandler ; Wide Timer 1 subtimer A + DCD IntDefaultHandler ; Wide Timer 1 subtimer B + DCD IntDefaultHandler ; Wide Timer 2 subtimer A + DCD IntDefaultHandler ; Wide Timer 2 subtimer B + DCD IntDefaultHandler ; Wide Timer 3 subtimer A + DCD IntDefaultHandler ; Wide Timer 3 subtimer B + DCD IntDefaultHandler ; Wide Timer 4 subtimer A + DCD IntDefaultHandler ; Wide Timer 4 subtimer B + DCD IntDefaultHandler ; Wide Timer 5 subtimer A + DCD IntDefaultHandler ; Wide Timer 5 subtimer B + DCD IntDefaultHandler ; FPU + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; I2C4 Master and Slave + DCD IntDefaultHandler ; I2C5 Master and Slave + DCD IntDefaultHandler ; GPIO Port M + DCD IntDefaultHandler ; GPIO Port N + DCD IntDefaultHandler ; Quadrature Encoder 2 + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD IntDefaultHandler ; GPIO Port P (Summary or P0) + DCD IntDefaultHandler ; GPIO Port P1 + DCD IntDefaultHandler ; GPIO Port P2 + DCD IntDefaultHandler ; GPIO Port P3 + DCD IntDefaultHandler ; GPIO Port P4 + DCD IntDefaultHandler ; GPIO Port P5 + DCD IntDefaultHandler ; GPIO Port P6 + DCD IntDefaultHandler ; GPIO Port P7 + DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) + DCD IntDefaultHandler ; GPIO Port Q1 + DCD IntDefaultHandler ; GPIO Port Q2 + DCD IntDefaultHandler ; GPIO Port Q3 + DCD IntDefaultHandler ; GPIO Port Q4 + DCD IntDefaultHandler ; GPIO Port Q5 + DCD IntDefaultHandler ; GPIO Port Q6 + DCD IntDefaultHandler ; GPIO Port Q7 + DCD IntDefaultHandler ; GPIO Port R + DCD IntDefaultHandler ; GPIO Port S + DCD IntDefaultHandler ; PWM 1 Generator 0 + DCD IntDefaultHandler ; PWM 1 Generator 1 + DCD IntDefaultHandler ; PWM 1 Generator 2 + DCD IntDefaultHandler ; PWM 1 Generator 3 + DCD IntDefaultHandler ; PWM 1 Fault + +;****************************************************************************** +; +; This is the code that gets called when the processor first starts execution +; following a reset event. +; +;****************************************************************************** + EXPORT Reset_Handler +Reset_Handler + ; + ; Enable the floating-point unit. This must be done here to handle the + ; case where main() uses floating-point and the function prologue saves + ; floating-point registers (which will fault if floating-point is not + ; enabled). Any configuration of the floating-point unit using + ; DriverLib APIs must be done here prior to the floating-point unit + ; being enabled. + ; + ; Note that this does not use DriverLib since it might not be included + ; in this project. + ; + MOVW R0, #0xED88 + MOVT R0, #0xE000 + LDR R1, [R0] + ORR R1, #0x00F00000 + STR R1, [R0] + + ; + ; Call the C library enty point that handles startup. This will copy + ; the .data section initializers from flash to SRAM and zero fill the + ; .bss section. + ; + IMPORT __main + B __main + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a NMI. This +; simply enters an infinite loop, preserving the system state for examination +; by a debugger. +; +;****************************************************************************** +NmiSR + B NmiSR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives a fault +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +FaultISR + B FaultISR + +;****************************************************************************** +; +; This is the code that gets called when the processor receives an unexpected +; interrupt. This simply enters an infinite loop, preserving the system state +; for examination by a debugger. +; +;****************************************************************************** +IntDefaultHandler + B IntDefaultHandler + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Some code in the normal code section for initializing the heap and stack. +; +;****************************************************************************** + AREA |.text|, CODE, READONLY + +;****************************************************************************** +; +; The function expected of the C library startup code for defining the stack +; and heap memory locations. For the C library version of the startup code, +; provide this function so that the C library initialization code can find out +; the location of the stack and heap. +; +;****************************************************************************** + IF :DEF: __MICROLIB + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + ELSE + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap +__user_initial_stackheap + LDR R0, =HeapMem + LDR R1, =(StackMem + Stack) + LDR R2, =(HeapMem + Heap) + LDR R3, =StackMem + BX LR + ENDIF + +;****************************************************************************** +; +; Make sure the end of this section is aligned. +; +;****************************************************************************** + ALIGN + +;****************************************************************************** +; +; Tell the assembler that we're done. +; +;****************************************************************************** + END diff --git a/boards/ek-lm4f232/watchdog/watchdog.c b/boards/ek-lm4f232/watchdog/watchdog.c new file mode 100644 index 0000000..7f4fc75 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.c @@ -0,0 +1,268 @@ +//***************************************************************************** +// +// watchdog.c - Watchdog timer example. +// +// Copyright (c) 2008-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +#include +#include +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "driverlib/debug.h" +#include "driverlib/fpu.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/sysctl.h" +#include "driverlib/watchdog.h" +#include "driverlib/rom.h" +#include "grlib/grlib.h" +#include "drivers/cfal96x64x16.h" +#include "drivers/buttons.h" + +//***************************************************************************** +// +//! \addtogroup example_list +//!

Watchdog (watchdog)

+//! +//! This example application demonstrates the use of the watchdog as a simple +//! heartbeat for the system. If the watchdog is not periodically fed, it will +//! reset the system. Each time the watchdog is fed, the LED is inverted so +//! that it is easy to see that it is being fed, which occurs once every +//! second. To stop the watchdog being fed and, hence, cause a system reset, +//! press the select button. +// +//***************************************************************************** + +//***************************************************************************** +// +// Graphics context used to show text on the display. +// +//***************************************************************************** +tContext g_sContext; + +//***************************************************************************** +// +// Flag to tell the watchdog interrupt handler whether or not to clear the +// interrupt (feed the watchdog). +// +//***************************************************************************** +volatile bool g_bFeedWatchdog = true; + +//***************************************************************************** +// +// The error routine that is called if the driver library encounters an error. +// +//***************************************************************************** +#ifdef DEBUG +void +__error__(char *pcFilename, uint32_t ui32Line) +{ +} +#endif + +//***************************************************************************** +// +// The interrupt handler for the watchdog. This feeds the dog (so that the +// processor does not get reset) and winks the LED connected to GPIO B3. +// +//***************************************************************************** +void +WatchdogIntHandler(void) +{ + // + // If we have been told to stop feeding the watchdog, return immediately + // without clearing the interrupt. This will cause the system to reset + // next time the watchdog interrupt fires. + // + if(!g_bFeedWatchdog) + { + return; + } + + // + // Clear the watchdog interrupt. + // + ROM_WatchdogIntClear(WATCHDOG0_BASE); + + // + // Invert the GPIO PF3 value. + // + ROM_GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, + (ROM_GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_2) ^ + GPIO_PIN_2)); +} + +//***************************************************************************** +// +// This function is called when the select button is pressed. +// +//***************************************************************************** +static int32_t +SelectButtonPressed(void) +{ + // + // Find the X center of the display + // + int32_t i32CenterX = GrContextDpyWidthGet(&g_sContext) / 2; + + // + // Let the user know that the button has been pressed and that the + // watchdog is being starved. + // + GrStringDrawCentered(&g_sContext, "Starving", -1, i32CenterX, 14, 1); + GrStringDrawCentered(&g_sContext, "Watchdog", -1, i32CenterX, 24, 1); + GrStringDrawCentered(&g_sContext, "System", -1, i32CenterX, 36, 1); + GrStringDrawCentered(&g_sContext, " will ", -1, i32CenterX, 46, 1); + GrStringDrawCentered(&g_sContext, "reset ...", -1, i32CenterX, 56, 1); + + // + // Set the flag that tells the interrupt handler not to clear the + // watchdog interrupt. + // + g_bFeedWatchdog = false; + + return(0); +} + +//***************************************************************************** +// +// This example demonstrates the use of the watchdog timer. +// +//***************************************************************************** +int +main(void) +{ + int_fast32_t i32CenterX; + tRectangle sRect; + + // + // Enable lazy stacking for interrupt handlers. This allows floating-point + // instructions to be used within interrupt handlers, but at the expense of + // extra stack usage. + // + ROM_FPULazyStackingEnable(); + + // + // Set the clocking to run directly from the crystal. + // + ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + + // + // Initialize the display and buttons drivers. + // + CFAL96x64x16Init(); + ButtonsInit(); + + // + // Initialize the graphics context and find the middle X coordinate. + // + GrContextInit(&g_sContext, &g_sCFAL96x64x16); + i32CenterX = GrContextDpyWidthGet(&g_sContext) / 2; + + // + // Fill the top part of the screen with blue to create the banner. + // + sRect.i16XMin = 0; + sRect.i16YMin = 0; + sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1; + sRect.i16YMax = 9; + GrContextForegroundSet(&g_sContext, ClrDarkBlue); + GrRectFill(&g_sContext, &sRect); + + // + // Change foreground for white text. + // + GrContextForegroundSet(&g_sContext, ClrWhite); + + // + // Put the application name in the middle of the banner. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "watchdog", -1, i32CenterX, 4, 0); + + // + // Show the state and offer some instructions to the user. + // + GrContextFontSet(&g_sContext, g_psFontFixed6x8); + GrStringDrawCentered(&g_sContext, "Feeding", -1, i32CenterX, 14, 1); + GrStringDrawCentered(&g_sContext, "Watchdog", -1, i32CenterX, 24, 1); + GrStringDrawCentered(&g_sContext, "Press", -1, i32CenterX, 36, 1); + GrStringDrawCentered(&g_sContext, "Select", -1, i32CenterX, 46, 1); + GrStringDrawCentered(&g_sContext, "to stop", -1, i32CenterX, 56, 1); + + // + // Enable the peripherals used by this example. + // + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_WDOG0); + ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + + // + // Enable processor interrupts. + // + ROM_IntMasterEnable(); + + // + // Set GPIO PG2 as an output. This drives an LED on the board that will + // toggle when a watchdog interrupt is processed. + // + ROM_GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2); + ROM_GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, 0); + + // + // Enable the watchdog interrupt. + // + ROM_IntEnable(INT_WATCHDOG); + + // + // Set the period of the watchdog timer. + // + ROM_WatchdogReloadSet(WATCHDOG0_BASE, ROM_SysCtlClockGet()); + + // + // Enable reset generation from the watchdog timer. + // + ROM_WatchdogResetEnable(WATCHDOG0_BASE); + + // + // Enable the watchdog timer. + // + ROM_WatchdogEnable(WATCHDOG0_BASE); + + // + // Loop forever while the LED winks as watchdog interrupts are handled. + // + while(1) + { + // + // Poll for the select button pressed + // + uint8_t ui8Buttons = ButtonsPoll(0, 0); + if(ui8Buttons & SELECT_BUTTON) + { + SelectButtonPressed(); + while(1) + { + } + } + } +} diff --git a/boards/ek-lm4f232/watchdog/watchdog.ewd b/boards/ek-lm4f232/watchdog/watchdog.ewd new file mode 100644 index 0000000..5e62dcd --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.ewd @@ -0,0 +1,614 @@ + + + + 1 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + JLINK_ID + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + MACRAIGOR_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OSE\OseEpsilonPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\Profiling\Profiling.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Stack\Stack.ENU.ewplugin + 1 + + + + diff --git a/boards/ek-lm4f232/watchdog/watchdog.ewp b/boards/ek-lm4f232/watchdog/watchdog.ewp new file mode 100644 index 0000000..4bc3563 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.ewp @@ -0,0 +1,795 @@ + + + + 1 + + Debug + + ARM + + 1 + + General + 3 + + 14 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 19 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 7 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 5 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Libraries + + $PROJ_DIR$\..\..\..\..\driverlib\ewarm\Exe\driverlib.a + + + $PROJ_DIR$\..\..\..\..\grlib\ewarm\Exe\grlib.a + + + + Source + + $PROJ_DIR$\..\drivers\buttons.c + + + $PROJ_DIR$\..\drivers\cfal96x64x16.c + + + $PROJ_DIR$\startup_ewarm.c + + + $PROJ_DIR$\watchdog.c + + + diff --git a/boards/ek-lm4f232/watchdog/watchdog.icf b/boards/ek-lm4f232/watchdog/watchdog.icf new file mode 100644 index 0000000..95f0ae1 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.icf @@ -0,0 +1,78 @@ +//***************************************************************************** +// +// watchdog.icf - Linker configuration file for watchdog. +// +// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Texas Instruments (TI) is supplying this software for use solely and +// exclusively on TI's microcontroller products. The software is owned by +// TI and/or its suppliers, and is protected under applicable copyright +// laws. You may not combine this software with "viral" open-source +// software in order to form a larger program. +// +// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +// DAMAGES, FOR ANY REASON WHATSOEVER. +// +// This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +// +//***************************************************************************** + +// +// Define a memory region that covers the entire 4 GB addressible space of the +// processor. +// +define memory mem with size = 4G; + +// +// Define a region for the on-chip flash. +// +define region FLASH = mem:[from 0x00000000 to 0x0003ffff]; + +// +// Define a region for the on-chip SRAM. +// +define region SRAM = mem:[from 0x20000000 to 0x20007fff]; + +// +// Define a block for the heap. The size should be set to something other +// than zero if things in the C library that require the heap are used. +// +define block HEAP with alignment = 8, size = 0x00000000 { }; + +// +// Indicate that the read/write values should be initialized by copying from +// flash. +// +initialize by copy { readwrite }; + +// +// Indicate that the noinit values should be left alone. This includes the +// stack, which if initialized will destroy the return address from the +// initialization code, causing the processor to branch to zero and fault. +// +do not initialize { section .noinit }; + +// +// Place the interrupt vectors at the start of flash. +// +place at start of FLASH { readonly section .intvec }; + +// +// Place the remainder of the read-only items into flash. +// +place in FLASH { readonly }; + +// +// Place the RAM vector table at the start of SRAM. +// +place at start of SRAM { section VTABLE }; + +// +// Place all read/write items into SRAM. +// +place in SRAM { readwrite, block HEAP }; diff --git a/boards/ek-lm4f232/watchdog/watchdog.ld b/boards/ek-lm4f232/watchdog/watchdog.ld new file mode 100644 index 0000000..fc9793b --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.ld @@ -0,0 +1,57 @@ +/****************************************************************************** + * + * watchdog.ld - Linker configuration file for watchdog. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 + SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 +} + +SECTIONS +{ + .text : + { + _text = .; + KEEP(*(.isr_vector)) + *(.text*) + *(.rodata*) + _etext = .; + } > FLASH + + .data : AT(ADDR(.text) + SIZEOF(.text)) + { + _data = .; + *(vtable) + *(.data*) + _edata = .; + } > SRAM + + .bss : + { + _bss = .; + *(.bss*) + *(COMMON) + _ebss = .; + } > SRAM +} diff --git a/boards/ek-lm4f232/watchdog/watchdog.sct b/boards/ek-lm4f232/watchdog/watchdog.sct new file mode 100644 index 0000000..e8ebf8f --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.sct @@ -0,0 +1,47 @@ +;****************************************************************************** +; +; watchdog.sct - Linker configuration file for watchdog. +; +; Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. +; Software License Agreement +; +; Texas Instruments (TI) is supplying this software for use solely and +; exclusively on TI's microcontroller products. The software is owned by +; TI and/or its suppliers, and is protected under applicable copyright +; laws. You may not combine this software with "viral" open-source +; software in order to form a larger program. +; +; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. +; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT +; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY +; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +; DAMAGES, FOR ANY REASON WHATSOEVER. +; +; This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. +; +;****************************************************************************** + +LR_IROM 0x00000000 0x00040000 +{ + ; + ; Specify the Execution Address of the code and the size. + ; + ER_IROM 0x00000000 0x00040000 + { + *.o (RESET, +First) + * (InRoot$$Sections, +RO) + } + + ; + ; Specify the Execution Address of the data area. + ; + RW_IRAM 0x20000000 0x00008000 + { + ; + ; Uncomment the following line in order to use IntRegister(). + ; + ;* (vtable, +First) + * (+RW, +ZI) + } +} diff --git a/boards/ek-lm4f232/watchdog/watchdog.uvopt b/boards/ek-lm4f232/watchdog/watchdog.uvopt new file mode 100644 index 0000000..ec58b6b --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.uvopt @@ -0,0 +1,331 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + + + + 0 + 0 + + + + watchdog + 0x4 + ARM-ADS + + 8000000 + + 1 + 1 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\rvmdk\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + + 0 + Data Sheet + DATASHTS\Luminary\TM4C123GH6PGE.PDF + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 0 + 0 + 4 + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + 0 + lmidk-agdi + -O4614 -S3 -FO29 + + + 0 + DLGTARM + + + + 0 + ARMDBGFLAGS + + + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\buttons.c + buttons.c + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\drivers\cfal96x64x16.c + cfal96x64x16.c + + + 1 + 3 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\startup_rvmdk.S + startup_rvmdk.S + + + 1 + 4 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + .\watchdog.c + watchdog.c + + + + + Libraries + 1 + 0 + 0 + + 2 + 5 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + driverlib.lib + + + 2 + 6 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\grlib\rvmdk\grlib.lib + grlib.lib + + + + + Documentation + 1 + 0 + 0 + + 3 + 7 + 5 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + .\readme.txt + readme.txt + + 44 + 0 + 1 + + -1 + -1 + + + -1 + -1 + + + 0 + 0 + 729 + 300 + + + + + + + 1 + 0 + + 100 + 0 + + + .\readme.txt + 0 + 1 + 1 + + + + + +
diff --git a/boards/ek-lm4f232/watchdog/watchdog.uvproj b/boards/ek-lm4f232/watchdog/watchdog.uvproj new file mode 100644 index 0000000..55e2d1e --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog.uvproj @@ -0,0 +1,439 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + watchdog + 0x4 + ARM-ADS + + + TM4C123GH6PGE + Texas Instruments + IRAM(0x20000000-0x20007FFF) IROM(0-0x3FFFF) CLOCK(8000000) CPUTYPE("Cortex-M4") FPU2 + + "STARTUP\Luminary\Startup.s" ("Luminary Startup Code") + UL2CM3(-O207 -S0 -C0 -FO7 -FD20000000 -FC800 -FN1 -FF0LM4F_256 -FS00 -FL040000) + 5919 + LM4Fxxxx.H + + + + + + + + + + 0 + + + + Luminary\ + Luminary\ + + 0 + 0 + 0 + 0 + 1 + + .\rvmdk\ + watchdog + 1 + 0 + 0 + 1 + 1 + .\rvmdk\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + fromelf --bin --output .\rvmdk\watchdog.bin .\rvmdk\watchdog.axf + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + + + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + + 0 + 4 + + + + + + + + + + + + + + BIN\lmidk-agdi.dll + + + + + 1 + 0 + 0 + 0 + 1 + 4099 + + BIN\lmidk-agdi.dll + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 8 + 1 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 1 + 0x0 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x8000 + + + 0 + 0x0 + 0x0 + + + + + + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + + --c99 + rvmdk PART_TM4C123GH6PGE TARGET_IS_TM4C123_RA1 + + ..;..\..\..\..; + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x20000000 + watchdog.sct + + + --entry Reset_Handler + + + + + + + + Source + + + buttons.c + 1 + ..\drivers\buttons.c + + + cfal96x64x16.c + 1 + ..\drivers\cfal96x64x16.c + + + startup_rvmdk.S + 2 + .\startup_rvmdk.S + + + watchdog.c + 1 + .\watchdog.c + + + + + Libraries + + + driverlib.lib + 4 + ..\..\..\..\driverlib\rvmdk\driverlib.lib + + + grlib.lib + 4 + ..\..\..\..\grlib\rvmdk\grlib.lib + + + + + Documentation + + + readme.txt + 5 + .\readme.txt + + + + + + + +
diff --git a/boards/ek-lm4f232/watchdog/watchdog_ccs.cmd b/boards/ek-lm4f232/watchdog/watchdog_ccs.cmd new file mode 100644 index 0000000..fada4f0 --- /dev/null +++ b/boards/ek-lm4f232/watchdog/watchdog_ccs.cmd @@ -0,0 +1,70 @@ +/****************************************************************************** + * + * watchdog_ccs.cmd - CCS linker configuration file for watchdog. + * + * Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved. + * Software License Agreement + * + * Texas Instruments (TI) is supplying this software for use solely and + * exclusively on TI's microcontroller products. The software is owned by + * TI and/or its suppliers, and is protected under applicable copyright + * laws. You may not combine this software with "viral" open-source + * software in order to form a larger program. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. + * NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT + * NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY + * CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, FOR ANY REASON WHATSOEVER. + * + * This is part of revision 2.1.0.12573 of the EK-LM4F232 Firmware Package. + * + *****************************************************************************/ + +--retain=g_pfnVectors + +/* The following command line options are set as part of the CCS project. */ +/* If you are building using the command line, or for some reason want to */ +/* define them here, you can uncomment and modify these lines as needed. */ +/* If you are using CCS for building, it is probably better to make any such */ +/* modifications in your CCS project and leave this file alone. */ +/* */ +/* --heap_size=0 */ +/* --stack_size=256 */ +/* --library=rtsv7M3_T_le_eabi.lib */ + +/* The starting address of the application. Normally the interrupt vectors */ +/* must be located at the beginning of the application. */ +#define APP_BASE 0x00000000 +#define RAM_BASE 0x20000000 + +/* System memory map */ + +MEMORY +{ + /* Application stored in and executes from internal flash */ + FLASH (RX) : origin = APP_BASE, length = 0x00040000 + /* Application uses internal RAM for data */ + SRAM (RWX) : origin = 0x20000000, length = 0x00008000 +} + +/* Section allocation in memory */ + +SECTIONS +{ + .intvecs: > APP_BASE + .text : > FLASH + .const : > FLASH + .cinit : > FLASH + .pinit : > FLASH + .init_array : > FLASH + + .vtable : > RAM_BASE + .data : > SRAM + .bss : > SRAM + .sysmem : > SRAM + .stack : > SRAM +} + +__STACK_TOP = __stack + 512; -- cgit v1.3.1