File tree Expand file tree Collapse file tree 4 files changed +44
-4
lines changed Expand file tree Collapse file tree 4 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -448,7 +448,7 @@ static int xtensa_read_memory(struct target *target,
448
448
int res ;
449
449
uint8_t * albuff ;
450
450
451
- if (esp108_get_addr_type (address ) == INVALID ) {
451
+ if (esp108_get_addr_type (address ) == INVALID && ! esp108_permissive_mode ) {
452
452
LOG_DEBUG ("%s: address 0x%08x not readable" , __func__ , address );
453
453
return ERROR_FAIL ;
454
454
}
@@ -522,7 +522,7 @@ static int xtensa_write_memory(struct target *target,
522
522
int res ;
523
523
uint8_t * albuff ;
524
524
525
- if (esp108_get_addr_type (address ) != READWRITE ) {
525
+ if (esp108_get_addr_type (address ) != READWRITE && ! esp108_permissive_mode ) {
526
526
LOG_DEBUG ("%s: address 0x%08x not writable" , __func__ , address );
527
527
return ERROR_FAIL ;
528
528
}
@@ -1449,6 +1449,8 @@ static const struct command_registration esp108_any_command_handlers[] = {
1449
1449
COMMAND_REGISTRATION_DONE
1450
1450
};
1451
1451
1452
+ extern const struct command_registration esp108_common_command_handlers [];
1453
+
1452
1454
static const struct command_registration esp108_command_handlers [] = {
1453
1455
{
1454
1456
.name = "esp108" ,
@@ -1457,6 +1459,9 @@ static const struct command_registration esp108_command_handlers[] = {
1457
1459
.usage = "" ,
1458
1460
.chain = esp108_any_command_handlers ,
1459
1461
},
1462
+ {
1463
+ .chain = esp108_common_command_handlers ,
1464
+ },
1460
1465
COMMAND_REGISTRATION_DONE
1461
1466
};
1462
1467
Original file line number Diff line number Diff line change 25
25
#include "esp108_common.h"
26
26
#include "esp108_dbg_regs.h"
27
27
28
+ bool esp108_permissive_mode ;
29
+
28
30
//Convert a register index that's indexed relative to windowbase, to the real address.
29
31
enum xtensa_reg_idx windowbase_offset_to_canonical (const enum xtensa_reg_idx reg , const int windowbase )
30
32
{
@@ -677,3 +679,30 @@ inline uint32_t intfromchars(uint8_t *c)
677
679
{
678
680
return c [0 ] + (c [1 ] << 8 ) + (c [2 ] << 16 ) + (c [3 ] << 24 );
679
681
}
682
+
683
+
684
+ COMMAND_HANDLER (handle_set_esp108_permissive_mode )
685
+ {
686
+ if (CMD_ARGC != 1 ) {
687
+ return ERROR_COMMAND_SYNTAX_ERROR ;
688
+ }
689
+ bool is_one = strcmp (CMD_ARGV [0 ], "1" ) == 0 ;
690
+ if (!is_one && strcmp (CMD_ARGV [0 ], "0" ) != 0 ) {
691
+ return ERROR_COMMAND_SYNTAX_ERROR ; // 0 or 1 only
692
+ }
693
+ esp108_permissive_mode = is_one ;
694
+ return ERROR_OK ;
695
+ }
696
+
697
+ const struct command_registration esp108_common_command_handlers [] = {
698
+ {
699
+ .name = "set_permissive" ,
700
+ .handler = handle_set_esp108_permissive_mode ,
701
+ .mode = COMMAND_ANY ,
702
+ .help = "When set to 1, enable ESP108 permissive mode (less client-side checks)" ,
703
+ .usage = "[0|1]" ,
704
+ },
705
+ COMMAND_REGISTRATION_DONE
706
+ };
707
+
708
+
Original file line number Diff line number Diff line change 44
44
#include "breakpoints.h"
45
45
#include "algorithm.h"
46
46
47
+ extern bool esp108_permissive_mode ;
47
48
48
49
#define XT_INS_NUM_BITS 24
49
50
#define XT_DEBUGLEVEL 6 /* XCHAL_DEBUGLEVEL in xtensa-config.h */
Original file line number Diff line number Diff line change @@ -552,7 +552,7 @@ static int xtensa_read_memory(struct target *target,
552
552
int res ;
553
553
uint8_t * albuff ;
554
554
555
- if (esp108_get_addr_type (address ) == INVALID ) {
555
+ if (esp108_get_addr_type (address ) == INVALID && ! esp108_permissive_mode ) {
556
556
LOG_DEBUG ("%s: address 0x%08x not readable" , __func__ , address );
557
557
return ERROR_FAIL ;
558
558
}
@@ -635,7 +635,7 @@ static int xtensa_write_memory(struct target *target,
635
635
int res ;
636
636
uint8_t * albuff ;
637
637
638
- if (esp108_get_addr_type (address ) != READWRITE ) {
638
+ if (esp108_get_addr_type (address ) != READWRITE && ! esp108_permissive_mode ) {
639
639
LOG_DEBUG ("%s: address 0x%08x not writable" , __func__ , address );
640
640
return ERROR_FAIL ;
641
641
}
@@ -1853,6 +1853,8 @@ static const struct command_registration esp32_any_command_handlers[] = {
1853
1853
COMMAND_REGISTRATION_DONE
1854
1854
};
1855
1855
1856
+ extern const struct command_registration esp108_common_command_handlers [];
1857
+
1856
1858
static const struct command_registration esp32_command_handlers [] = {
1857
1859
{
1858
1860
.name = "esp32" ,
@@ -1861,6 +1863,9 @@ static const struct command_registration esp32_command_handlers[] = {
1861
1863
.usage = "" ,
1862
1864
.chain = esp32_any_command_handlers ,
1863
1865
},
1866
+ {
1867
+ .chain = esp108_common_command_handlers ,
1868
+ },
1864
1869
COMMAND_REGISTRATION_DONE
1865
1870
};
1866
1871
You can’t perform that action at this time.
0 commit comments