CodeWarrior for StarCore DSPs, Classic IDE

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

CodeWarrior for StarCore DSPs, Classic IDE

7,505 Views
J2MEJediMaster
Specialist I

This thread contains FAQs that cover CodeWarrior for StarCore DSPs tool set that uses the "Classic" IDE. However, they also contain some general-purpose information that may be of value to the anyone using the Eclipse-base CodeWarrior for StarCore DSPs tools.

Labels (1)
Tags (1)
0 Kudos
31 Replies

2,856 Views
J2MEJediMaster
Specialist I

Q: Can I use CodeWarrior's SC3400plat_pacc simulator with a SmartDSP OS project? 


I have an MSC8144ADS SmartDSP OS project created from CodeWarrior stationery. Is it possible to profile one of the 4 linker-output files (~.eld) using the SC3400plat_pacc simulation model? I want the measurement to be performance-accurate like the SC3400platform-accurate model.

 

A: The runsim profiler does not handle cases where the address translation is not 1-to-1, which is the case with the SmartDSP OS. This means that for situations where virtual and physical memory addresses are not the same, which occurs in SmartDSP OS applications, the runsim profiler will not work. Therefore, unfortunately you cannot use the runsim profiler for SmartDSP OS projects. These profiler results will have to be acquired on a real hardware target, such as the MSC8144ADS.

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: When using CodeWarrior for StarCore, what is the meaning of the clock() function's return value when running MSC8144 for ISS ?

 

When using CodeWarrior for StarCore, what is the meaning of the clock() function's return value when running MSC8144 for ISS? I tried to use the code found in StarCore_C_Compiler_User_Guide.pdf to measure the time needed for my application processing:

#include "time.h"
clock_t start, end, elapsed;
/* . . . application setup . . . */
start = clock( );
/* . . . application processing . . . */
end = clock( );
elapsed = end - start; /* Assumes no wrap-around */
printf("Elapsed time: %Lu * 2 cycles. \n", elapsed);

I want to know that is the meaning of the number returned by clock()? Is it my CPU's clock, or the core's internal clock?

 

A: The time shown when running the MSC8144 for ISS represents the number of instructions executed. Each time a new instruction is executed, the SC100 Simulator Register/CYCLE is incremented. When the clock() function is called, the Debugger Engine automatically reads the value of the CYCLE register.

In order to measure the time needed for code execution via clock(), you need to use one of the MSC8144 timers. For a proper measurement, the timer needs to be initialized and started. An example about how to achieve this can be found in: {CW install dir}\StarCore_Support\MiniDrivers_8144ADS\Examples\CoreTimer\.
Please notice that you need to add libd, (located in {CW Install dir}\StarCore_Support\MiniDrivers_8144ADS\Lib\) to your project in order to have the proper implementation of the clock() function.

The workstation CPU's speed has no influence upon clock()'s return value.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: When building a program with CodeWarrior for StarCore, what are the differences between selecting SC3400 and MSC8144 targets?

 

I am building a new stationary project in the IDE, and need to understand what these differences are.

 

A: The main differences between these targets are:
1) The MSC8144 supports only the BIG ENDIAN addressing mode and non-small memory models.
2) The SC3400 target architecture does not support MMU translation, cache, and memory protection.
3) Each processor requires different libraries files and start-up (boot) code. When a program using the SC3400 target is built, the IDE uses the library files located in {CW installed dir}\StarCore_Support\compiler\lib\sc3400. When building for the MSC8144 target , the IDE uses the library files located in {CW installed dir}\StarCore_Support\compiler\lib\msc8144.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: How can I enable 64-bit data type support in CodeWarrior for StarCore? 

 

I tried adding the -sll option in the To Shell edit box within the project settings Passthrough, Hardware panel, but the linker does not find the long long arithmetic functions.

 

A: The application is linked with the incorrect run time library file.

In order to enable operation on 64-bit data, check the box 64-Bit Data Type support (long long and double) in the C Language panel.

This should change the library linked to your application and enable the appropriate long long functions.

Do not specify -sll in the Passthrough, Hardware panel.

 

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: For CodeWarrior for StarCore, I am reading 16-bit values from an ASCII text file with fscanf(). I only get the data values from odd addresses, while the even address values are filled with zeros. Why is that happening? 

 

I am using following code to read from the file:

short *p_local;

for (count=0; count< NbrElement; count++)
{
ret= fscanf(file, "0x%x\n" ,p_local++);
}

A: If you intend to read 16-bit values out of an ASCII text file, we would recommend using:

ret= fscanf(file, "0x%hx\n" ,p_local++);

to do this.

The modifier %x is reading an int (32-bits) from the file. The modifier %hx reads 16-bit values.

 

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: The CodeWarrior Flash Programmer takes hours to program an 8MB flash from an S-Record file, yet another flash programmer does this same operation in minutes. Why is the CodeWarrior Flash Programmer so slow?

 

 

