diff options
Diffstat (limited to 'src/target/etm.c')
-rw-r--r-- | src/target/etm.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/target/etm.c b/src/target/etm.c index 3850ced5..4f4bf9a4 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -514,15 +514,17 @@ static int etm_read_reg_w_check(struct reg *reg, fields[0].check_mask = NULL; fields[1].num_bits = 7; - fields[1].out_value = malloc(1); - buf_set_u32(fields[1].out_value, 0, 7, reg_addr); + uint8_t temp1; + fields[1].out_value = &temp1; + buf_set_u32(&temp1, 0, 7, reg_addr); fields[1].in_value = NULL; fields[1].check_value = NULL; fields[1].check_mask = NULL; fields[2].num_bits = 1; - fields[2].out_value = malloc(1); - buf_set_u32(fields[2].out_value, 0, 1, 0); + uint8_t temp2; + fields[2].out_value = &temp2; + buf_set_u32(&temp2, 0, 1, 0); fields[2].in_value = NULL; fields[2].check_value = NULL; fields[2].check_mask = NULL; @@ -535,9 +537,6 @@ static int etm_read_reg_w_check(struct reg *reg, jtag_add_dr_scan_check(etm_reg->jtag_info->tap, 3, fields, TAP_IDLE); - free(fields[1].out_value); - free(fields[2].out_value); - return ERROR_OK; } @@ -592,19 +591,19 @@ static int etm_write_reg(struct reg *reg, uint32_t value) fields[0].num_bits = 32; uint8_t tmp1[4]; fields[0].out_value = tmp1; - buf_set_u32(fields[0].out_value, 0, 32, value); + buf_set_u32(tmp1, 0, 32, value); fields[0].in_value = NULL; fields[1].num_bits = 7; uint8_t tmp2; fields[1].out_value = &tmp2; - buf_set_u32(fields[1].out_value, 0, 7, reg_addr); + buf_set_u32(&tmp2, 0, 7, reg_addr); fields[1].in_value = NULL; fields[2].num_bits = 1; uint8_t tmp3; fields[2].out_value = &tmp3; - buf_set_u32(fields[2].out_value, 0, 1, 1); + buf_set_u32(&tmp3, 0, 1, 1); fields[2].in_value = NULL; jtag_add_dr_scan(etm_reg->jtag_info->tap, 3, fields, TAP_IDLE); |