From f6229cae508ac17799d87e4424e97f0e7818d1cc Mon Sep 17 00:00:00 2001 From: Jerry Jacobs Date: Sat, 21 May 2016 00:23:23 +0200 Subject: [PATCH] Fixup tests/usb.c to read from correct SRAM base, fixes #351 --- CMakeLists.txt | 2 ++ tests/{stlink_usb.c => usb.c} | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) rename tests/{stlink_usb.c => usb.c} (93%) diff --git a/CMakeLists.txt b/CMakeLists.txt index efadb5c..d61a0ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,3 +129,5 @@ if(gtk_FOUND) install(FILES src/tools/gui/stlink-gui.ui DESTINATION ${INSTALLED_UI_DIR}) endif() + +add_subdirectory(tests) diff --git a/tests/stlink_usb.c b/tests/usb.c similarity index 93% rename from tests/stlink_usb.c rename to tests/usb.c index 787ac12..1ae6442 100644 --- a/tests/stlink_usb.c +++ b/tests/usb.c @@ -1,15 +1,14 @@ #include -#include "stlink-common.h" +#include +int main(int ac, char** av) +{ + (void)ac; + (void)av; -int main(int ac, char** av) { stlink_t* sl; reg regs; - /* unused */ - ac = ac; - av = av; - sl = stlink_open_usb(10, 1, NULL); if (sl != NULL) { printf("-- version\n"); @@ -36,13 +35,13 @@ int main(int ac, char** av) { printf("cpuid:part = %#x, rev = %#x\n", cpuid.part, cpuid.revision); printf("-- read_sram\n"); - static const uint32_t sram_base = 0x8000000; + static const uint32_t sram_base = STM32_SRAM_BASE; uint32_t off; for (off = 0; off < 16; off += 4) stlink_read_mem32(sl, sram_base + off, 4); printf("FP_CTRL\n"); - stlink_read_mem32(sl, CM3_REG_FP_CTRL, 4); + stlink_read_mem32(sl, STLINK_REG_CM3_FP_CTRL, 4); // no idea what reg this is.. */ // stlink_read_mem32(sl, 0xe000ed90, 4);