yuvadm / tiva-c

Open source toolchain for the TI Tiva C dev board
185 stars 86 forks source link

Not able to use assembly inline functions of usb_stick_updater.c in Keil #8

Closed Naman19 closed 7 years ago

Naman19 commented 7 years ago

I have implemented the usb_stick_updater.c example for tm4c1294kcpdt using Keil. The new application seems to be updated successfully in the flash at another location. But the inline assembly code is not working. __asm void CallApplication(uint_fast32_t ui32StartAddr) { // // Set the vector table address to the beginning of the application. // ldr r1, =0xe000ed08 str r0, [r1]

//
// Load the stack pointer from the application's vector table.
//
ldr     r1, [r0]
mov     sp, r1

//
// Load the initial PC from the application's vector table and branch to
// the application's entry point.
//
ldr     r0, [r0, #4]
bx      r0

}
When CallApplication() is called. It again jumps to this bootloader instead of going to the new application. Does it require to jump to privileged mode before changing values of sp and pc?

Naman19 commented 7 years ago

Hello,

Please ignore the above post as assembly is working now.

Please let me know what should be the changes to be made in the new application as when i call the application from the boot loader, the main of the boot loader code gets called again.

Naman19 commented 7 years ago

The bootloader and the application code have got similar startup files. I am not using any linker script so it seems it has been taking a default script which seems to be the problem.

Naman19 commented 7 years ago

The issue has been resolved, there was issue with the linker file of the application. The start Flash address was set to 0 instead of 0x8000.