[PATCH]: 8002229 arm_adi_v5: Added Cortex-A76 identifiers

2021-07-07 Thread gerrit
This is an automated email from Gerrit.

Florian Fainelli (f.faine...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6358

-- gerrit

commit 80022297a64ca91fe50ec51105c62e9c34bac8e9
Author: Florian Fainelli 
Date:   Tue Jul 6 11:21:54 2021 -0700

arm_adi_v5: Added Cortex-A76 identifiers

Add identifiers of the Cortex-A76 ROM and debug unit.

Change-Id: Ieef0d990189d3c0502e8d530874dc9cbca4417d8
Signed-off-by: Florian Fainelli 

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 65ac053..fee3ecc 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1138,6 +1138,7 @@ static const struct {
{ ARM_ID, 0x4c7, "Cortex-M7 PPB ROM",  "(Private Peripheral Bus 
ROM Table)", },
{ ARM_ID, 0x4c8, "Cortex-M7 ROM",  "(ROM Table)", },
{ ARM_ID, 0x4e0, "Cortex-A35 ROM", "(v7 Memory Map ROM 
Table)", },
+   { ARM_ID, 0x4e4, "Cortex-A76 ROM", "(ROM Table)", },
{ ARM_ID, 0x906, "CoreSight CTI",  "(Cross Trigger)", },
{ ARM_ID, 0x907, "CoreSight ETB",  "(Trace Buffer)", },
{ ARM_ID, 0x908, "CoreSight CSTF", "(Trace Funnel)", },
@@ -1194,6 +1195,7 @@ static const struct {
{ ARM_ID, 0xd04, "Cortex-A35 Debug",   "(Debug Unit)", },
{ ARM_ID, 0xd07, "Cortex-A57 Debug",   "(Debug Unit)", },
{ ARM_ID, 0xd08, "Cortex-A72 Debug",   "(Debug Unit)", },
+   { ARM_ID, 0xd0b, "Cortex-A76 Debug",   "(Debug Unit)", },
{ 0x097,  0x9af, "MSP432 ROM", "(ROM Table)" },
{ 0x09f,  0xcd0, "Atmel CPU with DSU", "(CPU)" },
{ 0x0c1,  0x1db, "XMC4500 ROM","(ROM Table)" },

-- 



[PATCH]: a00f4a1 arm_adi_v5: Recurse looking up a CS if we have a nested ROM

2021-07-07 Thread gerrit
This is an automated email from Gerrit.

Florian Fainelli (f.faine...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6360

-- gerrit

commit a00f4a1449c3fc98384d1102db1dbbeccb7e3a90
Author: Florian Fainelli 
Date:   Tue Jul 6 20:32:08 2021 -0700

arm_adi_v5: Recurse looking up a CS if we have a nested ROM

Similar to the previous commit which fixed the "dap info" displaying of
nested ROMs, when we encounter a device type of 0 in the Class 9 ROMs,
we need to continue and recurse until we can look up the desired DAP CS
with the expected type (0x15).

Towards that goal, move the reading of the device type a bit earlier so
we can key both the class type (1 or 9) and the device type to trigger a
nested ROM parsing if needed.

This fixes the inability to debug, e.g.: Cortex-A76 CPUs since we were
not able to look up the CPU CS before.

Change-Id: I8efacf8b776d276e39cdbfaa64d66cf8d02aca05
Signed-off-by: Florian Fainelli 

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index f0412c4..3cefc5d 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -990,13 +990,21 @@ int dap_lookup_cs_component(struct adiv5_ap *ap,
 
if (romentry & 0x1) {
uint32_t c_cid1;
+   uint8_t class;
retval = mem_ap_read_atomic_u32(ap, component_base | 
0xff4, _cid1);
if (retval != ERROR_OK) {
LOG_ERROR("Can't read component with base 
address " TARGET_ADDR_FMT
  ", the corresponding core might be 
turned off", component_base);
return retval;
}
-   if (((c_cid1 >> 4) & 0x0f) == 1) {
+
+   retval = mem_ap_read_atomic_u32(ap, component_base | 
0xfcc, );
+   if (retval != ERROR_OK)
+   return retval;
+
+   class = (c_cid1 >> 4) & 0x0f;
+   /* Parse class 0x1 ROM or class 0x9 ROM with devtype = 
0 */
+   if (class == 1 || (class == 9 && devtype == 0)) {
retval = dap_lookup_cs_component(ap, 
component_base,
type, addr, idx);
if (retval == ERROR_OK)
@@ -1005,9 +1013,6 @@ int dap_lookup_cs_component(struct adiv5_ap *ap,
return retval;
}
 
-   retval = mem_ap_read_atomic_u32(ap, component_base | 
0xfcc, );
-   if (retval != ERROR_OK)
-   return retval;
if ((devtype & 0xff) == type) {
if (!*idx) {
*addr = component_base;

-- 



[PATCH]: 3ca2e9b arm_adi_v5: Support parsing nested ROM tables

2021-07-07 Thread gerrit
This is an automated email from Gerrit.

Florian Fainelli (f.faine...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6359

-- gerrit

commit 3ca2e9bb062a4e2d3e2c325caf8579c9b02a93b7
Author: Florian Fainelli 
Date:   Tue Jul 6 20:19:28 2021 -0700

arm_adi_v5: Support parsing nested ROM tables

ADI v5.1 and v6.0 permit the definition of CoreSight components (class 9
ROM entries) with a device type value of 0 which is to be scanned as a
nested ROM table. Class 9 (CoreSight) components can only have up to
512 ROM table entries and the present indicator is with the value 0b11.

dap_rom_display() is refactored a bit such that we always end up with
attempting to parse the ROM contents using the appropriate upper limit
for class 1 and 9 ROM types.

Change-Id: I4ba497b3807f1f11f06186eb6e61959ea3540c59
Signed-off-by: Florian Fainelli 

diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index fee3ecc..f0412c4 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1216,6 +1216,8 @@ static const struct {
 static int dap_rom_display(struct command_invocation *cmd,
struct adiv5_ap *ap, target_addr_t dbgbase, int 
depth)
 {
+   uint32_t entry_present_mask = 0;
+   uint16_t rom_num_entries = 0;
int retval;
uint64_t pid;
uint32_t cid;
@@ -1297,26 +1299,8 @@ static int dap_rom_display(struct command_invocation 
*cmd,
else
command_print(cmd, "\t\tMEMTYPE system memory not 
present: dedicated debug bus");
 
-   /* Read ROM table entries from base address until we get 
0x or reach the reserved area */
-   for (uint16_t entry_offset = 0; entry_offset < 0xF00; 
entry_offset += 4) {
-   uint32_t romentry;
-   retval = mem_ap_read_atomic_u32(ap, base_addr | 
entry_offset, );
-   if (retval != ERROR_OK)
-   return retval;
-   command_print(cmd, "\t%sROMTABLE[0x%x] = 0x%" PRIx32 "",
-   tabs, entry_offset, romentry);
-   if (romentry & 0x01) {
-   /* Recurse */
-   retval = dap_rom_display(cmd, ap, base_addr + 
(romentry & 0xF000), depth + 1);
-   if (retval != ERROR_OK)
-   return retval;
-   } else if (romentry != 0) {
-   command_print(cmd, "\t\tComponent not present");
-   } else {
-   command_print(cmd, "\t%s\tEnd of ROM table", 
tabs);
-   break;
-   }
-   }
+   rom_num_entries = 960;
+   entry_present_mask = 0x1;
} else if (class == 9) { /* CoreSight component */
const char *major = "Reserved", *subtype = "Reserved";
 
@@ -1462,6 +1446,36 @@ static int dap_rom_display(struct command_invocation 
*cmd,
(uint8_t)(devtype & 0xff),
major, subtype);
/* REVISIT also show 0xfc8 DevId */
+
+   /* Components with a DEVTYPE of 0 can be nested ROMs, fall
+* through to parsing those.
+*/
+   if (devtype != 0)
+   return ERROR_OK;
+
+   rom_num_entries = 512;
+   entry_present_mask = 0x3;
+   }
+
+   /* Read ROM table entries from base address until we get 0x or 
reach the reserved area */
+   for (uint16_t entry_offset = 0; entry_offset < rom_num_entries; 
entry_offset += 4) {
+   uint32_t romentry;
+   retval = mem_ap_read_atomic_u32(ap, base_addr | entry_offset, 
);
+   if (retval != ERROR_OK)
+   return retval;
+   command_print(cmd, "\t%sROMTABLE[0x%x] = 0x%" PRIx32 "",
+   tabs, entry_offset, romentry);
+   if (romentry & entry_present_mask) {
+   /* Recurse */
+   retval = dap_rom_display(cmd, ap, base_addr + (romentry 
& 0xF000), depth + 1);
+   if (retval != ERROR_OK)
+   return retval;
+   } else if (romentry != 0) {
+   command_print(cmd, "\t\tComponent not present");
+   } else {
+   command_print(cmd, "\t%s\tEnd of ROM table", tabs);
+   break;
+   }
}
 
return ERROR_OK;

-- 



[openocd:tickets] #309 openocd src/svf/svf.c:663:7: error: this statement may fall through [-Werror=implicit-fallthrough=]

2021-07-07 Thread Antonio Borneo
- **status**: new --> closed
- **assigned_to**: Antonio Borneo
- **Resolution**:  --> none
- **Comment**:

Thanks for your reply.
I'm closing this ticket



---

** [tickets:#309] openocd  src/svf/svf.c:663:7: error: this statement may fall 
through [-Werror=implicit-fallthrough=]**

**Status:** closed
**Milestone:** 0.10.0
**Created:** Sat Jun 19, 2021 06:34 PM UTC by Bruno Pimenta de Oliveira
**Last Updated:** Wed Jul 07, 2021 12:50 AM UTC
**Owner:** Antonio Borneo
**Attachments:**

- [Sem 
título1.png](https://sourceforge.net/p/openocd/tickets/309/attachment/Sem%20t%C3%ADtulo1.png)
 (159.2 kB; image/png)


I'm trying to reprogram my hoverboard which has the AT32f403 and using st link 
with openocd and ubuntu. I started to do the steps presented in the video: 
https://www.youtube.com/watch?v=l0KIMjl1BoU=252s

After the make install in the openocd I got so many errors below, anyone knows 
what to do to?

rc/svf/svf.c: In function ‘svf_read_command_from_file’:
src/svf/svf.c:663:7: error: this statement may fall through
[-Werror=implicit-fallthrough=]
 i = -1;
 ~~^~~~
src/svf/svf.c:664:4: note: here
case '\r':
^~~~
src/svf/svf.c:667:8: error: this statement may fall through
[-Werror=implicit-fallthrough=]
 if (!cmd_pos)
^
src/svf/svf.c:669:4: note: here
default:
^~~

Regards,

Bruno Oliveira


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.

[openocd:tickets] Re: #310 at32f403

2021-07-07 Thread Paul Fertser
Hello,

On Wed, Jul 07, 2021 at 12:53:20AM -, Bruno Pimenta de Oliveira wrote:
> I'm trying to reprogram my board which has at32f403 chip but after install
> openocd and st link it does't recognize the board.

Do you think it's an OpenOCD bug? For support requests please use the
mailing list or IRC.

I also do not see any log attached, so "doesn't recognise" is too
vague to suggest anything.

> I'm following the steps of the github below, and also add some code in the
> src/flash/nor/stm32f1x.c
> with:
> 
> case 0x242: / AT32F403 /
> page_size = 2048;
> stm32x_info->ppage_size = 2;
> max_flash_size_in_kb = 512;
> break;

If this is known to work why not send as a patch upstream so that it
can be included in all future versions?

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercer...@gmail.com


---

** [tickets:#310] at32f403**

**Status:** new
**Milestone:** 0.10.0
**Created:** Wed Jul 07, 2021 12:53 AM UTC by Bruno Pimenta de Oliveira
**Last Updated:** Wed Jul 07, 2021 12:53 AM UTC
**Owner:** nobody


Hello everyone,
I'm trying to reprogram my board which has at32f403 chip but after install 
openocd and st link it does't recognize the board.
I'm following the steps of the github below, and also add some code in the 
src/flash/nor/stm32f1x.c
with:

case 0x242: /* AT32F403 */
page_size = 2048;
stm32x_info->ppage_size = 2;
max_flash_size_in_kb = 512;
break;
   

https://github.com/cloidnerux/hoverboard-firmware-hack


anyone can help me undestard the steps?


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.