Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add software auto reset to Atmel and stm32 #794

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions source/hic_hal/atmel/sam3u2c/DAP_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,22 @@ __STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit)
}
}
#else
__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit)
extern uint8_t swd_init_debug(void);
extern uint8_t swd_write_memory(uint32_t address, uint8_t *data, uint32_t size);
__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit)
{
if (bit & 1) {
PIN_nRESET_PORT->PIO_SODR = PIN_nRESET;

} else {
PIN_nRESET_PORT->PIO_CODR = PIN_nRESET;
}
if (bit & 1)
{
PIN_nRESET_PORT->PIO_SODR = PIN_nRESET;
}
else
{
PIN_nRESET_PORT->PIO_CODR = PIN_nRESET;

swd_init_debug();
uint32_t swd_mem_write_data = 0x05FA0000 | 0x4;
swd_write_memory(0xE000ED0C, (uint8_t *)&swd_mem_write_data, 4);
}
}
#endif
///@}
Expand Down
13 changes: 9 additions & 4 deletions source/hic_hal/stm32/stm32f103xb/DAP_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,20 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN(void)
- 1: release device hardware reset.
*/
// TODO - sw specific implementation should be created

__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit)
extern uint8_t swd_init_debug(void);
extern uint8_t swd_write_memory(uint32_t address, uint8_t *data, uint32_t size);
__STATIC_FORCEINLINE void PIN_nRESET_OUT(uint32_t bit)
{
if (bit & 1)
if (bit & 1)
nRESET_PIN_PORT->BSRR = nRESET_PIN;
else
nRESET_PIN_PORT->BRR = nRESET_PIN;
}

swd_init_debug();
uint32_t swd_mem_write_data = 0x05FA0000 | 0x4;
swd_write_memory(0xE000ED0C, (uint8_t *)&swd_mem_write_data, 4);
}
}
//**************************************************************************************************
/**
\defgroup DAP_Config_LEDs_gr CMSIS-DAP Hardware Status LEDs
Expand Down