add probe for ch32 + make room for other clones
This commit is contained in:
parent
be83c2861e
commit
90d15e6633
|
@ -55,6 +55,9 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PROBE(x) \
|
||||||
|
do { if ((x)(t)) {return true;} else target_check_error(t); } while (0)
|
||||||
|
|
||||||
static const char cortexm_driver_str[] = "ARM Cortex-M";
|
static const char cortexm_driver_str[] = "ARM Cortex-M";
|
||||||
|
|
||||||
static bool cortexm_vector_catch(target *t, int argc, char *argv[]);
|
static bool cortexm_vector_catch(target *t, int argc, char *argv[]);
|
||||||
|
@ -209,6 +212,17 @@ static const char tdesc_cortex_mf[] =
|
||||||
" </feature>"
|
" </feature>"
|
||||||
"</target>";
|
"</target>";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Probe STM32F103 clones
|
||||||
|
*/
|
||||||
|
static bool stm32f1_clones_probe(target *t)
|
||||||
|
{
|
||||||
|
PROBE(ch32f1_probe);
|
||||||
|
PROBE(stm32f1_probe); /* Care for other STM32F1 clones (?) */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ADIv5_AP_t *cortexm_ap(target *t)
|
ADIv5_AP_t *cortexm_ap(target *t)
|
||||||
{
|
{
|
||||||
return ((struct cortexm_priv *)t->priv)->ap;
|
return ((struct cortexm_priv *)t->priv)->ap;
|
||||||
|
@ -378,8 +392,6 @@ bool cortexm_probe(ADIv5_AP_t *ap)
|
||||||
} else {
|
} else {
|
||||||
target_check_error(t);
|
target_check_error(t);
|
||||||
}
|
}
|
||||||
#define PROBE(x) \
|
|
||||||
do { if ((x)(t)) {return true;} else target_check_error(t); } while (0)
|
|
||||||
|
|
||||||
switch (ap->ap_designer) {
|
switch (ap->ap_designer) {
|
||||||
case AP_DESIGNER_FREESCALE:
|
case AP_DESIGNER_FREESCALE:
|
||||||
|
@ -442,7 +454,7 @@ bool cortexm_probe(ADIv5_AP_t *ap)
|
||||||
PROBE(rp_probe);
|
PROBE(rp_probe);
|
||||||
PROBE(lpc11xx_probe); /* LPC8 */
|
PROBE(lpc11xx_probe); /* LPC8 */
|
||||||
} else if (ap->ap_partno == 0x4c3) { /* Cortex-M3 ROM */
|
} else if (ap->ap_partno == 0x4c3) { /* Cortex-M3 ROM */
|
||||||
PROBE(stm32f1_probe); /* Care for STM32F1 clones */
|
PROBE(stm32f1_clones_probe); /* Care for STM32F1 clones */
|
||||||
PROBE(lpc15xx_probe); /* Thanks to JojoS for testing */
|
PROBE(lpc15xx_probe); /* Thanks to JojoS for testing */
|
||||||
} else if (ap->ap_partno == 0x471) { /* Cortex-M0 ROM */
|
} else if (ap->ap_partno == 0x471) { /* Cortex-M0 ROM */
|
||||||
PROBE(lpc11xx_probe); /* LPC24C11 */
|
PROBE(lpc11xx_probe); /* LPC24C11 */
|
||||||
|
|
|
@ -97,7 +97,9 @@ static int stm32f1_flash_write(struct target_flash *f,
|
||||||
|
|
||||||
#define FLASHSIZE 0x1FFFF7E0
|
#define FLASHSIZE 0x1FFFF7E0
|
||||||
#define FLASHSIZE_F0 0x1FFFF7CC
|
#define FLASHSIZE_F0 0x1FFFF7CC
|
||||||
|
//
|
||||||
|
#include "stm32f1_ch32.c"
|
||||||
|
//
|
||||||
static void stm32f1_add_flash(target *t,
|
static void stm32f1_add_flash(target *t,
|
||||||
uint32_t addr, size_t length, size_t erasesize)
|
uint32_t addr, size_t length, size_t erasesize)
|
||||||
{
|
{
|
||||||
|
|
|
@ -173,6 +173,7 @@ int tc_system(target *t, target_addr cmd, size_t cmdlen);
|
||||||
/* Probe for various targets.
|
/* Probe for various targets.
|
||||||
* Actual functions implemented in their respective drivers.
|
* Actual functions implemented in their respective drivers.
|
||||||
*/
|
*/
|
||||||
|
bool ch32f1_probe(target *t); // will catch all the clones
|
||||||
bool gd32f1_probe(target *t);
|
bool gd32f1_probe(target *t);
|
||||||
bool stm32f1_probe(target *t);
|
bool stm32f1_probe(target *t);
|
||||||
bool stm32f4_probe(target *t);
|
bool stm32f4_probe(target *t);
|
||||||
|
|
Loading…
Reference in New Issue