remove SYSRESETREQ send, this should be sent by debug host (like Keil)

pull/13/head
XIVN1987 1 year ago
parent f403988e4f
commit 0b46bf88eb
  1. 82
      AT32F425/DAPLink.uvoptx
  2. 18
      AT32F425/DAPLink.uvprojx
  3. 10
      AT32F425/src/DAP_config.h
  4. 13
      CH32V203/.cproject
  5. 4
      CH32V203/.project
  6. 10
      CH32V203/src/DAP_config.h
  7. 8
      CH32V305/.cproject
  8. 23
      CH32V305/.project
  9. 10
      CH32V305/src/DAP_config.h
  10. 0
      DAP/Config/DAP_config.h
  11. 0
      DAP/Include/DAP.h
  12. 0
      DAP/Source/DAP.c
  13. 0
      DAP/Source/DAP_vendor.c
  14. 0
      DAP/Source/JTAG_DP.c
  15. 0
      DAP/Source/SWO.c
  16. 0
      DAP/Source/SW_DP.c
  17. 0
      DAP/Source/UART.c
  18. 90
      core/SWD_host/SWD_flash.c
  19. 38
      core/SWD_host/SWD_flash.h
  20. 1092
      core/SWD_host/SWD_host.c
  21. 39
      core/SWD_host/SWD_host.h
  22. 147
      core/SWD_host/debug_ca.h
  23. 168
      core/SWD_host/debug_cm.h
  24. 33
      core/SWD_host/flash_blob.h

@ -140,7 +140,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>JL2CM3</Key>
<Name>-U59607536 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0AT32F425_64.FLM -FS08000000 -FL010000 -FP0($$Device:-AT32F425F8P7$Flash\AT32F425_64.FLM)</Name>
<Name>-U20090928 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0AT32F425_64.FLM -FS08000000 -FL010000 -FP0($$Device:-AT32F425F8P7$Flash\AT32F425_64.FLM)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
@ -232,7 +232,7 @@
<Group>
<GroupName>APP</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -288,7 +288,7 @@
<Group>
<GroupName>DAP</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@ -299,7 +299,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\core\DAP\Source\DAP.c</PathWithFileName>
<PathWithFileName>..\DAP\Source\DAP.c</PathWithFileName>
<FilenameWithoutPath>DAP.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
@ -311,7 +311,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\core\DAP\Source\SW_DP.c</PathWithFileName>
<PathWithFileName>..\DAP\Source\SW_DP.c</PathWithFileName>
<FilenameWithoutPath>SW_DP.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
@ -323,7 +323,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\core\DAP\Source\JTAG_DP.c</PathWithFileName>
<PathWithFileName>..\DAP\Source\JTAG_DP.c</PathWithFileName>
<FilenameWithoutPath>JTAG_DP.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
@ -331,7 +331,7 @@
</Group>
<Group>
<GroupName>SWD_host</GroupName>
<GroupName>CSL/USBD</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
@ -343,34 +343,14 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\core\SWD_host\SWD_host.c</PathWithFileName>
<FilenameWithoutPath>SWD_host.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>CSL/USBD</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\src\CSL\AT32F425_USB_Lib\usb_core.c</PathWithFileName>
<FilenameWithoutPath>usb_core.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>10</FileNumber>
<GroupNumber>3</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -381,8 +361,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>11</FileNumber>
<GroupNumber>3</GroupNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -393,8 +373,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>12</FileNumber>
<GroupNumber>3</GroupNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -413,8 +393,8 @@
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>13</FileNumber>
<GroupNumber>4</GroupNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -425,8 +405,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>14</FileNumber>
<GroupNumber>4</GroupNumber>
<FileNumber>13</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -437,8 +417,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>15</FileNumber>
<GroupNumber>4</GroupNumber>
<FileNumber>14</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -449,8 +429,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>16</FileNumber>
<GroupNumber>4</GroupNumber>
<FileNumber>15</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -461,8 +441,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>17</FileNumber>
<GroupNumber>4</GroupNumber>
<FileNumber>16</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -473,8 +453,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>18</FileNumber>
<GroupNumber>4</GroupNumber>
<FileNumber>17</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -485,8 +465,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>19</FileNumber>
<GroupNumber>4</GroupNumber>
<FileNumber>18</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -505,8 +485,8 @@
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>20</FileNumber>
<GroupNumber>5</GroupNumber>
<FileNumber>19</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -517,8 +497,8 @@
<bShared>0</bShared>
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>21</FileNumber>
<GroupNumber>5</GroupNumber>
<FileNumber>20</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