A: The speed of the CodeWarrior Flash Programmer can be improved by verifying these configurations:

- Make sure the Interface Clock Frequency between the USB TAP or Ethernet TAP and the target is set to the maximum supported data rate.

- Make sure the target-initialization file used by the Flash Programmer does not enable caches in the target processor.

- Make sure the Flash Programmer's Target RAM Buffer Size is set to the maximum size supported by the target RAM.

- Disable the Verify Target Memory Writes option in the Flash Programmer.

If all of these steps have been taken and the Flash Programmer is still taking a long time to program the flash, then examine your S-Record file and look for a large number of gaps in the addresses written to flash. The CodeWarrior Flash Programmer works best if there are no gaps between flash addresses. Every time there is a break or discontinuity between addresses, the CodeWarrior Flash Programmer flushes the Target RAM Buffer and starts over, filling it with data from the S-Record file. Each one of these breaks/flushes interrupts the steady flow of data to the target flash, and thus slows down the Flash Programmer.

A workaround to this situation is to convert the S-Record file to a binary file, filling all the gaps or holes with values of 0xFF, thereby creating a continuous stream of data from start to finish. One such converter can be found at http://www.s-record.com. Be sure to use the -o parameter to define the address where you want your data to start, otherwise the srec2bin.exe utility fills your binary file with filler data from a starting address of 0x00000000 up to the starting address of your real data.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: How can I get const variables to be linked separately from text strings when building code with CodeWarrior for StarCore? 

 

A: In order to get constants allocated in a separate section from strings, you can use

  place (ALL_STRING)

in your .appli file.

If you build with

  String_To_Rom= TRUE

you need to define a dedicated ROM section as follows:

  rom = [
    ...
    strings: ".string",
  ]

If you are not building with

   String_To_Rom= TRUE

you need to define a dedicated data section as follows:

  data= [
    ...
    strings: ".string",
  ]

Then use

  place (ALL_STRING) in strings

This should place all string constants in the section .string.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: In CodeWarrior for StarCore, if you Run rather than Debug a project, can you still get console I/O?

 

A:  When you run an application instead of debugging it, the debugger performs the following actions:

  - Configures the target by executing the commands in the Target Initialization File. This file is specified in the Target option of SC Debugger Target panel.

  - Downloads the code to the target and starts program execution. No debugging session is started, so output to console window is not possible.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: In CodeWarrior for StarCore, how do I force code/data into specific areas of memory?

 

A:  Basically you can place code (or data) in a specific section using either a pragma, or an application configuration file (*.appli).

If you decide to use a pragma to place code from a specific module into, say, a section called .mySection, you can use the pragma pgm_seg_name:

#pragma pgm_seg_name ".mySection "

In this example, the code from all functions within that module are allocated in the specified section.
There are pragmas data_seg_name, bss_seg_name, and rom_seg_name that allow you to place initialized data, un-initialized data or constant data into their respective user-defined sections. The section can then be placed in the desired memory area using the .lcf file.

If you decide to go with an application configuration file, we recommend that you to create a project for a MSC8144_ADS board without SDOS support to generate an .appli file that can be used as a starting point.
Check the file demo.appli in the Application_file folder for an example on how to allocate functions/data in user-defined sections.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: I was using a parallel port when debugging with CodeWarrior. However, now I am using a USB TAP interface and CodeWarrior does not recognize it. I cannot get the CCS software to switch from using the parallel port to the USB TAP. How do I corrrect this?

 

 

A: You need to modify the configuration file that the CodeWarrior Connection Server (CCS) uses to determine which interface to use.

1) Quit the IDE.
2) Close all CCS icons on the Windows status bar by right-clicking on them and choosing Quit CCS.
3) Start the IDE.
4) Select File > Open and choose the file {CodeWarrior Installation}\ccs\bin\ccs.cfg.
5) Change config cc Parallel:1 to config cc utap.
6) Save the changes and close the edit window.
 

 

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: For CodeWarrior for StarCore, in the application configuration file, how can I allocate variables into different sections?

 

A: Suppose you want to allocate a global variable called MyTable into a section called MyTableSec, you can create an application configuration file looking as follows:

configuration

  view test

    section
      data = [data1:"MyTableSec"]
    end section
    place (_MyTable) in data1
  end view

  use view test

end configuration

The compiler adds a "_" prefix to the symbol name internally. Therefore, you need to write _MyTable to allocate the symbol MyTable in a specific section.

 

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: I am getting the message support for long long and double is insufficiently specified due to .asm files I have in my project. How can I avoid that? 

 

 

A: To prevent the linker from generating this message for assembly source files when the 64-bit datatype support is activated in ANSI C, you need to add following line at the beginning of the assembly source file:

DEFINE .slld '1'

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: In CodeWarrior for StarCore, how can I access the symbols defined in my linker control file (.lcf) from a source file?

 

