HC08: Code Warrior newbie questions

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

HC08: Code Warrior newbie questions

4,364 Views
EtherJones
Contributor II
I'm new to Code Warrior.  Using it for the first time to program an
embedded app (Freescale MC9S08DZ60 microcontroller).
 
Although it is working well and I am making good progress, I have a few
questions:
 
1) In the data window in the debugger, occasionally a weird symbol in single quotes will
appear immediately to the left of a data value.  What is the meaning of
these symbols?
 
2) In the data window in the debugger, is there any way to export data
from the window into an external app like, say, Excel, for analysis?
Cut and paste appears to be disabled in this window, and I could find
no "export" feature.
 
3)  After compiling, how do I see a report of code and data size?
 
4) How do I inspect the stack in the debugger?
 
5) How do I view variables as the code is running?
 
I've read every doc I can get my hands on, but somehow must have overlooked the answers to these questions. 
 
 

Message Edited by CrasyCat on 2007-04-13 11:25 AM

Labels (1)
Tags (1)
14 Replies

1,593 Views
Spell
Contributor I
 
1) In the data window in the debugger, occasionally a weird symbol in single quotes will
appear immediately to the left of a data value.  What is the meaning of
these symbols?
The symbol you see are like this: 'U' 85? this is the ASCII translation of the data value.


regards,
filippo

0 Kudos

1,593 Views
CrasyCat
Specialist III
Hello
 
Yes for character variables, the debugger shows the corresponding ASCII value enclosed in single quotes.
 
CrasyCat
0 Kudos

1,593 Views
CrasyCat
Specialist III
Hello
 
>1- In the data window in the debugger, occasionally a weird symbol in single quotes will
>appear immediately to the left of a data value.  What is the meaning of
>these symbols?
Never seen that before. I would recommend you to log a service request for that through our on-line support web page. Make sure to attach a reproducible case (project) to the issue.
 
>2) In the data window in the debugger, is there any way to export data
>from the window into an external app like, say, Excel, for analysis?
>Cut and paste appears to be disabled in this window, and I could find
>no "export" feature.
What would be the reason for exporting that to Excel? Which kind of information are you looking for here?
 
>3)  After compiling, how do I see a report of code and data size?
If you want to see current application code and data size, look into the .map file.
 
>4) How do I inspect the stack in the debugger?
In the debugger there is a Procedure window, displaying the call chain and parameters.
Is that what you are looking for?
If you want to see the content of the stack, you can drag the SP from the Register window and drop it in the memory window. You will see a dump of memory, where the stack is ,located.
 
5) How do I view variables as the code is running?
You can set the data window mode to periodical. This way the content of the Data window will be refreshed periodically.
Just click with the right mouse button in the data window, select Mode -> Periodical and set the period.
Be careful, this may be intrusive and affect real time behavior of the system.
 
I hope this helps.
 
CrasyCat
 
0 Kudos

1,593 Views
DSbob
Contributor III
CrasyCat, you asked at 2):
What would be the reason for exporting that [data from the data window] to Excel? Which kind of information are you looking for here?
 
Here is a reason from another party:
I have a data acquisition application in variably hostile environments, display its peak.
The result (a single 2 digit number) acquired for display looks OK, for events < 100 Hz.
It looks suspiciously high for events ~400 Hz, where there is a possible 40 kHz disturbance.
Sampling rate is 4 kHz.
Attempts to apply shielding to the sensor have not worked.
 
So I an thinking if I could detect some threshold measurement, then fill RAM with a sequence of measurements say 50 for 5 cycles of data, I could see whether the data looked like the expected exponentially decaying sinusoid, or perhaps had some peakiness that could be eliminated by a simple digital filter.  For me, copy and paste sounds like a great ability for that, even if I had to change rows and columns of the data window to a column in the spread sheet.
 
0 Kudos

1,593 Views
bigmac
Specialist III
Hello,
 
Assuming that the data you are acquiring is analog, if higher frequency components are expected, you will need to properly filter the input(s), to prevent "aliasing" of the sampled signal.  With a sampling rate of 4kHz, the cutoff frequency of the filter will need to be somewhat less than 2 kHz.  How close to 2kHz you can achieve will depend on the steepness of the filter, and the amplitude of the high frequency components.
 
Regards,
Mac
 
0 Kudos

1,593 Views
Lundin
Senior Contributor IV
1) Not sure what you mean there.

2) Not possible as far as I know.

3) In the project window in the IDE there is a list that shows how big the code and data in a particular file would be if all of it was included. To see the actual size, you need to look in the very useful .map file that is generated by the linker.