@ -338,7 +338,7 @@
<MiscControls></MiscControls>
<Define>AT32F425F8P7,USE_STDPERIPH_DRIVER, DAP_FW_V1</Define>
<Undefine></Undefine>
<IncludePath>.\src;.\src\CSL\CMSIS\core_support;.\src\CSL\CMSIS\device_support;.\src\CSL\AT32F425_StdPeriph_Driver;.\src\CSL\AT32F425_USB_Lib;..\core\DAP\Include;..\core\SWD_host</IncludePath>
<IncludePath>.\src;.\src\CSL\CMSIS\core_support;.\src\CSL\CMSIS\device_support;.\src\CSL\AT32F425_StdPeriph_Driver;.\src\CSL\AT32F425_USB_Lib;..\DAP\Include</IncludePath>
</VariousControls>
</Cads>
<Aads>
@ -410,27 +410,17 @@
<File>
<FileName>DAP.c</FileName>
<FileType>1</FileType>
<FilePath>..\core\DAP\Source\DAP.c</FilePath>
<FilePath>..\DAP\Source\DAP.c</FilePath>
</File>
<File>
<FileName>SW_DP.c</FileName>
<FileType>1</FileType>
<FilePath>..\core\DAP\Source\SW_DP.c</FilePath>
<FilePath>..\DAP\Source\SW_DP.c</FilePath>
</File>
<File>
<FileName>JTAG_DP.c</FileName>
<FileType>1</FileType>
<FilePath>..\core\DAP\Source\JTAG_DP.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>SWD_host</GroupName>
<Files>
<File>
<FileName>SWD_host.c</FileName>
<FileType>1</FileType>
<FilePath>..\core\SWD_host\SWD_host.c</FilePath>
<FilePath>..\DAP\Source\JTAG_DP.c</FilePath>
</File>
</Files>
</Group>

@ -544,15 +544,9 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
- 0: issue a device hardware reset.
- 1: release device hardware reset.
*/
extern uint8_t swd_write_word(uint32_t addr, uint32_t val);
__STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) {
if(bit & 1) nRESET_PORT->scr = nRESET_PIN;
else nRESET_PORT->clr = nRESET_PIN;
if((bit & 1) == 0)
{
swd_write_word((uint32_t)&SCB->AIRCR, ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk));
}
}
///@}
@ -661,9 +655,7 @@ when a device needs a time-critical unlock sequence that enables the debug port.
1 = a device specific reset sequence is implemented.
*/
__STATIC_INLINE uint8_t RESET_TARGET (void) {
swd_write_word((uint32_t)&SCB->AIRCR, ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk));
return 1; // change to '1' when a device reset sequence is implemented
return (0U); // change to '1' when a device reset sequence is implemented
}
///@}

@ -62,8 +62,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/USBLib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/USBUsr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/core/DAP/Include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/core/SWD_host}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/DAP/Include}&quot;"/>
</option>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
@ -117,8 +116,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="src/Startup/startup_ch32v20x_D8W.S|src/Startup/startup_ch32v20x_D8.S|core|Startup/startup_ch32v20x_D8W.S|Startup/startup_ch32v20x_D8.S" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="core"/>
<entry excluding="DAP|src/Startup/startup_ch32v20x_D8W.S|src/Startup/startup_ch32v20x_D8.S|" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="DAP"/>
</sourceEntries>
</configuration>
</storageModule>
@ -140,9 +139,5 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="obj">
<resource resourceType="PROJECT" workspacePath="/DAPLink"/>
</configuration>
</storageModule>
</cproject>

@ -33,9 +33,9 @@
</filteredResources>
<linkedResources>
<link>
<name>core</name>
<name>DAP</name>
<type>2</type>
<location>PARENT-1-PROJECT_LOC/core</location>
<location>PARENT-1-PROJECT_LOC/DAP</location>
</link>
</linkedResources>
</projectDescription>

@ -558,15 +558,9 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
- 0: issue a device hardware reset.
- 1: release device hardware reset.
*/
extern uint8_t swd_write_word(uint32_t addr, uint32_t val);
__STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) {
if(bit & 1) nRESET_PORT->BSHR = nRESET_PIN;
else nRESET_PORT->BCR = nRESET_PIN;
if((bit & 1) == 0)
{
swd_write_word((uint32_t)&SCB->AIRCR, ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk));
}
}
///@}
@ -675,9 +669,7 @@ when a device needs a time-critical unlock sequence that enables the debug port.
1 = a device specific reset sequence is implemented.
*/
__STATIC_INLINE uint8_t RESET_TARGET (void) {
swd_write_word((uint32_t)&SCB->AIRCR, ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk));
return 1; // change to '1' when a device reset sequence is implemented
return (0U); // change to '1' when a device reset sequence is implemented
}
///@}

@ -61,8 +61,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/Startup}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/USBD}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/core/DAP/Include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/core/SWD_host}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/DAP/Include}&quot;"/>
</option>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
@ -117,8 +116,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="src/Startup/startup_ch32v30x_D8.S|core|Startup|Peripheral|Ld|Debug|Core" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="core"/>
<entry excluding="DAP|src/Startup/startup_ch32v30x_D8.S" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="DAP"/>
</sourceEntries>
</configuration>
</storageModule>
@ -140,4 +139,5 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>

