Is there any documentation on managing the file startup_MKL17Z4.S? I am using a KL17 but I use Linux command line tools (I am not using KDS) so when I need to add IRQ's and configure C callbacks, I need to modify the file startup_MKL17Z4.S manually. It would help if I better understood startup_MKL17Z4.S so I am looking for documentation etc..
Thanks,
Doug
I have a few questions. I have some experience with assembly but not so much with this CPU so maybe that's why I have questions.
1) Where is the default IRQ handler if there is no callback function defined? I assume there is just a spin loop some place that all the undefined IRQ callbacks are pointed to by default. I assume this is where it's configured but I don't know where the actual handler is.
DefaultISR:
ldr r0, =DefaultISR
bx r0
.size DefaultISR, . - DefaultISR
2) Are the following just typedefs (these are from the end of the file)?
def_irq_handler DMA0_DriverIRQHandler
def_irq_handler DMA1_DriverIRQHandler
def_irq_handler DMA2_DriverIRQHandler
def_irq_handler DMA3_DriverIRQHandler
def_irq_handler Reserved20_IRQHandler
def_irq_handler FTFA_IRQHandler
def_irq_handler PMC_IRQHandler
3) In the flash configuration section I made change so I could set the boot options.
/* Flash Configuration */
.section .FlashConfig, "a"
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFFFFF
.long 0xFFFFF9FE
.text
.thumb
If I use the blhost tool to read and set the boot options, I can read address 0x40C and if I read 4 bytes, the result is FE F9 FF FF. If I read 0x40D I get 0xF9 and this is what I expect.
Assuming the address of .section .FlashConfig starts at address 0x400, I am off a byte from what I expect.
I think the addresses should be as follows:
0x400 0x401 0x402 0x403 .long 0xFF FF FF FF
0x404 0x405 0x406 0x407 .long 0xFF FF FF FF
0x408 0x409 0x40A 0x40B .long 0xFF FF FF FF
0x40C 0x40D 0x40E 0x40F .long 0xFF FF F9 FE
So address 0x40E would be F9. I think I am off a byte because address 0x4D should be F9.
This works correctly but I thing I am off by 1 byte when I look at the definition ".section .FlashConfig, "a""
4) I assume all the IRQ's are pointed to the default IRQ handler and the ones that have callbacks are then installed. For example:
.align 1
.thumb_func
.weak SPI0_IRQHandler
.type SPI0_IRQHandler, %function
SPI0_IRQHandler:
ldr r0,=SPI0_DriverIRQHandler
bx r0
.size SPI0_IRQHandler, . - SPI0_IRQHandler
Is that correct on how that work?
Doug
?
Hello Doug,
I don't think we have document specifically for describing this file but I think this file is not difficult to understand.
It is for initializing vector table, stack, watchdog, clock setup. It is also for initializing data and bss sections.
After doing all the initialization, jump to main code.
If any specific code that you have difficulty to understand, please just let me know.
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------