CW can only  debug assembler uboot code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW can only  debug assembler uboot code

Jump to solution
2,901 Views
00lirui
Contributor I

Hi.

Board: MPC8306som

BSP:LTIB

Software tool:CodeWarrior 8.8 linux host

                      USB TAP

 

Step:

          1 prepare uboot elf file.

           Make these changes to the file u-boot/config.mk:

           DBGFLAGS = -g2 -gdwarf-2

           AFLAGS_DEBUG = -Wa,-gdwarf2

           OPTFLAGS = -O1

     

            rebuild uboot file,make uboot.bin  and uboot(elf)

          

            2 create CW project

             open the uboot(elf),and auto import source code . only libgcc2.c file can't be found.

             download uboot.bin to Nor Flash in address 0xff800000

 

            3 debug uboot code before MMU is enabled

             confiure the USBTAP,set pic address 0xff800000.

             Check the Stop on Application Launch checkbox.

             Select the Program entry point option button.

 

             Power on the board and attach the process.

             break the run ,

             EPPC  hard reset.

             All the CW display is assembler code not start.s source code, I can run it step by step ,the breakpoint in the source code doesn't work .

 

      So I suspect the problem may caused by uboot.bin and elf file,but I can't prove it.

      Where should I look back carefully?  Does lack of libgcc2.c file cause this problem?

      Thanks for any suggestion.

Original Attachment has been moved to: config.mk.txt.zip

0 Kudos
1 Solution
2,343 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Li Rui,

Please rebuild u-boot booting from NOR Flash, RCW with BMS as 1, and CW alternate address 0xfff00000, then debug u-boot from NOR Flash, but I think it's better to flash an appropriate RCW(binary file) on NOR Flash.

If further assistance is needed, please feel free to let me know.


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
11 Replies
2,343 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Li Rui,

Please check whether the debug cursor could go to start.S, after configuring Alternate Address at 0xFFF00000.

The parameter "alternate address" only tells CodeWarrior debugger where to find the executing code. For MPC83xx processors, after reset the target the PC register should be set at 0xFFF00100, where should be reset vector of u-boot, so please configure"alternate address" at 0xFFF0_0000".

If your problem remains, please capture a screenshot of your current debug project.


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,343 Views
00lirui
Contributor I

Hello.

        I try the alternate address 0xfff00000,if the  usbtap use the JTAG configuration file "8306SOM_HRCW_jtag_BMS1.txt",I can go to the start.s , but can't step into ,because the assembler code is not right,you can see it from my picture file.  When I set JTAG configuration file "8306SOM_HRCW_jtag.txt" , I can't go to the start.s.

      My uboot.bin file boot from low address 0x00000100, when I change alternate address 0x00000000,and use ."8306SOM_HRCW_jtag.txt"  file, I can't go to start.s file. the project configuration file is Remote Debugging.xml.

      thank you.

0 Kudos
2,344 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Li Rui,

Please rebuild u-boot booting from NOR Flash, RCW with BMS as 1, and CW alternate address 0xfff00000, then debug u-boot from NOR Flash, but I think it's better to flash an appropriate RCW(binary file) on NOR Flash.

If further assistance is needed, please feel free to let me know.


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,343 Views
00lirui
Contributor I

Hello.

Thanks for your solution. One more question, is the download address  of nor flash different between BMS 1 and 0 uboot binary file. The download address I used before is  0xff800000 offset.

0 Kudos
2,343 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Li Rui,

When use CodeWarrior to download u-boot, there is no relation with BMS, u-boot at 0xff800000 is correct.

BMS decides where to fetch the boot code, related with u-boot executing.

Thanks,

Yiping

0 Kudos
2,343 Views
00lirui
Contributor I

Hello.

   I change the uboot code(include/confiure/mpc8306.h)  to  "#define CONFIG_SYS_HRCW_HIGH 0x04600000" from 0x00600000. Set BMS to 1.  Rebuild the uboot file,and try again. But the result is the same with last time ,the problem remain. It is very weird.

0 Kudos
2,343 Views
00lirui
Contributor I

Hello.

      When I changed the download address of NOR Flash to 0xfff00000 from 0xff800000. It works well. Why?

0 Kudos
2,343 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Li Rui,

Do you use Codewarrior to download u-boot? CW uses different memory map with u-boot.

In CW initialization file NOR Flash begins at 0xff800000, and u-boot image(including RCW) should be located at the beginning of the NOR Flash.

You use Freescale demo board, right?

I am not sure, if you are bringing up new board, probably you need to check the CS configuration.


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
2,343 Views
00lirui
Contributor I

Hello.

    There are several questions confused me.

    First is about  alternate address ,you said it is only used to tell the CW where the code start,but in the file "Tutorial: Debugging the U-Boot Universal Boot Loader" ,"An alternate load address causes the debugger to assume that all sections have been relocated to RAM. If you specify no alternate load address, the debugger can display source code only for sections in flash memory. If you specify an alternate load address, the debugger can display source code only for sections in RAM."   Does this explanation right?

    The second is uboot.bin down load address, if there is no difference between BMS 0 and 1, why I download at 0xff800000,then the CW shows no valid at 0xfff0_0100,but no problem at 0x0000_0100. When I download at 0xfff0_0000,the CW  shows valid code at 0xfff0_0100,but wrong code at 0x0000_0100. My test board is made a copy from demo board.

     The third is how to debug ram code, now ,I can go to start.s,but how to run to C code?  change the pic address in command window?

   Thanks a lot.

0 Kudos
2,343 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Li Rui,

1. The above alternate address description is more suitable for debug u-boot jumping from NOR Flash to RAM, in this stage the "alternate address" must to be configured.

2. If BMS=0 the start offset in the NOR flash is 0x100.

If BMS=1 then the start offset is 0xFFF0_0100 & (MaxAddr),where MaxAddr is address of the highest byte in the NOR flash.

For example, for 8MBytes flash MaxAddr=0x7F_FFFF and offset is

0xFFF0_0100 &0x007F_FFFF = 0x70_0100

In default,BMS=0 u-boot address in CW is 0xff800000, when BMS=1 u-boot address in CW is 0xfff00000.


3. Please refer to the section "Debugging the U-Boot Section in RAM" in "Pro & Linux App Edition Targeting Manual.pdf", the attached would be helpful.


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,343 Views
00lirui
Contributor I

thank you so much!

0 Kudos