@ -2,20 +2,17 @@
<projectDescription>
<name>DAPLink</name>
<comment/>
<projects>
</projects>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
@ -23,13 +20,6 @@
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>core</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/core</locationURI>
</link>
</linkedResources>
<filteredResources>
<filter>
<id>1685539991138</id>
@ -41,4 +31,11 @@
</matcher>
</filter>
</filteredResources>
<linkedResources>
<link>
<name>DAP</name>
<type>2</type>
<location>PARENT-1-PROJECT_LOC/DAP</location>
</link>
</linkedResources>
</projectDescription>

@ -559,15 +559,9 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
- 0: issue a device hardware reset.
- 1: release device hardware reset.
*/
extern uint8_t swd_write_word(uint32_t addr, uint32_t val);
__STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) {
if(bit & 1) nRESET_PORT->BSHR = nRESET_PIN;
else nRESET_PORT->BCR = nRESET_PIN;
if((bit & 1) == 0)
{
swd_write_word((uint32_t)&SCB->AIRCR, ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk));
}
}
///@}
@ -676,9 +670,7 @@ when a device needs a time-critical unlock sequence that enables the debug port.
1 = a device specific reset sequence is implemented.
*/
__STATIC_INLINE uint8_t RESET_TARGET (void) {
swd_write_word((uint32_t)&SCB->AIRCR, ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk));
return 1; // change to '1' when a device reset sequence is implemented
return (0U); // change to '1' when a device reset sequence is implemented
}
///@}

@ -1,90 +0,0 @@
/**
* @file SWD_flash.c
* @brief Program target flash through SWD
*/
#include "swd_host.h"
#include "SWD_flash.h"
extern const program_target_t flash_algo;
error_t target_flash_init(uint32_t flash_start, uint32_t func)
{
if(func == 0)
{
if (0 == swd_set_target_state_hw(RESET_PROGRAM)) {
return ERROR_RESET;
}
// Download flash programming algorithm to target and initialise.
if (0 == swd_write_memory(flash_algo.algo_start, (uint8_t *)flash_algo.algo_blob, flash_algo.algo_size)) {
return ERROR_ALGO_DL;
}
}
else
{
if (0 != swd_flash_syscall_exec(&flash_algo.sys_call_s, flash_algo.init, flash_start, 0, func, 0)) {
return ERROR_INIT;
}
}
return ERROR_SUCCESS;
}
error_t target_flash_uninit(uint32_t func)
{
if (0 != swd_flash_syscall_exec(&flash_algo.sys_call_s, flash_algo.init, func, 0, 0, 0)) {
return ERROR_UNINIT;
}
return ERROR_SUCCESS;
}
error_t target_flash_program_page(uint32_t addr, const uint8_t *buf, uint32_t size)
{
while (size > 0) {
uint32_t write_size = size > flash_algo.program_buffer_size ? flash_algo.program_buffer_size : size;
// Write page to buffer
if (!swd_write_memory(flash_algo.program_buffer, (uint8_t *)buf, write_size)) {
return ERROR_ALGO_DATA_SEQ;
}
// Run flash programming
if (swd_flash_syscall_exec(&flash_algo.sys_call_s,
flash_algo.program_page,
addr,
flash_algo.program_buffer_size,
flash_algo.program_buffer,
0)) {
return ERROR_WRITE;
}
addr += write_size;
buf += write_size;
size -= write_size;
}
return ERROR_SUCCESS;
}
error_t target_flash_erase_sector(uint32_t addr)
{
if (0 != swd_flash_syscall_exec(&flash_algo.sys_call_s, flash_algo.erase_sector, addr, 0, 0, 0)) {
return ERROR_ERASE_SECTOR;
}
return ERROR_SUCCESS;
}
error_t target_flash_erase_chip(void)
{
error_t status = ERROR_SUCCESS;
if (0 != swd_flash_syscall_exec(&flash_algo.sys_call_s, flash_algo.erase_chip, 0, 0, 0, 0)) {
return ERROR_ERASE_ALL;
}
return status;
}

@ -1,38 +0,0 @@
#ifndef __SWD_FLASH_H__
#define __SWD_FLASH_H__
#include <stdint.h>
typedef enum {
/* Shared errors */
ERROR_SUCCESS = 0,
ERROR_FAILURE,
ERROR_INTERNAL,
/* Target flash errors */
ERROR_RESET,
ERROR_ALGO_DL,
ERROR_ALGO_DATA_SEQ,
ERROR_INIT,
ERROR_UNINIT,
ERROR_SECURITY_BITS,
ERROR_UNLOCK,
ERROR_ERASE_SECTOR,
ERROR_ERASE_ALL,
ERROR_WRITE,
// Add new values here
ERROR_COUNT
} error_t;
error_t target_flash_init(uint32_t flash_start, uint32_t func);
error_t target_flash_uninit(uint32_t func);
error_t target_flash_program_page(uint32_t addr, const uint8_t *buf, uint32_t size);
error_t target_flash_erase_sector(uint32_t addr);
error_t target_flash_erase_chip(void);
#endif // __SWD_FLASH_H__

