Merge branch 'master' of git://github.com/texane/stlink
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Sat, 4 Feb 2012 14:44:40 +0000 (15:44 +0100)
committerUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Sat, 4 Feb 2012 14:44:40 +0000 (15:44 +0100)
Conflicts:
src/stlink-common.c
Solved by propagating Karl's name change

12 files changed:
.gitignore
.project [deleted file]
README
doc/tutorial/tutorial.pdf
doc/tutorial/tutorial.tex
gdbserver/gdb-server.c
nbproject/Package-Default.bash [deleted file]
nbproject/Package-flash.bash [deleted file]
nbproject/configurations.xml [deleted file]
nbproject/project.xml [deleted file]
src/stlink-common.c
src/stlink-common.h

index 8e974b74bbd575209f80cbb05750e867e9343bea..bc2ba52acc07220080d9891829d187f16a6fec18 100644 (file)
@@ -1,4 +1,5 @@
-/nbproject/private/
+nbproject
+.project
 *.o
 *.elf
 doc/tutorial/*.log
diff --git a/.project b/.project
deleted file mode 100644 (file)
index 12a2f85..0000000
--- a/.project
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>stlink</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
-                       <triggers>clean,full,incremental,</triggers>
-                       <arguments>
-                               <dictionary>
-                                       <key>?children?</key>
-                                       <value>?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>?name?</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.append_environment</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
-                                       <value>all</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.buildArguments</key>
-                                       <value></value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.buildCommand</key>
-                                       <value>make</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
-                                       <value>clean</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.contents</key>
-                                       <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
-                                       <value>false</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.enableFullBuild</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
-                                       <value>all</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.stopOnError</key>
-                                       <value>true</value>
-                               </dictionary>
-                               <dictionary>
-                                       <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
-                                       <value>true</value>
-                               </dictionary>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.cdt.core.cnature</nature>
-               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
-               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
-       </natures>
-</projectDescription>
diff --git a/README b/README
index 1eb6d26173fa48103d0036d284afa27889eb22c1..022e191c15e7f18318b8b5e7224c66bb6327320b 100644 (file)
--- a/README
+++ b/README
@@ -1,11 +1,3 @@
-IMPORTANT SHORT TERM NOTICE:
-If you are targetting F1 devices, with either stlinkv1 or v2 hardware, you
-_need_ to use karlp's libwork2 branch.  
-
-If you are targetting F4, you _need_ to use texane's master
-
-If you are targetting F2 or L1, please let us know how it goes!
-
 HOWTO
 =====
 
@@ -22,8 +14,9 @@ called stlink and there are 2 versions:
 Common requirements
 ~~~~~~~~~~~~~~~~~~~
 
-libusb-1.0  (You probably already have this, but you'll need the 
+. libusb-1.0  (You probably already have this, but you'll need the
 development version to compile)
+. pkg-config
 
 IF YOU HAVE AN STLINKv1
 ~~~~~~~~~~~~~~~~~~~~~~~
@@ -136,16 +129,16 @@ STLink v1 (as found on the 32VL Discovery board)
 
 Known Working Targets:
 * STM32F100xx (Medium Density VL)
-* STM32F103 (according to jpa- o n##stm32
+* STM32F103 (according to jpa- on ##stm32)
 
 No information:
 * everything else!
 
-
 STLink v2 (as found on the 32L and F4 Discovery boards)
 Known Working Targets:
 * STM32F100xx (Medium Density VL, as on the 32VL Discovery board)
-* ?
+* STM32L1xx (STM32L Discovery board)
+* STM32F407xx (STM32F4 Discovery board)
 
 Please report any and all known working combinations so I can update this!
 
index d9b9333aef01627c9afecbeff887444662707d95..275e7a8fdd0755096ea549faab603b091439772e 100644 (file)
Binary files a/doc/tutorial/tutorial.pdf and b/doc/tutorial/tutorial.pdf differ
index c3615df7818a1dad9f4d08a35ae8639217d9b42d..2045d77dac7b231e942d08d9e4f8dde41511dde2 100644 (file)
@@ -60,6 +60,7 @@ are identical.
 Before continuing, the following dependencies must be met:
 \begin{itemize}
 \item libusb-1.0
+\item pkg-config
 \end{itemize}
 
 \paragraph{}
index 851c758a9a9dcf0f6feca36645aea584c058972d..94784fcdb896d7c88fdcc6894d7f52366af73ee2 100644 (file)
@@ -219,7 +219,7 @@ char* make_memory_map(stlink_t *sl) {
        char* map = malloc(4096);
        map[0] = '\0';
 
-       if(sl->chip_id==STM32F4_CHIP_ID) {
+       if(sl->chip_id==STM32_CHIPID_F4) {
        strcpy(map, memory_map_template_F4);
     } else {
         snprintf(map, 4096, memory_map_template,
@@ -669,6 +669,49 @@ int serve(stlink_t *sl, int port) {
                                                strncpy(&reply[1], data, length);
                                        }
                                }
+                       } else if(!strncmp(queryName, "Rcmd,",4)) {
+                               // Rcmd uses the wrong separator
+                               char *separator = strstr(packet, ","), *params = "";
+                               if(separator == NULL) {
+                                       separator = packet + strlen(packet);
+                               } else {
+                                       params = separator + 1;
+                               }
+                               
+
+                               if (!strncmp(params,"7265",4)) {// resume
+#ifdef DEBUG
+                                       printf("Rcmd: resume\n");
+#endif
+                                       stlink_run(sl);
+
+                                       reply = strdup("OK");
+                               } else if (!strncmp(params,"6861",4)) { //half
+                                       reply = strdup("OK");
+                                       
+                                       stlink_force_debug(sl);
+
+#ifdef DEBUG
+                                       printf("Rcmd: halt\n");
+#endif
+                               } else if (!strncmp(params,"7265",4)) { //reset
+                                       reply = strdup("OK");
+                                       
+                                       stlink_force_debug(sl);
+                                       stlink_reset(sl);
+                                       init_code_breakpoints(sl);
+                                       init_data_watchpoints(sl);
+                                       
+#ifdef DEBUG
+                                       printf("Rcmd: reset\n");
+#endif
+                               } else {
+#ifdef DEBUG
+                                       printf("Rcmd: %s\n", params);
+#endif
+
+                               }
+                               
                        }
 
                        if(reply == NULL)
diff --git a/nbproject/Package-Default.bash b/nbproject/Package-Default.bash
deleted file mode 100644 (file)
index f6abfb4..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash -x
-
-#
-# Generated - do not edit!
-#
-
-# Macros
-TOP=`pwd`
-CND_PLATFORM=GNU-Linux-x86
-CND_CONF=Default
-CND_DISTDIR=dist
-CND_BUILDDIR=build
-NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
-TMPDIRNAME=tmp-packaging
-OUTPUT_PATH=gdbserver/st-util
-OUTPUT_BASENAME=st-util
-PACKAGE_TOP_DIR=stlink/
-
-# Functions
-function checkReturnCode
-{
-    rc=$?
-    if [ $rc != 0 ]
-    then
-        exit $rc
-    fi
-}
-function makeDirectory
-# $1 directory path
-# $2 permission (optional)
-{
-    mkdir -p "$1"
-    checkReturnCode
-    if [ "$2" != "" ]
-    then
-      chmod $2 "$1"
-      checkReturnCode
-    fi
-}
-function copyFileToTmpDir
-# $1 from-file path
-# $2 to-file path
-# $3 permission
-{
-    cp "$1" "$2"
-    checkReturnCode
-    if [ "$3" != "" ]
-    then
-        chmod $3 "$2"
-        checkReturnCode
-    fi
-}
-
-# Setup
-cd "${TOP}"
-mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
-rm -rf ${NBTMPDIR}
-mkdir -p ${NBTMPDIR}
-
-# Copy files and create directories and links
-cd "${TOP}"
-makeDirectory "${NBTMPDIR}/stlink/bin"
-copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
-
-
-# Generate tar file
-cd "${TOP}"
-rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/stlink.tar
-cd ${NBTMPDIR}
-tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/stlink.tar *
-checkReturnCode
-
-# Cleanup
-cd "${TOP}"
-rm -rf ${NBTMPDIR}
diff --git a/nbproject/Package-flash.bash b/nbproject/Package-flash.bash
deleted file mode 100644 (file)
index 44fd0fc..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash -x
-
-#
-# Generated - do not edit!
-#
-
-# Macros
-TOP=`pwd`
-CND_PLATFORM=GNU-Linux-x86
-CND_CONF=flash
-CND_DISTDIR=dist
-CND_BUILDDIR=build
-NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
-TMPDIRNAME=tmp-packaging
-OUTPUT_PATH=MissingOutputInProject
-OUTPUT_BASENAME=MissingOutputInProject
-PACKAGE_TOP_DIR=stlink/
-
-# Functions
-function checkReturnCode
-{
-    rc=$?
-    if [ $rc != 0 ]
-    then
-        exit $rc
-    fi
-}
-function makeDirectory
-# $1 directory path
-# $2 permission (optional)
-{
-    mkdir -p "$1"
-    checkReturnCode
-    if [ "$2" != "" ]
-    then
-      chmod $2 "$1"
-      checkReturnCode
-    fi
-}
-function copyFileToTmpDir
-# $1 from-file path
-# $2 to-file path
-# $3 permission
-{
-    cp "$1" "$2"
-    checkReturnCode
-    if [ "$3" != "" ]
-    then
-        chmod $3 "$2"
-        checkReturnCode
-    fi
-}
-
-# Setup
-cd "${TOP}"
-mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
-rm -rf ${NBTMPDIR}
-mkdir -p ${NBTMPDIR}
-
-# Copy files and create directories and links
-cd "${TOP}"
-makeDirectory "${NBTMPDIR}/stlink"
-copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
-
-
-# Generate tar file
-cd "${TOP}"
-rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/stlink.tar
-cd ${NBTMPDIR}
-tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/stlink.tar *
-checkReturnCode
-
-# Cleanup
-cd "${TOP}"
-rm -rf ${NBTMPDIR}
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
deleted file mode 100644 (file)
index f1fcd48..0000000
+++ /dev/null
@@ -1,672 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configurationDescriptor version="79">
-  <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
-    <df name="stlink" root=".">
-      <df name="doc">
-        <df name="tutorial">
-        </df>
-      </df>
-      <df name="example">
-        <df name="32l_dac">
-          <in>discover_board.h</in>
-          <in>main.c</in>
-          <in>startup_stm32l1xx_md.s</in>
-          <in>system_stm32l1xx.c</in>
-        </df>
-        <df name="32l_lcd">
-          <in>discover_board.h</in>
-          <in>main.c</in>
-          <in>stm32l_discovery_lcd.c</in>
-          <in>stm32l_discovery_lcd.h</in>
-        </df>
-        <df name="32vl_factory_demo">
-          <in>main.c</in>
-          <in>startup_stm32f10x_md_vl.S</in>
-          <in>stm32f10x_conf.h</in>
-          <in>stm32f10x_it.c</in>
-          <in>stm32f10x_it.h</in>
-          <in>system_stm32f10x.c</in>
-        </df>
-        <df name="blink">
-          <in>main.c</in>
-        </df>
-        <df name="blink_flash">
-          <in>discover_board.h</in>
-          <in>main.c</in>
-          <in>startup_stm32l1xx_md.s</in>
-          <in>system_stm32l1xx.c</in>
-        </df>
-        <df name="board_support">
-          <df name="discovery_32vl">
-            <in>STM32vldiscovery.c</in>
-            <in>STM32vldiscovery.h</in>
-          </df>
-        </df>
-        <df name="libs_stm">
-          <df name="build">
-          </df>
-          <df name="inc">
-            <df name="base">
-              <in>stdint.h</in>
-            </df>
-            <df name="core_support">
-              <in>core_cm3.c</in>
-              <in>core_cm3.h</in>
-            </df>
-            <df name="device_support">
-              <in>stm32f10x.h</in>
-              <in>stm32l1xx.h</in>
-              <in>system_stm32f10x.h</in>
-              <in>system_stm32l1xx.h</in>
-            </df>
-            <df name="stm32f10x">
-              <in>misc.h</in>
-              <in>stm32f10x_adc.h</in>
-              <in>stm32f10x_bkp.h</in>
-              <in>stm32f10x_can.h</in>
-              <in>stm32f10x_cec.h</in>
-              <in>stm32f10x_crc.h</in>
-              <in>stm32f10x_dac.h</in>
-              <in>stm32f10x_dbgmcu.h</in>
-              <in>stm32f10x_dma.h</in>
-              <in>stm32f10x_exti.h</in>
-              <in>stm32f10x_flash.h</in>
-              <in>stm32f10x_fsmc.h</in>
-              <in>stm32f10x_gpio.h</in>
-              <in>stm32f10x_i2c.h</in>
-              <in>stm32f10x_iwdg.h</in>
-              <in>stm32f10x_pwr.h</in>
-              <in>stm32f10x_rcc.h</in>
-              <in>stm32f10x_rtc.h</in>
-              <in>stm32f10x_sdio.h</in>
-              <in>stm32f10x_spi.h</in>
-              <in>stm32f10x_tim.h</in>
-              <in>stm32f10x_usart.h</in>
-              <in>stm32f10x_wwdg.h</in>
-            </df>
-            <df name="stm32l1xx">
-              <in>misc.h</in>
-              <in>stm32l1xx_adc.h</in>
-              <in>stm32l1xx_comp.h</in>
-              <in>stm32l1xx_crc.h</in>
-              <in>stm32l1xx_dac.h</in>
-              <in>stm32l1xx_dbgmcu.h</in>
-              <in>stm32l1xx_dma.h</in>
-              <in>stm32l1xx_exti.h</in>
-              <in>stm32l1xx_flash.h</in>
-              <in>stm32l1xx_gpio.h</in>
-              <in>stm32l1xx_i2c.h</in>
-              <in>stm32l1xx_iwdg.h</in>
-              <in>stm32l1xx_lcd.h</in>
-              <in>stm32l1xx_pwr.h</in>
-              <in>stm32l1xx_rcc.h</in>
-              <in>stm32l1xx_rtc.h</in>
-              <in>stm32l1xx_spi.h</in>
-              <in>stm32l1xx_syscfg.h</in>
-              <in>stm32l1xx_tim.h</in>
-              <in>stm32l1xx_usart.h</in>
-              <in>stm32l1xx_wwdg.h</in>
-            </df>
-          </df>
-          <df name="src">
-            <df name="stm32f10x">
-              <in>misc.c</in>
-              <in>stm32f10x_adc.c</in>
-              <in>stm32f10x_bkp.c</in>
-              <in>stm32f10x_can.c</in>
-              <in>stm32f10x_cec.c</in>
-              <in>stm32f10x_crc.c</in>
-              <in>stm32f10x_dac.c</in>
-              <in>stm32f10x_dbgmcu.c</in>
-              <in>stm32f10x_dma.c</in>
-              <in>stm32f10x_exti.c</in>
-              <in>stm32f10x_flash.c</in>
-              <in>stm32f10x_fsmc.c</in>
-              <in>stm32f10x_gpio.c</in>
-              <in>stm32f10x_i2c.c</in>
-              <in>stm32f10x_iwdg.c</in>
-              <in>stm32f10x_pwr.c</in>
-              <in>stm32f10x_rcc.c</in>
-              <in>stm32f10x_rtc.c</in>
-              <in>stm32f10x_sdio.c</in>
-              <in>stm32f10x_spi.c</in>
-              <in>stm32f10x_tim.c</in>
-              <in>stm32f10x_usart.c</in>
-              <in>stm32f10x_wwdg.c</in>
-            </df>
-            <df name="stm32l1xx">
-              <in>misc.c</in>
-              <in>stm32l1xx_adc.c</in>
-              <in>stm32l1xx_comp.c</in>
-              <in>stm32l1xx_crc.c</in>
-              <in>stm32l1xx_dac.c</in>
-              <in>stm32l1xx_dbgmcu.c</in>
-              <in>stm32l1xx_dma.c</in>
-              <in>stm32l1xx_exti.c</in>
-              <in>stm32l1xx_flash.c</in>
-              <in>stm32l1xx_flash_ramfunc.c</in>
-              <in>stm32l1xx_gpio.c</in>
-              <in>stm32l1xx_i2c.c</in>
-              <in>stm32l1xx_iwdg.c</in>
-              <in>stm32l1xx_lcd.c</in>
-              <in>stm32l1xx_pwr.c</in>
-              <in>stm32l1xx_rcc.c</in>
-              <in>stm32l1xx_rtc.c</in>
-              <in>stm32l1xx_spi.c</in>
-              <in>stm32l1xx_syscfg.c</in>
-              <in>stm32l1xx_tim.c</in>
-              <in>stm32l1xx_usart.c</in>
-              <in>stm32l1xx_wwdg.c</in>
-            </df>
-          </df>
-        </df>
-        <df name="libs_stm">
-          <df name="inc">
-            <df name="base">
-            </df>
-            <df name="base">
-            </df>
-            <df name="device_support">
-            </df>
-            <df name="device_support">
-            </df>
-            <df name="stm32f10x">
-            </df>
-            <df name="stm32l1xx">
-            </df>
-            <df name="stm32l1xx">
-            </df>
-          </df>
-        </df>
-        <df name="libs_stm">
-          <df name="inc">
-            <df name="base">
-            </df>
-            <df name="base">
-            </df>
-            <df name="device_support">
-            </df>
-            <df name="device_support">
-            </df>
-            <df name="stm32f10x">
-            </df>
-            <df name="stm32f10x">
-            </df>
-            <df name="stm32l1xx">
-            </df>
-            <df name="stm32l1xx">
-            </df>
-          </df>
-        </df>
-      </df>
-      <df name="flash">
-        <in>main.c</in>
-      </df>
-      <df name="gdbserver">
-        <in>gdb-remote.c</in>
-        <in>gdb-remote.h</in>
-        <in>gdb-server.c</in>
-      </df>
-      <df name="src">
-        <in>stlink-common.c</in>
-        <in>stlink-common.h</in>
-        <in>stlink-sg.c</in>
-        <in>stlink-sg.h</in>
-        <in>stlink-usb.c</in>
-        <in>stlink-usb.h</in>
-        <in>test_sg.c</in>
-        <in>test_usb.c</in>
-        <in>uglylogging.c</in>
-        <in>uglylogging.h</in>
-      </df>
-      <df name="toremove">
-        <df name="stm32l">
-          <df name="src">
-            <in>stlink-hw.h</in>
-          </df>
-        </df>
-        <df name="stm32l_notes">
-        </df>
-      </df>
-    </df>
-    <logicalFolder name="ExternalFiles"
-                   displayName="Important Files"
-                   projectFiles="false"
-                   kind="IMPORTANT_FILES_FOLDER">
-      <itemPath>Makefile</itemPath>
-    </logicalFolder>
-  </logicalFolder>
-  <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>
-  <sourceRootList>
-    <Elem>.</Elem>
-  </sourceRootList>
-  <projectmakefile>Makefile</projectmakefile>
-  <confs>
-    <conf name="Default" type="0">
-      <toolsSet>
-        <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
-        <compilerSet>default</compilerSet>
-      </toolsSet>
-      <makefileType>
-        <makeTool>
-          <buildCommandWorkingDir>.</buildCommandWorkingDir>
-          <buildCommand>${MAKE} -f Makefile</buildCommand>
-          <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
-          <executablePath>gdbserver/st-util</executablePath>
-        </makeTool>
-      </makefileType>
-      <item path="example/32l_dac/startup_stm32l1xx_md.s"
-            ex="true"
-            tool="4"
-            flavor="0">
-      </item>
-      <item path="example/32vl_factory_demo/startup_stm32f10x_md_vl.S"
-            ex="true"
-            tool="4"
-            flavor="0">
-      </item>
-      <item path="example/blink/main.c" ex="true" tool="0" flavor="0">
-      </item>
-      <item path="example/blink_flash/discover_board.h" ex="true" tool="3" flavor="0">
-      </item>
-      <item path="example/blink_flash/main.c" ex="true" tool="0" flavor="0">
-      </item>
-      <item path="example/blink_flash/startup_stm32l1xx_md.s"
-            ex="true"
-            tool="4"
-            flavor="0">
-      </item>
-      <item path="example/blink_flash/system_stm32l1xx.c"
-            ex="true"
-            tool="0"
-            flavor="0">
-      </item>
-      <item path="example/blink_mfischer/crt.c" ex="false" tool="3" flavor="0">
-      </item>
-      <item path="example/blink_mfischer/main.c" ex="false" tool="3" flavor="0">
-      </item>
-      <item path="example/blink_mfischer/vectors_stm32f10x_md.c"
-            ex="false"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/dac/main.c" ex="false" tool="3" flavor="0">
-      </item>
-      <item path="example/dac/system_stm32l1xx.c" ex="false" tool="3" flavor="0">
-      </item>
-      <item path="example/lcd/main.c" ex="false" tool="3" flavor="0">
-      </item>
-      <item path="example/lcd/stm32l_discovery_lcd.c" ex="false" tool="3" flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/base/stdint.h" ex="true" tool="3" flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/core_support/core_cm3.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/device_support/stm32f10x.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/device_support/stm32l1xx.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/device_support/system_stm32f10x.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/device_support/system_stm32l1xx.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/misc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_adc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_bkp.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_can.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_cec.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_crc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_dac.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_dbgmcu.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_dma.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_exti.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_flash.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_fsmc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_gpio.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_i2c.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_iwdg.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_pwr.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_rcc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_rtc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_sdio.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_spi.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_tim.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_usart.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32f10x/stm32f10x_wwdg.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/misc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_adc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_comp.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_crc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_dac.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_dbgmcu.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_dma.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_exti.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_flash.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_gpio.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_i2c.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_iwdg.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_lcd.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_pwr.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_rcc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_rtc.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_spi.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_syscfg.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_tim.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_usart.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libs_stm/inc/stm32l1xx/stm32l1xx_wwdg.h"
-            ex="true"
-            tool="3"
-            flavor="0">
-      </item>
-      <item path="example/libstm32l_discovery/inc/core_support/core_cm3.c"
-            ex="false"
-            tool="3"
-            flavor="0">
-      </item>
-      <folder path="stlink/example">
-        <cTool>
-          <incDir>
-            <pElem>.</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>DEBUG=1</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="stlink/flash">
-        <cTool>
-          <incDir>
-            <pElem>src</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>CONFIG_USE_LIBUSB=1</Elem>
-            <Elem>DEBUG</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="stlink/gdbserver">
-        <cTool>
-          <incDir>
-            <pElem>src</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>CONFIG_USE_LIBUSB=1</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="stlink/src">
-        <cTool>
-          <incDir>
-            <pElem>.</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>DEBUG=1</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <item path="toremove/stm32l/src/stlink-hw.h" ex="true" tool="3" flavor="0">
-      </item>
-    </conf>
-    <conf name="flash" type="0">
-      <toolsSet>
-        <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
-        <compilerSet>default</compilerSet>
-      </toolsSet>
-      <makefileType>
-        <makeTool>
-          <buildCommandWorkingDir>flash</buildCommandWorkingDir>
-          <buildCommand>${MAKE} -f Makefile</buildCommand>
-          <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
-          <executablePath></executablePath>
-          <cTool>
-            <preprocessorList>
-              <Elem>DEBUG</Elem>
-            </preprocessorList>
-          </cTool>
-        </makeTool>
-      </makefileType>
-      <item path="example/32vl_factory_demo/startup_stm32f10x_md_vl.S"
-            ex="true"
-            tool="4"
-            flavor="0">
-      </item>
-      <item path="example/blink/main.c" ex="true" tool="0" flavor="0">
-      </item>
-      <item path="example/blink_flash/main.c" ex="true" tool="0" flavor="0">
-      </item>
-      <item path="example/blink_flash/startup_stm32l1xx_md.s"
-            ex="true"
-            tool="4"
-            flavor="0">
-      </item>
-      <item path="example/blink_flash/system_stm32l1xx.c"
-            ex="true"
-            tool="0"
-            flavor="0">
-      </item>
-      <folder path="stlink/flash">
-        <cTool>
-          <incDir>
-            <pElem>src</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>CONFIG_USE_LIBUSB=1</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="stlink/gdbserver">
-        <cTool>
-          <incDir>
-            <pElem>src</pElem>
-          </incDir>
-          <preprocessorList>
-            <Elem>CONFIG_USE_LIBSG=1</Elem>
-            <Elem>CONFIG_USE_LIBUSB=1</Elem>
-          </preprocessorList>
-        </cTool>
-      </folder>
-      <folder path="stlink/src">
-        <cTool>
-          <incDir>
-            <pElem>.</pElem>
-          </incDir>
-        </cTool>
-      </folder>
-      <item path="gdbserver/gdb-remote.c" ex="true" tool="0" flavor="0">
-      </item>
-      <item path="gdbserver/gdb-remote.h" ex="true" tool="3" flavor="0">
-      </item>
-      <item path="gdbserver/gdb-server.c" ex="true" tool="0" flavor="0">
-      </item>
-      <item path="toremove/stm32l/src/stlink-hw.h" ex="true" tool="3" flavor="0">
-      </item>
-    </conf>
-  </confs>
-</configurationDescriptor>
diff --git a/nbproject/project.xml b/nbproject/project.xml
deleted file mode 100644 (file)
index 7526e4b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://www.netbeans.org/ns/project/1">
-    <type>org.netbeans.modules.cnd.makeproject</type>
-    <configuration>
-        <data xmlns="http://www.netbeans.org/ns/make-project/1">
-            <name>stlink</name>
-            <c-extensions>c</c-extensions>
-            <cpp-extensions/>
-            <header-extensions>h</header-extensions>
-            <sourceEncoding>UTF-8</sourceEncoding>
-            <make-dep-projects/>
-            <sourceRootList>
-                <sourceRootElem>.</sourceRootElem>
-            </sourceRootList>
-            <confList>
-                <confElem>
-                    <name>Default</name>
-                    <type>0</type>
-                </confElem>
-                <confElem>
-                    <name>flash</name>
-                    <type>0</type>
-                </confElem>
-            </confList>
-        </data>
-    </configuration>
-</project>
index 68b7d5049ab6a44f9e7ba0f7e7bd5f3f96ff6756..26b36cd24121cf8c8b77ecff059a3893f75c52f7 100644 (file)
@@ -136,7 +136,7 @@ static inline uint32_t read_flash_obr(stlink_t *sl) {
 
 static inline uint32_t read_flash_cr(stlink_t *sl) {
         uint32_t res;
-       if((sl->chip_id==STM32_CHIPID_F2) ||(sl->chip_id==STM32F4_CHIP_ID))
+       if((sl->chip_id==STM32_CHIPID_F2) ||(sl->chip_id==STM32_CHIPID_F4))
                res = stlink_read_debug32(sl, FLASH_F4_CR);
        else
                res = stlink_read_debug32(sl, FLASH_CR);
@@ -148,7 +148,7 @@ static inline uint32_t read_flash_cr(stlink_t *sl) {
 
 static inline unsigned int is_flash_locked(stlink_t *sl) {
     /* return non zero for true */
