Fixup tests/usb.c to read from correct SRAM base, fixes #351

pull/420/head
Jerry Jacobs 2016-05-21 00:23:23 +02:00
rodzic d254b90521
commit f6229cae50
2 zmienionych plików z 9 dodań i 8 usunięć

Wyświetl plik

@ -129,3 +129,5 @@ if(gtk_FOUND)
install(FILES src/tools/gui/stlink-gui.ui install(FILES src/tools/gui/stlink-gui.ui
DESTINATION ${INSTALLED_UI_DIR}) DESTINATION ${INSTALLED_UI_DIR})
endif() endif()
add_subdirectory(tests)

Wyświetl plik

@ -1,15 +1,14 @@
#include <stdio.h> #include <stdio.h>
#include "stlink-common.h" #include <stlink.h>
int main(int ac, char** av)
{
(void)ac;
(void)av;
int main(int ac, char** av) {
stlink_t* sl; stlink_t* sl;
reg regs; reg regs;
/* unused */
ac = ac;
av = av;
sl = stlink_open_usb(10, 1, NULL); sl = stlink_open_usb(10, 1, NULL);
if (sl != NULL) { if (sl != NULL) {
printf("-- version\n"); 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("cpuid:part = %#x, rev = %#x\n", cpuid.part, cpuid.revision);
printf("-- read_sram\n"); printf("-- read_sram\n");
static const uint32_t sram_base = 0x8000000; static const uint32_t sram_base = STM32_SRAM_BASE;
uint32_t off; uint32_t off;
for (off = 0; off < 16; off += 4) for (off = 0; off < 16; off += 4)
stlink_read_mem32(sl, sram_base + off, 4); stlink_read_mem32(sl, sram_base + off, 4);
printf("FP_CTRL\n"); 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.. */ // no idea what reg this is.. */
// stlink_read_mem32(sl, 0xe000ed90, 4); // stlink_read_mem32(sl, 0xe000ed90, 4);