/* Erase an area on a Flash logical partition */
int32_t hal_flash_erase(hal_partition_t in_partition, uint32_t off_set, uint32_t size)
/* Erase an area on a Flash logical partition */
int32_t hal_flash_erase(hal_partition_t in_partition, uint32_t off_set, uint32_t size)
{
    uint32_t start_addr;
    hal_logic_partition_t info;
    hal_partition_t operate_partition_id = 0;
    int32_t ret = 0;
    watchdog_feeddog();
    ENTER_FUNCTION();
    if (hal_flash_info_get(in_partition, &info) != 0) {
        TRACEME("hal_flash_info_get fail\n");
        ret = -1;
        goto RETURN;
    }
    start_addr = info.partition_start_addr + off_set;
    operate_partition_id = bes_get_operate_partition(in_partition);
    TRACEME("hal_flash_erase part start0x%x offset 0x%x  size 0x%x\n", info.partition_start_addr, off_set, size);
    ret = bes_hal_flash_erase(operate_partition_id, start_addr, size);
RETURN:
    LEAVE_FUNCTION();
    return ret;
}