If I define a symbol as:

.provide mySymbol, 0x0F

I get a linker error message if I use the symbol as follows:

unsigned long int data = mySymbol

Why is that happening?

A: When you define a symbol in the .lcf file as follows:

  .provide mySymbol, 0x0F

you define a symbol, mySymbol whose address is 0x0F.

So in order to make sure the variable data gets initialized with the contents of address 0x0F, you need to write:

  data = (unsigned long int)(&mySymbol);

Writing data = mySymbol reads 4 bytes of data storage from address 0x0F-0x02. This is not legal on StarCore, where all 4-byte read accesses should be aligned to an even boundary.
 

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: I'm trying to debug an application already loaded into ROM. In this case, how should the debugger be started in order to for it to have access to the symbols and source code?

 

A: This can be achieved as follows:
  1) Double-click on HIWAVE.exe in the File Explorer.
  2) Select File > Open Configuration and browse for your project's .ini file.
     This file is usually located in your project directory and is named according to your connection interface.
     For example, if you using a P&E Multilink cable, the file is named P&E_Multilink_CyclonePro.ini.
  3) Select File > Load Application.
  4) Browse for your application .abs file.
  5) Click Load Symbols.

You should be connected to the board and have access to the application's symbolic information.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: I have a board with several StarCore DSPs on it. Two StarCore DSPs are running the exact same code. When I set a breakpoint in this common code, how can I control to which DSP the breakpoint is associated?   

 

A: In a multi-DSP application, it is not recommended to set breakpoint in CodeWarrior Edit windows. What you are doing is activating the breakpoint for whatever is the default core. It is extremely hard to control what is the default core at a given moment.

To make sure you set a breakpoint for the core you are interested in, you need to set it either in the Core Thread window, or use a Memory window opened for that core.

Using the Core Thread window is fine if you want to set a breakpoint in the function where the core is currently stopped. If you wish to place the breakpoint in another function, we recommend using the Memory window.

This can be achieved as follows:
   1) Right-click in the Thread window of the core where you want to set the breakpoint.
   2) In the drop down menu that appears, select View Memory. A Memory window opens for the selected core.
   3) In the Memory window's Display edit box, enter the name of the function where you want to set a breakpoint (for example, MyFunction).
   4) Set the View combo box to Source or Mixed (Whatever you feel more comfortable with).
   5) Set your breakpoint in the Memory window.

If set in shared memory, the breakpoint will trigger for all cores on the same DSP as the core you selected.

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: How do I force alignment of a variable without using a #pragma align x?

 

That is, how can I set the alignment of variables in memory without the use of compiler-specific directives?

A: Use the __attribute(align(n)) function to force alignment.

For example:

typedef struct {
short a;
short b;
short c;
__attribute__((aligned(8))) short test[16];
short * ptr;
} OK1_T;

or

__attribute__((aligned(2))) unsigned char my_char;

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: How do I assign my StarCore code to a section without using pragmas?

 

A: The StarCore compiler now supports GCC-like style attributes to define a section, like so:

__attribute__(section(“sect_name”)).

Here is an example that defines the sections sec1 and sec2:

extern void example( void ) __attribute__ ((section ("sec1")));

int x __attribute__ ((section("sec2")) = 0;

 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: In CodeWarrior for MXC 2.2, how do I setup trace triggers without having to set OCE events and Nexus hardware registers?

 

A: CodeWarrior for MXC 2.2 and future releases support Trace points. To use these, simply right-click on your source code or dissassembly window during a debug session and Select Trace Start point or Trace Stop point to set a range of specific code for tracing.
 

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: In CodeWarrior for StarCore, what is the difference between .segment and .concatenate linker directives?

 

A: The .segment directive combines all sections that match the specified patterns into a new segment, at the current location counter or at the memory address specified by .org directive

The .concatenate directive concatenates a list of OVERLAY sections, in the specified order. Concatenate pertains only to overlay sections. Overlay sections in the list must share such properties as flags and section type.

For the StarCore MSC81xx, it is recommended that you use the .concatenate instead of .segment directive.

Why should .concatenate directive be used?
First, this can be used to reduce the number of descriptors.
Second, the .concatenate directive simulates the behavior for the .segment directive, but this directive creates a section instead of segment.

0 Kudos

2,856 Views
J2MEJediMaster
Specialist I

Q: In CodeWarrior for StarCore, what is .define_single_mapped_virtual_addressing?

 

 I want to know whether the linker directive .define_single_mapped_virtual_addressing maps virtual addresses to physical addresses same with address or not.

A: This directive maps a virtual address to the physical one. Nevertheless, the physical address will be the same as the virtual one only if the virtual address is in the range of existing physical ones. Otherwise, the linker displays an error.

This directive adds an entry into att_mmu, where you can view the same addresses for virtual and physical memory.

0 Kudos