debug read cp15 need speed up

this line will always repeat get same value, need speed up

retval = armv7a->post_debug_entry(target);

////////////////////////////////////////////////////////////////////////////////////////////////

//read cp15 control register once only for speed up

gedit /root/openocd-0.9.0/src/target/cortex_a.h

in struct cortex_a_common

after code

uint32_t didr;

add new

int first_read_cp15;

gedit /root/openocd-0.9.0/src/target/cortex_a.c

in function cortex_a_debug_entry(struct target *target)

if (armv7a->post_debug_entry)

{

retval = armv7a->post_debug_entry(target);

if (retval != ERROR_OK)

return retval;

}

//change to

if (armv7a->post_debug_entry && cortex_a->first_read_cp15)

{

cortex_a->first_read_cp15 = false;

retval = armv7a->post_debug_entry(target);

if (retval != ERROR_OK)

return retval;

}

in function cortex_a_target_create(struct target *target, Jim_Interp *interp)

after code

cortex_a->armv7a_common.is_armv7r = false;

add new

cortex_a->first_read_cp15 = true;

new connection re read cp15 otherwise no need

in cortex_a_post_debug_entry add

//follow mmu, 0-AHB 1-APB

armv7a->memory_ap = armv7a->armv7a_mmu.mmu_enabled;

////////////////////////

in static int cortex_a_debug_entry(struct target *target)

change to

if (armv7a->post_debug_entry && target->cp15_switch )

{

target->cp15_switch = false;

retval = armv7a->post_debug_entry(target);

if (retval != ERROR_OK)

return retval;

}

////

in static int gdb_new_connection(struct connection *connection)

add

//by stone, new connect cp15 read

gdb_service->target->cp15_switch = true;

target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_ATTACH);

///////////

in struct target

add

bool cp15_switch; //by stone

each connection happen will detect cp15 work state