Global Variables showing Garbage Value on the T32 Debug Tool - MPC5777C MCU

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

Global Variables showing Garbage Value on the T32 Debug Tool - MPC5777C MCU

Jump to solution
1,507 Views
maheshd
Contributor II

Hello,

I am using MPC5777C controller and T32 Debugger. In my source code there are several global variables and below are the test scenarios explaining the problem.

Test case 1 : If the Global variables are initialized on code(to be specific "initialized/.data"section of SRAM Address Range 2). So whenever I FULL RUN the code after flashing it shows the Garbage value, if i run it in the Debug mode (means with break at random times/functions,eg case: that global variable can store the return value from a function) then the value is correct/ initialized value.

Test case 2 :  If the Global variables are uninitialized on the code (to be specific "uninitialized/.bss"section of SRAM Address Range 2), then the no problem exist.

Can anyone please let me know is it something to do with the SRAM settings or Section mapping?

Test case 3 :Also if i move//Map those variables to Address Range 0 then no problem exists.

MPC5777C System RAM/SRAM Details :

Address Range 0 : 0x4000_0000–0x4000_FFFF Standby SRAM on XBAR Slave Port 2 (64 KB)
Address Range 1: 0x4001_0000–0x4003_FFFF SRAM on XBAR Slave Port 2 (192 KB)

Address Range 2: 0x4004_0000–0x4007_FFFF SRAM on XBAR Slave Port 4 (256 KB)

Thanks in advance!!

Labels (1)
1 Solution
1,313 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

the only thing which comes into my mind - do you use data cache? Have you tried to disable it for test purposes?

Regards,

Lukas

View solution in original post

6 Replies
1,314 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

the only thing which comes into my mind - do you use data cache? Have you tried to disable it for test purposes?

Regards,

Lukas

1,313 Views
maheshd
Contributor II

Hi lukaszadrapa,

thanks for your support !!

i got some updates for this link !

regarding your statement :

@the only thing which comes into my mind - do you use data cache? Have you tried to disable it for test purposes?

--> i said i have disabled data cache, but it was not working. (How did i disable cache? it is through MMU TLB settings for SRAM memory)

Now, i figured out some settings in MMU during Startup code.

I hope you're aware of TLB settings (i.e. we allocate/Map/reference physical memory as TLBs along with some memory settings and allow users/code to get access to memory).

For the above Global variable behaviour (in fact SRAM behavior) i have applied some MMU-TLB settings and tested. i figured out some test scenarios as below (of which some gave me desired output ):

SRAM - MMU TLB setting CASE 1 :

   1. TLB number = 3 ,

   2. TLB size = Entire SRAM (512KB),

   3. Cache enabled [I bit not set i.e. Cache-Inhibition disabled ] 

   Status : Not working i.e. above garbage behaviour

SRAM - MMU TLB setting CASE 2 :

   1. TLB number = 3 ,

   2. TLB size = Entire SRAM (512KB),,

   3. Cache Disabled[I bit set i.e. Cache-Inhibition enabled]

   Status : Not working i.e. above garbage behaviour

SRAM - MMU TLB setting CASE 3 :

   1. TLB number = 2 ,

   2. TLB size = Entire SRAM (512KB),,

   3. Cache Disabled[I bit set i.e. Cache-Inhibition enabled]

   Status : Working , valid values observed on Variables and everything is fine

SRAM - MMU TLB setting CASE 4 :

   1. TLB number = 2,3,4,5 (i.e. split SRAM to differnet TLBs)  ,

   2. each TLB size = 64KB,64KB ,64KB 256KB respectively

   3. Cache Disabled[I bit set i.e. Cache-Inhibition enabled]  for all TLBs or any one TLB (e.g : only TLB 3 and i map my          global variables to this cache-inhibited TLB 3)

   Status : Working , valid values observed  on Variables and everything is fine

So, i have some questions from the above cases 

Q1 : I think TLB numbers are irrespective of the Memory and work as per the start address and size, right? so why was data cache effective only after i allocate the SRAM to TLB 2 instead of TLB 3 ?? (comparing case 2 and 3)

Q2 : Also is it correct to set memory settings for entire SRAM (i.e. all address ranges with different slave port banks as mentioned in my first comment) and will those settings be effective i.e. actually gets reflected on memory?? (comparing case 2 and 4)

Thanks for the time !!!!

0 Kudos
1,313 Views
maheshd
Contributor II

HI Lukas,

Yes tried with Data Cache Disabled too. still it behaves the same !!

0 Kudos
1,313 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

do you have simple project to reproduce the problem? Could you share it? Which IDE do you use?

Regards

Lukas

0 Kudos
1,313 Views
maheshd
Contributor II

Hi Lukas ,

Sorry it's restricted on organisation level and cannot share anything. IDE used is GHS MULTI

and its settings  :

-bsp generic
-G
-object_dir=objs
:sourceDir=.
-vle
-dwarf2
-fsingle
-floatsingle
--ee
--long_long
-map
-callgraph
-strict_overlap_check
-fnonodouble
-dbg_source_root .
-Onone
-DAUTOSAR_OS_NOT_USED
-DUSE_SW_VECTOR_MODE

0 Kudos
1,313 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Mahesh,

well, it doesn't seem to be related to the microcontroller or its settings.

I have only one idea now - do you reset the microcontroller after programming? I mean by sys.up function. Debuggers usually just set the program counter to entry point, so BAM is not executed. Maybe that's the reason. Because if I can understand your description, you can see that behavior only after programming.

Regards,

Lukas

0 Kudos