2007-09-05 08:17 AM
2006-10-04 12:52 AM
Hi Friends,
I have to write a boot loader for ST10F276, Its my first time to write a boot loader. Could anybody help me to give some guideline to start n what is necessary task that the boot loader must do. Thanks n Regards, Neeraj2006-10-04 09:24 PM
Hello,
The first 32 bytes that Neila had talked about are almost always a loop to download more instruction bytes. Please find below an example of the first 32 bytes received from the ASC0 downloading more code to program the user application: mov R0, #0FA60h ; R0 is the address to the next byte W0: jnb S0RIR, W0 ; wait until a byte is received movb [R0], S0RBUF ; place the received byte in memory bclr S0RIR ; clear serial receive flag movb S0TBUF, [R0] ; transmit (echo) the byte cmpi1 R0, #(0FA60h+NUMBYTES-1) ; see if all bytes are received jmpr cc_NE, W0 ; if not repeat nop nop nop nop This loop takes exactly 32 bytes to implement. Note that NOP instructions are used to pad the loop to make it exactly 32 bytes. Once the 32-byte loop is received, the microcontroller branches to 0FA40h and starts executing this 32-byte loop. This loop expects more characters to be received and places the received characters in internal memory. After sending the 32-byte loop, more bytes are sent, now to be placed in memory by the loop rather than by the microcontroller’s bootstrap. This way, when the loop finishes downloading the bytes, execution simply continues, and after the four NOP instructions, the instruction bytes downloaded by the loop are executed. Regards, Najoua.2006-10-27 06:03 AM
Najula,
I understand how your boot loader works but I have additional questions. 1)What is the address and bit position of SORIR? The datasheets don't tell me. I do know where SORBUF and SOTBUF are. 2)If I start loading another program at FA60h when do I run out of IRAM? The datasheets don't tell me where IRAM start and ends. I know I have 2K bytes, but I don't know where it's mapped. Dudley :-?2006-10-29 06:44 PM
Hello,
Below are answers to your questions: - SORIR is bit field 7 in register S0RIC (FF6Eh). S0TBUF address is FEB0h and S0RBUF address is FEB2h. You can find all registers' description in the ST10F276 user's manual. - The IRAM address range is: 0xF600 - 0xFDFF. This is indicated in the ST10F276 datasheet, in section 4 MEMORY ORGANIZATION, Figure 4 : ST10F276 On-chip Memory Mapping, page 22. Regards, Najoua.2006-11-07 01:06 PM
Najoua,
This bootloader program works, but only if I add a leading NOP. The resultis I get is the first instruction at FA40h always mis-executes. i.e. the MOV R0, #0FA60h doesn't happen unless i do NOP MOV R0, #0FA60h ... Is there an erata sheet that confirms this? Dudley2006-11-08 02:30 AM
Adding to the last message.
I think I have a theory as to why this might happen to me. See last message. I send a 00 to the ST10 through the UART to start the BSL and set the baud rate. The ST10 replies with a D5 acknowledge byte. I start sending the first byte (of the 32 byte BSL program) to the ST10s UART as soon as the last rising edge of TXD0. So the acknowledge byte really had not completed. Is it possible that this first byte gets corrupted if I'm sending it too soon? Tomorrow, I will try adding a delay here, and see if my first instruction starts working. Dudley2007-09-05 08:17 AM
Hi Dudley,
Although it is almost a year ago... But do you have found a solution? Regards, Folkert