- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I created a small function, defined in main.c as shown below:
int somefunc(int par1, int par2, int par3, int par4, int par5, int par6) { par1 = par1+par2; par1++; par3 = par1+par3; par3--; par5 = par5+par6+par3; par3 = par5; return (par3+par4); }
In main, I call this function with parameters shown below:
x = somefunc(16, 32, 64, 128, 256, 512);
However, in the disassembly view i see,
63: x = somefunc(16, 32, 64, 128, 256, 512); 0x00000208 mov.w r3, #100 ; 0x100 171: } 172: else 173: { 174: /* IMO doubler disabled */ 175: cyPmBackup.imo2x = CY_PM_DISABLED; 0x0000020C str r3, [sp, #0] 0x0000020E mov.w r3, #200 ; 0x200 0x00000212 str r3, [sp, #4] 435: { 436: /* The IMO is ready to be source for Master clock */ 437: if(CY_PM_CLKDIST_MSTR0_REG != cyPmBackup.clkSyncDiv) 0x00000214 mov.w r0, #10 0x00000218 mov.w r1, #20 0x0000021C mov.w r2, #40 ; 0x40 0x00000220 mov.w r3, #80 ; 0x80 0x00000224 bl 14c <somefunc> 0x00000228 mov r3, r0 0x0000022A str r3, [r7, #c] ... Clearly there is something wrong here - why are the lines 171 - 175 and lines 435 - 437 showing up? They have something to do with the internal oscillator (IMO) iirc. The assembly code, btw, is doing the correct things... The device is a PSoC 5, software is PSoC Creator V1 (Production). This is just one example - there may be others that I have not seen.
Any ideas anyone?
~Abhijit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re - posting for better readability...
Hi
I created a small function, defined in main.c as shown below:
int somefunc(int par1, int par2, int par3, int par4, int par5, int par6)
{
par1 = par1+par2;
par1++; par3 = par1+par3;
par3--; par5 = par5+par6+par3;
par3 = par5;
return (par3+par4);
}
In main, I call this function with parameters shown below:
x = somefunc(16, 32, 64, 128, 256, 512);
However, in the disassembly view i see,
63: x = somefunc(16, 32, 64, 128, 256, 512);
0x00000208 mov.w r3, #100 ; 0x100
171: }
172: else
173: {
174: /* IMO doubler disabled */
175: cyPmBackup.imo2x = CY_PM_DISABLED;
0x0000020C str r3, [sp, #0]
0x0000020E mov.w r3, #200 ;
0x200 0x00000212 str r3, [sp, #4]
435: {
436: /* The IMO is ready to be source for Master clock */
437: if(CY_PM_CLKDIST_MSTR0_REG != cyPmBackup.clkSyncDiv) 0x00000214 mov.w r0, #10
0x00000218 mov.w r1, #20
0x0000021C mov.w r2, #40 ; 0x40
0x00000220 mov.w r3, #80 ; 0x80
0x00000224 bl 14c <somefunc>
0x00000228 mov r3, r0 0x0000022A
str r3, [r7, #c] ...
They have something to do with the internal oscillator (IMO) iirc.
The assembly code, btw, is doing the correct things...
The device is a PSoC 5, software is PSoC Creator V1 (Production).
This is just one example - there may be others that I have not seen.
Also, I have verified this by starting up the debugger and single stepping through the assembly - the screenshot is attached. The instructions at 0x218 to 0x220 save the parameters to be passed to the function and the line at 0x224 is the actual branch...
Hope that clarifies the problem...
Thanks,
~Abhijit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
*bump*
Anyone?
~Abhijit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do not be hasty....
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just copied your pgm and had a look at main.lst. Here everything looks quite O.K.
Did you already try (sorry to ask) a re-boot and a re-build?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I confirm that the disassembly window shows the incorrect source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've seen that before while debugging seems like the wrong code is displayed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content