4) Check the memory map at the address where you placed the stack.

5) Not possible unless you have an in-circuit emulator or a rather sophisticated BDM pod + debugger. The Codewarrior debugger can't do that.
0 Kudos

1,593 Views
atalbajracharya
Contributor I

Hello,

I know it's been a long time ago from your last post.But, I am also facing the same problem regarding info about code and data size. I couldn't find the .map file in my project folder. I am using codewarrior development studio for MCUv10.4. Could you please tell me where can I find the .map file in the project.

Atal

0 Kudos

1,593 Views
BlackNight
NXP Employee
NXP Employee

It is in the same folder as the .elf/.abs file, typically in FLASH or something like this.

0 Kudos

1,593 Views
atalbajracharya
Contributor I

Thank you for the quick response. I found the .map file but couldn't analyse it to get the code and the data size from it. Couldn't you please help me with it

Atal

0 Kudos

1,593 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Atal:

In the map file you can find a summary of the memory usage. Something like next:

Sizes.png

READ_ONLY is the total FLASH memory used by code, constants, variable initialization values, arrays, etc.

READ_WRITE is the amount of RAM memory used by your variables.

NO_INIT corresponds to the MCU registers, and also any memory section declared as no_init in your linker file (prm).

The rest of the map file contains whole more details about the placement and sizes of your variables, functions, initialization code, etc.

Hope this helps!

Jorge Gonzalez

1,593 Views
atalbajracharya
Contributor I

Hi Jorge:

First of all Thank you for your clear explanation.But I didn't find the above mentioned section in my .map file. There is a section at the end of my .map file which is as follows:

# Memory map:

  v_addr        p_addr       size     name

  00000000 00000000 00000400 .vectors   vectorrom

  00000400 00000400 00000018 .cfmprotect cfmprotrom

  00000500 00000500 00000000 .code      code

  00000500 00000500 0000DCD0 .text      code

  20000000 20000000 00000000 .vectorram vectorram

  20000400 20000400 00000000 .userram   userram

  20000400 0000E1D0 00000018 .data      userram

  20000418 20000418 00005510 .bss       userram

  20005928 20005928 00000000 .custom    userram

  20005928 0000E1E8 00000018 .romp      userram

# Link start time: Mon Mar 31 14:13:23 2014

# Link end time: Mon Mar 31 14:13:23 2014

Does the size of the code section represent the Flash memory and the sum of the size of userram section represent the RAM memory.

Atal

0 Kudos

1,593 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Atal:

This thread was originally for an HCS08, so it thought it was the case for you.

In your case here is the explanation:

The interrupt vectors start at address 0 and their size is 0x400 bytes.

The code starts at address 0x500 and it is 0xDCD0 bytes long

Initialized data starts at address 0xE1D0 and it is just 0x18 bytes.

Non Initialized data starts at address 0x20000418 and it is 0x5510 bytes long (this is a RAM space).

- You must add .vectors, .cfmprotrom, .text, .data and .romp to get the size of FLASH used.

- Add .data, .bss and .custom to obtain RAM usage.

0 Kudos

1,593 Views
atalbajracharya
Contributor I

Hello again, I am stuck in another problem now. I am using mcf52235 microcontroller which has 32Kb RAM. When I added .data,.bss and .custom sizes,it accumulated to a value of about 25Kb. But, when i programmed my microcontroller, it didn't run! Now, i reduced my RAM uses to minimal value by modifying the code to  just led blinking operation. Now, the program run fine. So, was the cause of my program "hanging" in the first instance due to RAM overflow???shouldn't the Codewarrior give error message in that case??

Secondly, there is

# Heap and Stack sizes definition

  ___heap_size  = 0x1000;

  ___stack_size     = 0x1000;

defined in the "MCF52235_Internal_Flash.lcf" file.Is this 4kb each allocated for heap and stack included in the RAM size found in the .map file. I ask this question cause when I reduced heap and the stack sizes to 0x500 each,my initial code with RAM of 25Kb started working. Thanks in advance!

Atal

0 Kudos

1,593 Views
BlackNight
NXP Employee
NXP Employee

It looks your RAM overflowed the available space. Unfortunately the ColdFire linker does not report an error for this. 4 KByte stack seems a lot to me, do you really need that much?

And I suggest that in case you have such a problem, you debug your application through the startup code. Very likely your SP (stack pointer) gets pointed to FLASH area and then your application crashes.

Erich

0 Kudos