File diff suppressed because it is too large Load Diff

@ -1,39 +0,0 @@
#ifndef SWDHOST_CM_H
#define SWDHOST_CM_H
#include <stdint.h>
#include "flash_blob.h"
typedef enum {
RESET_HOLD, // Hold target in reset
RESET_PROGRAM, // Reset target and setup for flash programming.
RESET_RUN, // Reset target and run normally
NO_DEBUG, // Disable debug on running target
DEBUG, // Enable debug on running target
HALT, // Halt the target without resetting it
RUN // Resume the target without resetting it
} TARGET_RESET_STATE;
uint8_t swd_init(void);
uint8_t swd_off(void);
uint8_t swd_init_debug(void);
uint8_t swd_read_dp(uint8_t adr, uint32_t *val);
uint8_t swd_write_dp(uint8_t adr, uint32_t val);
uint8_t swd_read_ap(uint32_t adr, uint32_t *val);
uint8_t swd_write_ap(uint32_t adr, uint32_t val);
uint8_t swd_read_memory(uint32_t address, uint8_t *data, uint32_t size);
uint8_t swd_write_memory(uint32_t address, uint8_t *data, uint32_t size);
uint8_t swd_flash_syscall_exec(const program_syscall_t *sysCallParam, uint32_t entry, uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t arg4);
void swd_set_target_reset(uint8_t asserted);
uint8_t swd_set_target_state_hw(TARGET_RESET_STATE state);
uint8_t swd_set_target_state_sw(TARGET_RESET_STATE state);
uint8_t swd_read_word(uint32_t addr, uint32_t *val);
uint8_t swd_write_word(uint32_t addr, uint32_t val);
#endif

