K65 KBOOT 1.2.0 write-memory fails

cancel
Showing results for 
Search instead for 
Did you mean: 

K65 KBOOT 1.2.0 write-memory fails

Jump to solution
523 Views
ricado
Contributor I

Hi,

I'm using the KBOOT 1.2.0 in a TWR-K65F180M with USB HID and blhost.exe utility, developing  in KDS 3.0 and tower_bootloader project. I changed the default application address in KBOOT bootloader_config.h BL_APP_VECTOR_TABLE_ADDRESS from 0xA000 to 0xB000 because in order to debug the KBOOT it's size is a little bigger than 0xA000 bytes. When I attempt to load my application to the user flash I receive the error 995. It says that 32 bytes were written in flash but I only see the first 8 bytes when I read back the 0xB000 memory. The first 32 bytes sent are:"F8 FF 02 20 D9 B4 00 00 E9 B4 00 00 E9 B4 00 00 E9 B4 00 00 E9 B4 00 00 E9 B4 00 00 00 00 00 00". The memory is erased (all 0xFFs) before I use the write-memory command.

I include the command line input and output.

>>

C:\K65BL>blhost -u 0x15A2,0x0073 get-property 1

Inject command 'get-property'

Response status = 0 (0x0) Success.

Response word 1 = 1258358017 (0x4b010501)

Current Version = K1.5.1

C:\K65BL>blhost -u 0x15A2,0x0073 read-memory 0xb000 32

Inject command 'read-memory'

Successful response to command 'read-memory'

ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Successful generic response to command 'read-memory'

Response status = 0 (0x0) Success.

Response word 1 = 32 (0x20)

Read 32 of 32 bytes.

C:\K65BL>blhost -u 0x15A2,0x0073 write-memory 0xb000 ./myApp.bin

Inject command 'write-memory'

Preparing to send 65048 (0xfe18) bytes to the target.

Successful generic response to command 'write-memory'

GetOverlappedResult failed with error 995: The I/O operation has been aborted because of either a thread exit or an application request.

Data phase write aborted by status 0x1 Failure.

Response status = 10004 (0x2714) No response packet from target device.

Wrote 32 of 65048 bytes.

C:\K65BL>blhost -u 0x15A2,0x0073 read-memory 0xb000 32

Inject command 'read-memory'

Successful response to command 'read-memory'

f8 ff 02 20 d9 b4 00 00 ff ff ff ff ff ff ff ff

ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

Successful generic response to command 'read-memory'

Response status = 0 (0x0) Success.

Response word 1 = 32 (0x20)

Read 32 of 32 bytes.

<<

Am I missing something in configuration and/or in the blhost commands?

0 Kudos
1 Solution
272 Views
ricado
Contributor I

Update SOLVED!!!!

The problem was that the K65 was reseting when attempting to call function "callFlashRunCommand" which runs from RAM and was previously copied. It seems that the RAM memory allocated to copy the function was smaller than the function's size, the calculation might have been done once the bootloader was fully optimized but I don't think allocating more space does any harm.

So I changed

enum _flash_execute_in_ram_function_constants

{

--     kFlashExecuteInRamFunction_MaxSize   = 32,

++   kFlashExecuteInRamFunction_MaxSize   = 64,

       kFlashExecuteInRamFunction_TotalNum  = 2

};

View solution in original post

0 Kudos
1 Reply
273 Views
ricado
Contributor I

Update SOLVED!!!!

The problem was that the K65 was reseting when attempting to call function "callFlashRunCommand" which runs from RAM and was previously copied. It seems that the RAM memory allocated to copy the function was smaller than the function's size, the calculation might have been done once the bootloader was fully optimized but I don't think allocating more space does any harm.

So I changed

enum _flash_execute_in_ram_function_constants

{

--     kFlashExecuteInRamFunction_MaxSize   = 32,

++   kFlashExecuteInRamFunction_MaxSize   = 64,

       kFlashExecuteInRamFunction_TotalNum  = 2

};

0 Kudos