This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[Help] Secondary Bootstrap Loader + Blink Led is not working

Hi, 

I'm trying to develop a firmware to toggle the P7.3 pin from XC2267 (infineon) after jumping by my own Secondary Bootstrap Loader (ASC) using Keil.

To do this, I am entering in BSL mode, sending byte 0x00 and receiving the acknowledge (0xD5) correctly.
Then I send 32 bytes from the Secondary Bootloader so that I can receive a bigger firmware (in this case my secondary bootloader will receive 1066 bytes).
After sending 1066 bytes, the secondary bootloader jumps to the address 0x0E00020 that will toggle pin P7.3 (I called as BlinkLed)
After jumping, I'm expecting for pin P7.3 to be in high and low level as the firmware enter into a loop that only has those instructions, but nothing happens.
I thought the problem was because it was configured as UART and I couldn't toggle the pin, so I changed the firmware to send a byte via UART (by pin p.7.3), but it didn't work either.
Now what I believe is that my BlinkLed project is not working because I should configure the project to run on address 0x0E00020 instead of 0xC000000, but I'm not sure.

Does someone have an ideia on how to configure those two projects, to enter in Bootstrap mode then jump to C application and toggle a pin ?
Below are the pieces of my code

Secondary Bootloader (assembly)

TargetStart LIT '0E00020H'  ;Definition of target area:
TargetEnd 	LIT '0E0005FH'  ;1066 bytes in this example
StartOfCode LIT '0E00020H'  ;Continue executing here...
							;...after download

Level2Loader:
		DISWDT 						;No WDT for further download
		MOV DPP0,#(PAG TargetStart)		
		MOV R10, #(DPP0:TargetStart);Set pointer to target area		
Level2RecLoop:
		MOV R4, [R0] 			    ;Access PSR   			  (MOV mem, [Rw])    = Move indirect word memory to direct memory)
		JNB R4.14,Level2RecLoop     ;Wait for RIF 			  (JNB baddr, re)    = Jump relative if direct bit is not set)
		MOV [R1],R3 				;Clear RIF for new byte   (MOV [Rw], mem)    = Move direct word memory to indirect memory 
		MOVB [R10],[R2] 			;Copy new byte to target  (MOVB [Rw], [Rw])  = Move indirect byte memory to indirect memory)
		CMPI1 R10, #POF (TargetEnd) ;All bytes received??     (CMPI1 Rw, #data4) = Compare immediate word data to direct GPR and increment GPR by 1															
		JMPR cc_NE,Level2RecLoop    ;Repeat for complete area (JMPR cc, rel)     = Jump relative if condition is met
Level2Terminate:
		JMPS SEG StartOfCode, SOF StartOfCode ; Jump to next code  ; (JMPS seg, caddr) Jump absolute to a code segment

Code to toggle PIN (written in C)

void main(void)
{
  // USER CODE BEGIN (Main,2)

  // USER CODE END

  MAIN_vInit();

  // USER CODE BEGIN (Main,3)

  // USER CODE END

  while(1)
  {

   // USER CODE BEGIN (Main,4)
   IO_vTogglePin(IO_P7_3);
 
   // USER CODE END

  }

} //  End of function main

C Code configuration

I also have attached below the complete code of my two projects
Hope someone can help me, because I'm working over a week on this


TestBSL.zip

Some more information that might be helpful:
IDE: Dave2(creating and configurating the project) + uvision5
Compiler: keil


Thanks