@ -1,147 +0,0 @@
/**
* @file debug_ca.h
* @brief Access to ARM DAP (Cortex-A) using CMSIS-DAP protocol
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEBUG_CA_H
#define DEBUG_CA_H
#include "debug_cm.h"
// Debug registers
#define DEBUG_REGSITER_BASE (0x80030000)
#define DBGDIDR (DEBUG_REGSITER_BASE + (0 * 4)) // Debug ID
#define DBGWFAR (DEBUG_REGSITER_BASE + (6 * 4)) // Watchpoint Fault Address
#define DBGVCR (DEBUG_REGSITER_BASE + (7 * 4)) // Vector Catch
#define DBGECR (DEBUG_REGSITER_BASE + (9 * 4)) // Event Catch
#define DBGDTRRX (DEBUG_REGSITER_BASE + (32 * 4)) // Host to Target Data Transfer
#define DBGITR (DEBUG_REGSITER_BASE + (33 * 4)) // WO Instruction Transfer
#define DBGDSCR (DEBUG_REGSITER_BASE + (34 * 4)) // Debug Status and Control
#define DBGDTRTX (DEBUG_REGSITER_BASE + (35 * 4)) // Target to Host Data Transfer
#define DBGDRCR (DEBUG_REGSITER_BASE + (36 * 4)) // Debug Run Control
#define DBGEACR (DEBUG_REGSITER_BASE + (37 * 4)) // External Auxiliary Control
#define DBGPCSR (DEBUG_REGSITER_BASE + (40 * 4)) // Program Counter Sampling
#define DBGCIDSR (DEBUG_REGSITER_BASE + (41 * 4)) // Context ID Sampling
#define DBGVIDSR (DEBUG_REGSITER_BASE + (42 * 4)) // Virtualization ID Sampling
#define DBGBVR0 (DEBUG_REGSITER_BASE + (64 * 4)) // Breakpoint Value
#define DBGBVR1 (DEBUG_REGSITER_BASE + (65 * 4)) // Breakpoint Value
#define DBGBVR2 (DEBUG_REGSITER_BASE + (66 * 4)) // Breakpoint Value
#define DBGBVR3 (DEBUG_REGSITER_BASE + (67 * 4)) // Breakpoint Value
#define DBGBVR4 (DEBUG_REGSITER_BASE + (68 * 4)) // Breakpoint Value
#define DBGBVR5 (DEBUG_REGSITER_BASE + (69 * 4)) // Breakpoint Value
#define DBGBVR6 (DEBUG_REGSITER_BASE + (70 * 4)) // Breakpoint Value
#define DBGBVR7 (DEBUG_REGSITER_BASE + (71 * 4)) // Breakpoint Value
#define DBGBVR8 (DEBUG_REGSITER_BASE + (72 * 4)) // Breakpoint Value
#define DBGBVR9 (DEBUG_REGSITER_BASE + (73 * 4)) // Breakpoint Value
#define DBGBVR10 (DEBUG_REGSITER_BASE + (74 * 4)) // Breakpoint Value
#define DBGBVR11 (DEBUG_REGSITER_BASE + (75 * 4)) // Breakpoint Value
#define DBGBVR12 (DEBUG_REGSITER_BASE + (76 * 4)) // Breakpoint Value
#define DBGBVR13 (DEBUG_REGSITER_BASE + (77 * 4)) // Breakpoint Value
#define DBGBVR14 (DEBUG_REGSITER_BASE + (78 * 4)) // Breakpoint Value
#define DBGBVR15 (DEBUG_REGSITER_BASE + (79 * 4)) // Breakpoint Value
#define DBGBCR0 (DEBUG_REGSITER_BASE + (80 * 4)) // Breakpoint Control
#define DBGBCR1 (DEBUG_REGSITER_BASE + (81 * 4)) // Breakpoint Control
#define DBGBCR2 (DEBUG_REGSITER_BASE + (82 * 4)) // Breakpoint Control
#define DBGBCR3 (DEBUG_REGSITER_BASE + (83 * 4)) // Breakpoint Control
#define DBGBCR4 (DEBUG_REGSITER_BASE + (84 * 4)) // Breakpoint Control
#define DBGBCR5 (DEBUG_REGSITER_BASE + (85 * 4)) // Breakpoint Control
#define DBGBCR6 (DEBUG_REGSITER_BASE + (86 * 4)) // Breakpoint Control
#define DBGBCR7 (DEBUG_REGSITER_BASE + (87 * 4)) // Breakpoint Control
#define DBGBCR8 (DEBUG_REGSITER_BASE + (88 * 4)) // Breakpoint Control
#define DBGBCR9 (DEBUG_REGSITER_BASE + (89 * 4)) // Breakpoint Control
#define DBGBCR10 (DEBUG_REGSITER_BASE + (90 * 4)) // Breakpoint Control
#define DBGBCR11 (DEBUG_REGSITER_BASE + (91 * 4)) // Breakpoint Control
#define DBGBCR12 (DEBUG_REGSITER_BASE + (92 * 4)) // Breakpoint Control
#define DBGBCR13 (DEBUG_REGSITER_BASE + (93 * 4)) // Breakpoint Control
#define DBGBCR14 (DEBUG_REGSITER_BASE + (94 * 4)) // Breakpoint Control
#define DBGBCR15 (DEBUG_REGSITER_BASE + (95 * 4)) // Breakpoint Control
#define DBGWVR0 (DEBUG_REGSITER_BASE + (96 * 4)) // Watchpoint Value
#define DBGWVR1 (DEBUG_REGSITER_BASE + (97 * 4)) // Watchpoint Value
#define DBGWVR2 (DEBUG_REGSITER_BASE + (98 * 4)) // Watchpoint Value
#define DBGWVR3 (DEBUG_REGSITER_BASE + (99 * 4)) // Watchpoint Value
#define DBGWVR4 (DEBUG_REGSITER_BASE + (100 * 4)) // Watchpoint Value
#define DBGWVR5 (DEBUG_REGSITER_BASE + (101 * 4)) // Watchpoint Value
#define DBGWVR6 (DEBUG_REGSITER_BASE + (102 * 4)) // Watchpoint Value
#define DBGWVR7 (DEBUG_REGSITER_BASE + (103 * 4)) // Watchpoint Value
#define DBGWVR8 (DEBUG_REGSITER_BASE + (104 * 4)) // Watchpoint Value
#define DBGWVR9 (DEBUG_REGSITER_BASE + (105 * 4)) // Watchpoint Value
#define DBGWVR10 (DEBUG_REGSITER_BASE + (106 * 4)) // Watchpoint Value
#define DBGWVR11 (DEBUG_REGSITER_BASE + (107 * 4)) // Watchpoint Value
#define DBGWVR12 (DEBUG_REGSITER_BASE + (108 * 4)) // Watchpoint Value
#define DBGWVR13 (DEBUG_REGSITER_BASE + (109 * 4)) // Watchpoint Value
#define DBGWVR14 (DEBUG_REGSITER_BASE + (110 * 4)) // Watchpoint Value
#define DBGWVR15 (DEBUG_REGSITER_BASE + (111 * 4)) // Watchpoint Value
#define DBGWCR0 (DEBUG_REGSITER_BASE + (112 * 4)) // Watchpoint Control
#define DBGWCR1 (DEBUG_REGSITER_BASE + (113 * 4)) // Watchpoint Control
#define DBGWCR2 (DEBUG_REGSITER_BASE + (114 * 4)) // Watchpoint Control
#define DBGWCR3 (DEBUG_REGSITER_BASE + (115 * 4)) // Watchpoint Control
#define DBGWCR4 (DEBUG_REGSITER_BASE + (116 * 4)) // Watchpoint Control
#define DBGWCR5 (DEBUG_REGSITER_BASE + (117 * 4)) // Watchpoint Control
#define DBGWCR6 (DEBUG_REGSITER_BASE + (118 * 4)) // Watchpoint Control
#define DBGWCR7 (DEBUG_REGSITER_BASE + (119 * 4)) // Watchpoint Control
#define DBGWCR8 (DEBUG_REGSITER_BASE + (120 * 4)) // Watchpoint Control
#define DBGWCR9 (DEBUG_REGSITER_BASE + (121 * 4)) // Watchpoint Control
#define DBGWCR10 (DEBUG_REGSITER_BASE + (122 * 4)) // Watchpoint Control
#define DBGWCR11 (DEBUG_REGSITER_BASE + (123 * 4)) // Watchpoint Control
#define DBGWCR12 (DEBUG_REGSITER_BASE + (124 * 4)) // Watchpoint Control
#define DBGWCR13 (DEBUG_REGSITER_BASE + (125 * 4)) // Watchpoint Control
#define DBGWCR14 (DEBUG_REGSITER_BASE + (126 * 4)) // Watchpoint Control
#define DBGWCR15 (DEBUG_REGSITER_BASE + (127 * 4)) // Watchpoint Control
#define DBGBXVR0 (DEBUG_REGSITER_BASE + (144 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR1 (DEBUG_REGSITER_BASE + (145 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR2 (DEBUG_REGSITER_BASE + (146 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR3 (DEBUG_REGSITER_BASE + (147 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR4 (DEBUG_REGSITER_BASE + (148 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR5 (DEBUG_REGSITER_BASE + (149 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR6 (DEBUG_REGSITER_BASE + (150 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR7 (DEBUG_REGSITER_BASE + (151 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR8 (DEBUG_REGSITER_BASE + (152 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR9 (DEBUG_REGSITER_BASE + (153 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR10 (DEBUG_REGSITER_BASE + (154 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR11 (DEBUG_REGSITER_BASE + (155 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR12 (DEBUG_REGSITER_BASE + (156 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR13 (DEBUG_REGSITER_BASE + (157 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR14 (DEBUG_REGSITER_BASE + (158 * 4)) // Breakpoint Extended Valueb
#define DBGBXVR15 (DEBUG_REGSITER_BASE + (159 * 4)) // Breakpoint Extended Valueb
#define DBGOSLAR (DEBUG_REGSITER_BASE + (192 * 4)) // OS Lock Access
#define DBGOSLSR (DEBUG_REGSITER_BASE + (193 * 4)) // OS Lock Status
#define DBGPRCR (DEBUG_REGSITER_BASE + (196 * 4)) // Powerdown and Reset Control
#define DBGPRSR (DEBUG_REGSITER_BASE + (197 * 4)) // Powerdown and Reset Status
#define DBGITCTRL (DEBUG_REGSITER_BASE + (960 * 4)) // Integration Mode Control
#define DBGCLAIMSET (DEBUG_REGSITER_BASE + (1000 * 4)) // Claim Tag Set
#define DBGCLAIMCLR (DEBUG_REGSITER_BASE + (1001 * 4)) // Claim Tag Clear
#define DBGLAR (DEBUG_REGSITER_BASE + (1004 * 4)) // Lock Access
#define DBGLSR (DEBUG_REGSITER_BASE + (1005 * 4)) // Lock Status
#define DBGAUTHSTATUS (DEBUG_REGSITER_BASE + (1006 * 4)) // Authentication Status
#define DBGDEVID2 (DEBUG_REGSITER_BASE + (1008 * 4)) // Debug Device ID 2
#define DBGDEVID1 (DEBUG_REGSITER_BASE + (1009 * 4)) // Debug Device ID 1
#define DBGDEVID (DEBUG_REGSITER_BASE + (1010 * 4)) // Debug Device ID
#define DBGDEVTYPE (DEBUG_REGSITER_BASE + (1011 * 4)) // Device Type
#define DBGPID0 (DEBUG_REGSITER_BASE + (1012 * 4)) // Debug Peripheral ID
#define DBGPID1 (DEBUG_REGSITER_BASE + (1013 * 4)) // Debug Peripheral ID
#define DBGPID2 (DEBUG_REGSITER_BASE + (1014 * 4)) // Debug Peripheral ID
#define DBGPID3 (DEBUG_REGSITER_BASE + (1015 * 4)) // Debug Peripheral ID
#define DBGPID4 (DEBUG_REGSITER_BASE + (1016 * 4)) // Debug Peripheral ID
#define DBGCID0 (DEBUG_REGSITER_BASE + (1020 * 4)) // Debug Component ID
#define DBGCID1 (DEBUG_REGSITER_BASE + (1021 * 4)) // Debug Component ID
#define DBGCID2 (DEBUG_REGSITER_BASE + (1022 * 4)) // Debug Component ID
#define DBGCID3 (DEBUG_REGSITER_BASE + (1023 * 4)) // Debug Component ID
#endif

@ -1,168 +0,0 @@
/**
* @file debug_cm.h
* @brief Access to ARM DAP (Cortex-M) using CMSIS-DAP protocol
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEBUG_CM_H
#define DEBUG_CM_H
#include "DAP.h"
// SWD register access
#define SWD_REG_AP (1)
#define SWD_REG_DP (0)
#define SWD_REG_R (1<<1)
#define SWD_REG_W (0<<1)
#define SWD_REG_ADR(a) (a & 0x0c)
// Abort Register definitions
#define DAPABORT 0x00000001 // DAP Abort
#define STKCMPCLR 0x00000002 // Clear STICKYCMP Flag (SW Only)
#define STKERRCLR 0x00000004 // Clear STICKYERR Flag (SW Only)
#define WDERRCLR 0x00000008 // Clear WDATAERR Flag (SW Only)
#define ORUNERRCLR 0x00000010 // Clear STICKYORUN Flag (SW Only)
// Debug Control and Status definitions
#define ORUNDETECT 0x00000001 // Overrun Detect
#define STICKYORUN 0x00000002 // Sticky Overrun
#define TRNMODE 0x0000000C // Transfer Mode Mask
#define TRNNORMAL 0x00000000 // Transfer Mode: Normal
#define TRNVERIFY 0x00000004 // Transfer Mode: Pushed Verify
#define TRNCOMPARE 0x00000008 // Transfer Mode: Pushed Compare
#define STICKYCMP 0x00000010 // Sticky Compare
#define STICKYERR 0x00000020 // Sticky Error
#define READOK 0x00000040 // Read OK (SW Only)
#define WDATAERR 0x00000080 // Write Data Error (SW Only)
#define MASKLANE 0x00000F00 // Mask Lane Mask
#define MASKLANE0 0x00000100 // Mask Lane 0
#define MASKLANE1 0x00000200 // Mask Lane 1
#define MASKLANE2 0x00000400 // Mask Lane 2
#define MASKLANE3 0x00000800 // Mask Lane 3
#define TRNCNT 0x001FF000 // Transaction Counter Mask
#define CDBGRSTREQ 0x04000000 // Debug Reset Request
#define CDBGRSTACK 0x08000000 // Debug Reset Acknowledge
#define CDBGPWRUPREQ 0x10000000 // Debug Power-up Request
#define CDBGPWRUPACK 0x20000000 // Debug Power-up Acknowledge
#define CSYSPWRUPREQ 0x40000000 // System Power-up Request
#define CSYSPWRUPACK 0x80000000 // System Power-up Acknowledge
// Debug Select Register definitions
#define CTRLSEL 0x00000001 // CTRLSEL (SW Only)
#define APBANKSEL 0x000000F0 // APBANKSEL Mask
#define APSEL 0xFF000000 // APSEL Mask
// Access Port Register Addresses
#define AP_CSW 0x00 // Control and Status Word
#define AP_TAR 0x04 // Transfer Address
#define AP_DRW 0x0C // Data Read/Write
#define AP_BD0 0x10 // Banked Data 0
#define AP_BD1 0x14 // Banked Data 1
#define AP_BD2 0x18 // Banked Data 2
#define AP_BD3 0x1C // Banked Data 3
#define AP_ROM 0xF8 // Debug ROM Address
#define AP_IDR 0xFC // Identification Register
// AP Control and Status Word definitions
#define CSW_SIZE 0x00000007 // Access Size: Selection Mask
#define CSW_SIZE8 0x00000000 // Access Size: 8-bit
#define CSW_SIZE16 0x00000001 // Access Size: 16-bit
#define CSW_SIZE32 0x00000002 // Access Size: 32-bit
#define CSW_ADDRINC 0x00000030 // Auto Address Increment Mask
#define CSW_NADDRINC 0x00000000 // No Address Increment
#define CSW_SADDRINC 0x00000010 // Single Address Increment
#define CSW_PADDRINC 0x00000020 // Packed Address Increment
#define CSW_DBGSTAT 0x00000040 // Debug Status
#define CSW_TINPROG 0x00000080 // Transfer in progress
#define CSW_HPROT 0x02000000 // User/Privilege Control
#define CSW_MSTRTYPE 0x20000000 // Master Type Mask
#define CSW_MSTRCORE 0x00000000 // Master Type: Core
#define CSW_MSTRDBG 0x20000000 // Master Type: Debug
#define CSW_RESERVED 0x01000000 // Reserved Value
// Core Debug Register Address Offsets
#define DBG_OFS 0x0DF0 // Debug Register Offset inside NVIC
#define DBG_HCSR_OFS 0x00 // Debug Halting Control & Status Register
#define DBG_CRSR_OFS 0x04 // Debug Core Register Selector Register
#define DBG_CRDR_OFS 0x08 // Debug Core Register Data Register
#define DBG_EMCR_OFS 0x0C // Debug Exception & Monitor Control Register
// Core Debug Register Addresses
#define DBG_HCSR (DBG_Addr + DBG_HCSR_OFS)
#define DBG_CRSR (DBG_Addr + DBG_CRSR_OFS)
#define DBG_CRDR (DBG_Addr + DBG_CRDR_OFS)
#define DBG_EMCR (DBG_Addr + DBG_EMCR_OFS)
// Debug Halting Control and Status Register definitions
#define C_DEBUGEN 0x00000001 // Debug Enable
#define C_HALT 0x00000002 // Halt
#define C_STEP 0x00000004 // Step
#define C_MASKINTS 0x00000008 // Mask Interrupts
#define C_SNAPSTALL 0x00000020 // Snap Stall
#define S_REGRDY 0x00010000 // Register R/W Ready Flag
#define S_HALT 0x00020000 // Halt Flag
#define S_SLEEP 0x00040000 // Sleep Flag
#define S_LOCKUP 0x00080000 // Lockup Flag
#define S_RETIRE_ST 0x01000000 // Sticky Retire Flag
#define S_RESET_ST 0x02000000 // Sticky Reset Flag
#define DBGKEY 0xA05F0000 // Debug Key
// Debug Exception and Monitor Control Register definitions
#define VC_CORERESET 0x00000001 // Reset Vector Catch
#define VC_MMERR 0x00000010 // Debug Trap on MMU Fault
#define VC_NOCPERR 0x00000020 // Debug Trap on No Coprocessor Fault
#define VC_CHKERR 0x00000040 // Debug Trap on Checking Error Fault
#define VC_STATERR 0x00000080 // Debug Trap on State Error Fault
#define VC_BUSERR 0x00000100 // Debug Trap on Bus Error Fault
#define VC_INTERR 0x00000200 // Debug Trap on Interrupt Error Fault
#define VC_HARDERR 0x00000400 // Debug Trap on Hard Fault
#define MON_EN 0x00010000 // Monitor Enable
#define MON_PEND 0x00020000 // Monitor Pend
#define MON_STEP 0x00040000 // Monitor Step
#define MON_REQ 0x00080000 // Monitor Request
#define TRCENA 0x01000000 // Trace Enable (DWT, ITM, ETM, TPIU)
// NVIC: Interrupt Controller Type Register
#define NVIC_ICT (NVIC_Addr + 0x0004)
#define INTLINESNUM 0x0000001F // Interrupt Line Numbers
// NVIC: CPUID Base Register
#define NVIC_CPUID (NVIC_Addr + 0x0D00)
#define CPUID_PARTNO 0x0000FFF0 // Part Number Mask
#define CPUID_REVISION 0x0000000F // Revision Mask
#define CPUID_VARIANT 0x00F00000 // Variant Mask
// NVIC: Application Interrupt/Reset Control Register
#define NVIC_AIRCR (NVIC_Addr + 0x0D0C)
#define VECTRESET 0x00000001 // Reset Cortex-M (except Debug)
#define VECTCLRACTIVE 0x00000002 // Clear Active Vector Bit
#define SYSRESETREQ 0x00000004 // Reset System (except Debug)
#define VECTKEY 0x05FA0000 // Write Key
// NVIC: Debug Fault Status Register
#define NVIC_DFSR (NVIC_Addr + 0x0D30)
#define HALTED 0x00000001 // Halt Flag
#define BKPT 0x00000002 // BKPT Flag
#define DWTTRAP 0x00000004 // DWT Match
#define VCATCH 0x00000008 // Vector Catch Flag
#define EXTERNAL 0x00000010 // External Debug Request
// Data Watchpoint and Trace unit
#define DWT_PCSR 0xe000101c // DWT PC Sampling Register
#endif

@ -1,33 +0,0 @@
#ifndef FLASH_BLOB_H
#define FLASH_BLOB_H
#include <stdint.h>
typedef struct {
uint32_t breakpoint;
uint32_t static_base;
uint32_t stack_pointer;
} program_syscall_t;
typedef struct {
const uint32_t init;
const uint32_t uninit;
const uint32_t erase_chip;
const uint32_t erase_sector;
const uint32_t program_page;
const program_syscall_t sys_call_s;
const uint32_t program_buffer;
const uint32_t algo_start;
const uint32_t algo_size;
const uint32_t *algo_blob;
const uint32_t program_buffer_size;
} program_target_t;
typedef struct {
const uint32_t start;
const uint32_t size;
} sector_info_t;
#endif
Loading…
Cancel
Save