-       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
                return read_flash_cr(sl) & (1 << FLASH_F4_CR_LOCK);
        else
                return read_flash_cr(sl) & (1 << FLASH_CR_LOCK);
@@ -160,7 +160,7 @@ static void unlock_flash(stlink_t *sl) {
        an invalid sequence results in a definitive lock of
        the FPEC block until next reset.
      */
-    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID)) {
+    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4)) {
        stlink_write_debug32(sl, FLASH_F4_KEYR, FLASH_KEY1);
                stlink_write_debug32(sl, FLASH_F4_KEYR, FLASH_KEY2);
     }
@@ -186,7 +186,7 @@ static int unlock_flash_if(stlink_t *sl) {
 }
 
 static void lock_flash(stlink_t *sl) {
-    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID)) {
+    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4)) {
        const uint32_t n = read_flash_cr(sl) | (1 << FLASH_F4_CR_LOCK);
        stlink_write_debug32(sl, FLASH_F4_CR, n);
     }
@@ -199,7 +199,7 @@ static void lock_flash(stlink_t *sl) {
 
 
 static void set_flash_cr_pg(stlink_t *sl) {
-    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID)) {
+    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4)) {
                uint32_t x = read_flash_cr(sl);
                x |= (1 << FLASH_CR_PG);
        stlink_write_debug32(sl, FLASH_F4_CR, x);
@@ -212,7 +212,7 @@ static void set_flash_cr_pg(stlink_t *sl) {
 
 static void __attribute__((unused)) clear_flash_cr_pg(stlink_t *sl) {
     const uint32_t n = read_flash_cr(sl) & ~(1 << FLASH_CR_PG);
-    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
        stlink_write_debug32(sl, FLASH_F4_CR, n);
     else
         stlink_write_debug32(sl, FLASH_CR, n);
@@ -229,7 +229,7 @@ static void __attribute__((unused)) clear_flash_cr_per(stlink_t *sl) {
 }
 
 static void set_flash_cr_mer(stlink_t *sl) {
-    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
         stlink_write_debug32(sl, FLASH_F4_CR,
                              stlink_read_debug32(sl, FLASH_F4_CR) | (1 << FLASH_CR_MER));
     else 
@@ -238,7 +238,7 @@ static void set_flash_cr_mer(stlink_t *sl) {
 }
 
 static void __attribute__((unused)) clear_flash_cr_mer(stlink_t *sl) {
-    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+    if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
         stlink_write_debug32(sl, FLASH_F4_CR,
                              stlink_read_debug32(sl, FLASH_F4_CR) & ~(1 << FLASH_CR_MER));
     else 
@@ -247,7 +247,7 @@ static void __attribute__((unused)) clear_flash_cr_mer(stlink_t *sl) {
 }
 
 static void set_flash_cr_strt(stlink_t *sl) {
-       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
        {
                uint32_t x = read_flash_cr(sl);
                x |= (1 << FLASH_F4_CR_STRT);
@@ -266,7 +266,7 @@ static inline uint32_t read_flash_acr(stlink_t *sl) {
 
 static inline uint32_t read_flash_sr(stlink_t *sl) {
        uint32_t res;
-       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
                res = stlink_read_debug32(sl, FLASH_F4_SR);
        else
                res = stlink_read_debug32(sl, FLASH_SR);
@@ -275,7 +275,7 @@ static inline uint32_t read_flash_sr(stlink_t *sl) {
 }
 
 static inline unsigned int is_flash_busy(stlink_t *sl) {
-       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
                return read_flash_sr(sl) & (1 << FLASH_F4_SR_BSY);
        else
                return read_flash_sr(sl) & (1 << FLASH_SR_BSY);
@@ -927,7 +927,7 @@ uint32_t calculate_F4_sectornum(uint32_t flashaddr){
 }
 
 uint32_t stlink_calculate_pagesize(stlink_t *sl, uint32_t flashaddr){
-       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID)) {
+       if((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4)) {
                uint32_t sector=calculate_F4_sectornum(flashaddr);
                if (sector<4) sl->flash_pgsz=0x4000;
                else if(sector<5) sl->flash_pgsz=0x10000;
@@ -944,7 +944,7 @@ uint32_t stlink_calculate_pagesize(stlink_t *sl, uint32_t flashaddr){
  */
 int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr)
 {
-  if ((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID))
+  if ((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4))
   {
     /* wait for ongoing op to finish */
     wait_flash_busy(sl);
@@ -1355,7 +1355,7 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, unsigned
     ILOG("Finished erasing %d pages of %d (%#x) bytes\n", 
         page_count, sl->flash_pgsz, sl->flash_pgsz);
 
-    if ((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32F4_CHIP_ID)) {
+    if ((sl->chip_id == STM32_CHIPID_F2) ||(sl->chip_id == STM32_CHIPID_F4)) {
        /* todo: check write operation */
 
        /* First unlock the cr */
@@ -1451,7 +1451,7 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, unsigned
                    fprintf(stdout, "\r");
 
                if ((off % sl->flash_pgsz) > (sl->flash_pgsz -5)) {
-                   fprintf(stdout, "\r%3u/%u pages written", 
+                   fprintf(stdout, "\r%3zd/%3zd pages written",
                            off/sl->flash_pgsz, len/sl->flash_pgsz);
                    fflush(stdout);
                }
index 155c6c003083e5e3fe45c4b253ccb67d3370e222..6fcb2194e10cc35fc9b63fcf1718983376ed4260 100644 (file)
@@ -81,10 +81,18 @@ extern "C" {
 #define CM3_REG_FP_COMP0 0xE0002008
 
 /* cortex core ids */
+    // TODO clean this up...
 #define STM32VL_CORE_ID 0x1ba01477
 #define STM32L_CORE_ID 0x2ba01477
 #define STM32F4_CORE_ID 0x2ba01477
-    
+#define CORE_M3_R1 0x1BA00477
+#define CORE_M3_R2 0x4BA00477
+#define CORE_M4_R0 0x2BA01477
+
+/*
+ * Chip IDs are explained in the appropriate programming manual for the
+ * DBGMCU_IDCODE register (0xE0042000)
+ */
 // stm32 chipids, only lower 12 bits..
 #define STM32_CHIPID_F1_MEDIUM 0x410
 #define STM32_CHIPID_F2 0x411
@@ -101,17 +109,6 @@ extern "C" {
 #define STM32_FLASH_BASE 0x08000000
 #define STM32_SRAM_BASE 0x20000000
 
-/*
- * Chip IDs are explained in the appropriate programming manual for the
- * DBGMCU_IDCODE register (0xE0042000)
- */
-#define CORE_M3_R1 0x1BA00477
-#define CORE_M3_R2 0x4BA00477
-#define CORE_M4_R0 0x2BA01477
-
-/* using chip id for F4 ident, since core id is same as F1 */
-#define STM32F4_CHIP_ID 0x413
-
 /* Cortex™-M3 Technical Reference Manual */
 /* Debug Halting Control and Status Register */
 #define DHCSR 0xe000edf0