cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Anonymous
Not applicable
13,376 Views

compiler to transform c code to assembly code

Hi everybody,

 

I am working on ISE project to implement a multi PicoBlaze microprocessors. I want to execute an application on this architecture. My application is written the C language, I want to know if there is a compiler which convert C code to assembly code (.psm) using the instruction set of the picoblaze.

 

Thanks in advance.

0 Kudos
10 Replies
bwiec
Xilinx Employee
Xilinx Employee
13,372 Views
Registered: ‎08-02-2011

Not officially. I seem to remember someone posting their own compiler a while ago. You might search around on the forums and/or google
www.xilinx.com
0 Kudos
eilert
Teacher
Teacher
13,359 Views
Registered: ‎08-14-2007

Hi,

some googling lets you find this:

 

http://opencores.org/project,copyblaze

 

which links to this:

http://www.fit.vutbr.cz/~meduna/work/doku.php?id=projects:vlam:pbcc:pbcc

 

This compiler is for the PB3 only.

There once was another tool for the PB2 written by Francesco Poderico , but that project died away a while ago.

 

When you are using such a compiler read carefully about the limitations.

Simple things like assignments, conditionals (if, case) , loops and simple operators might work.

But there might be no libraries etc. So you will be limited to the purest C language definitions.

 

If you already have some code for whatever application you might soon find out that it drops more error and warning messages than it has usable code lines.

 

Good luck.

 

Have a nice synthesis

  Eilert

 

0 Kudos
Anonymous
Not applicable
13,355 Views

Hi,

 

Thank you for your help.

 

 

0 Kudos
makni
Adventurer
Adventurer
13,248 Views
Registered: ‎12-26-2013

Hi,

 

After download the picoblaze compiler (PBCC) from http://www.fit.vutbr.cz/~meduna/work/doku.php?id=projects:vlam:pbcc:pbcc.

I have execute some simple c programs examples for Picoblaze, and i didn't find any problems.

Now , when I use this c compiler to compile and execute my c application ( which is more complex ), it's generate many errors like:

 

filtre.c:2:20: error: stdlib.h: No such file or directory
filtre.c:32: error 10: 'lvalue' required for 'assignment' operation.
filtre.c:33: error 10: 'lvalue' required for 'assignment' operation.
filtre.c:46: warning 112: function 'malloc' implicit declaration
filtre.c:48: warning 112: function 'malloc' implicit declaration
filtre.c:49: warning 112: function 'malloc' implicit declaration
filtre.c:51: warning 112: function 'malloc' implicit declaration
filtre.c:53: warning 112: function 'malloc' implicit declaration
filtre.c:55: warning 112: function 'malloc' implicit declaration
filtre.c:46: error 101: too many parameters
filtre.c:46: error 47: indirections to different types assignment
from type 'void'
to type 'int generic* generic* auto'
filtre.c:48: error 101: too many parameters
filtre.c:48: error 47: indirections to different types assignment
from type 'void'
to type 'int generic* fixed'
filtre.c:49: error 101: too many parameters
filtre.c:49: error 47: indirections to different types assignment
from type 'void'
to type 'int generic* generic* auto'
filtre.c:51: error 101: too many parameters
filtre.c:51: error 47: indirections to different types assignment
from type 'void'
to type 'int generic* fixed'
filtre.c:53: error 101: too many parameters
filtre.c:53: error 47: indirections to different types assignment
from type 'void'
to type 'int generic* generic* auto'
filtre.c:55: error 101: too many parameters
filtre.c:55: error 47: indirections to different types assignment
from type 'void'
to type 'int generic* fixed'

 

So , the c compiler cannot generate the prog.psm for Picoblaze because there is some librairies and functions there is some libraries and functions which cannot support.

 

I want to know is there another way or solution to run c applications on PicoBlaze ?a

 

Thanks in advance.

 

 

0 Kudos
nikoiv
Visitor
Visitor
13,241 Views
Registered: ‎09-04-2009

The PicoBlase assembler is not so difficult. Try to use it!

0 Kudos
makni
Adventurer
Adventurer
13,226 Views
Registered: ‎12-26-2013

Hi,

 

do you mean that i should use the kcpsm3 assembler : Writing the assembly program manually with a text editor  and save it under the name prog.psm to be compiled with kcpsm3.exe?

0 Kudos
nikoiv
Visitor
Visitor
13,217 Views
Registered: ‎09-04-2009

Hi,

My advice is to use KCPSM6.exe.

Sucsess!

 

0 Kudos
vanmierlo
Mentor
Mentor
13,198 Views
Registered: ‎06-10-2008


@makni wrote:

filtre.c:46: warning 112: function 'malloc' implicit declaration

filtre.c:48: warning 112: function 'malloc' implicit declaration
filtre.c:49: warning 112: function 'malloc' implicit declaration
filtre.c:51: warning 112: function 'malloc' implicit declaration
filtre.c:53: warning 112: function 'malloc' implicit declaration
filtre.c:55: warning 112: function 'malloc' implicit declaration 


Even if the PBCC compiler could compile your code, you still would have little chance to get it working if you intend to use malloc(). Malloc is for allocating large chunks of memory and the 'pico' in picoblaze indicates it has very, very little memory.

 

Maarten

0 Kudos
makni
Adventurer
Adventurer
13,158 Views
Registered: ‎12-26-2013

Hi everybody,

 

I want to know if there is a commercial version of Picoblaze with an official compiler c because I found a lot ofproblems with the free compiler PBCC.

 

Thanks in advance.

0 Kudos
eilert
Teacher
Teacher
3,092 Views
Registered: ‎08-14-2007

Hi,

the Picoblaze-Architecture is not meant to support all the features of todays high level languages.

The existence of C-compilers can be explained when you look at C like it was in it's very(!) begining: A convenient macro assembler.

Don't expect more from these tools when used with the Picoblaze.

 

 

You are trying to apply library functions.

These are not part of the language itself, even if they are now standardized language extensions and most progams of today don't work without these functions.

 

So for the very special picoblaze architecture a new implementation of the C stdlib would be required.

However, due to the many limitations of the generic picoblaze (without own extensions) this would be a very useless approach.

e.g. malloc. What do you want to allocate if there are just 64 Bytes of scratchpad-RAM. Space for scalar variables?

 

If you really need to implement some C coded algorithm, you better look for some full grown microprocessor IP, even if it is just an 8-Bit device. In the Xilinx IP library you also find the Microblaze-MCS, which is a predefined microblaze system, that allows small applications to use the 32-bit power of the microblaze.

Still, your first step should be to analyze your code to determine the requirements for the embedded processing system.

Then you can choose from a wide variety of free and commercial IP.

 

Have a nice synthesis

  Eilert

 

 

0 Kudos