Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] MicroBlaze in Altium Designer

Status
Not open for further replies.

ShyLock

Junior Member level 1
Joined
Jan 7, 2012
Messages
15
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,384
Hello! I have a problem using the MicroBlaze processor in Altium Designer. I'm trying to display a bitmap file at the built-in touchscreen LCD. When I try to compile it, it gives me this error "cmb E272: ["C:\PROGRAM FILES (X86)\ALTIUM DESIGNER SUMMER 09\Library\Software Platform\platform\fpga\processors\pal\src\pal_init.c" 10/5] undeclared identifier "__clocks_per_sec""

I already did some research and Altium wiki said "MicroBlaze C library now contains the global __clocks_per_sec which is used by parts of the SoftwarePlatform." The problem is I don't know how to use the "__clocks_per_sec". I have configured the linker option on the embedded project option.

Figure 1. Openbus Architecture
openbus.PNG

Figure 2. Software Platform
swplatform.PNG

Figure 3. main.C
maincode.PNG

Hoping for a response! Thank you! =)
 

From example source of "TU0131 (capturing video the easy way):"
Code:
define LEDS
(*(unsigned char*)Base_WB_PRTIO_1)
void main(void)
{
uint32_t line;
uint32_t pixel;
pixel_t* inpixel;
pixel_t* outpixel;
uint8_t count = 0;
//Main Processor clock rate
__clocks_per_sec = 50000000; // Assuming we run at 50 MHz
//Initialize TFT display
vga16_init(& display_settings, Base_VideoDisplay, (uintptr_t) display, CLOCKS_PER_SEC,
VGA16_TFT);
/* I2C */
i2c_init(Base_I2CM_W_1);

So, seems you just have to define it.
 

it didn't work, still gives me the same error.

I also tried the following, same result:
Code:
#define CLOCKS_PER_SEC 50000000
Code:
unsigned long long __clocks_per_sec = 50000000;
Code:
clock_t *clock;
clock = 50000000;
 

There are these files:
'System\tasking\c3000\lib\src\clockspersec.c'
'System\tasking\carm\lib\src\clockspersec.c'
'System\tasking\cmb\lib\src\clockspersec.c'
'System\tasking\cnios\lib\src\clockspersec.c'
'System\tasking\cppc\lib\src\clockspersec.c'

Code:
/**************************************************************************
**                                                                        *
**  FILE        :  clockspersec.c                                         *
**                                                                        *
**  DESCRIPTION :  The __clocks_per_sec variable is used by the time      *
**                 functions to convert the value returned by clock()     *
**                 into seconds. Also used as a default by proftool.      *
**                                                                        *
**  Copyright 1996-2009 Altium BV                                         *
**                                                                        *
**************************************************************************/

#include <time.h>

#define DEFAULT_CLOCKS_PER_SEC  50000000   /* Altium Designer default: 50 MHz */

clock_t         __clocks_per_sec = DEFAULT_CLOCKS_PER_SEC;




/**************************************************************************
**                                                                        *
**  FILE        :  clockspersec.c                                         *
**                                                                        *
**  DESCRIPTION :  The __clocks_per_sec variable is used by the time      *
**                 functions to convert the value returned by clock()     *
**                 into seconds.                                          *
**                                                                        *
**  Copyright 1996-2009 Altium BV                                         *
**                                                                        *
**************************************************************************/

#include <time.h>

#define DEFAULT_CLOCKS_PER_SEC  300000000       /* default at startup: 300MHz */

clock_t         __clocks_per_sec = DEFAULT_CLOCKS_PER_SEC;




/**************************************************************************
**                                                                        *
**  FILE        :  clockspersec.c                                         *
**                                                                        *
**  DESCRIPTION :  The __clocks_per_sec variable is used by the time      *
**                 functions to convert the value returned by clock()     *
**                 into seconds. Also used as a default by proftool.      *
**                                                                        *
**  Copyright 1996-2009 Altium BV                                         *
**                                                                        *
**************************************************************************/

#include <time.h>

#define DEFAULT_CLOCKS_PER_SEC  50000000   /* Altium Designer default: 50 MHz */

clock_t         __clocks_per_sec = DEFAULT_CLOCKS_PER_SEC;



/**************************************************************************
**                                                                        *
**  FILE        :  clockspersec.c                                         *
**                                                                        *
**  DESCRIPTION :  The __clocks_per_sec variable is used by the time      *
**                 functions to convert the value returned by clock()     *
**                 into seconds.                                          *
**                                                                        *
**  Copyright 1996-2009 Altium BV                                         *
**                                                                        *
**************************************************************************/

#include <time.h>

#define DEFAULT_CLOCKS_PER_SEC_NIOS_II_e 200000000            /* 200 Mhz */
#define DEFAULT_CLOCKS_PER_SEC_NIOS_II_s 165000000            /* 165 Mhz */
#define DEFAULT_CLOCKS_PER_SEC_NIOS_II_f 185000000            /* 185 Mhz */

clock_t __clocks_per_sec = DEFAULT_CLOCKS_PER_SEC_NIOS_II_e;



/**************************************************************************
**                                                                        *
**  FILE        :  clockspersec.c                                         *
**                                                                        *
**  DESCRIPTION :  The __clocks_per_sec variable is used by the time      *
**                 functions to convert the value returned by clock()     *
**                 into seconds.                                          *
**                                                                        *
2001-2003 Altium BV
**                                                                        *
**************************************************************************/

#include <time.h>

#define DEFAULT_CLOCKS_PER_SEC  314572800       /* default at startup: 300MHz */

clock_t         __clocks_per_sec = DEFAULT_CLOCKS_PER_SEC;
 

I have all the files except for this one 'System\tasking\carm\lib\src\clockspersec.c', in that directory there is only clock.c file, i can't locate the clockspersec.c. So, I tried making a "clockspersec.c" for that folder, and tried recompiling my code, still gives me the same error message =(

I was thinking that is it possible that pal_init.c is the one having that error? Can you kindly check your 'Library\Software Platform\platform\fpga\processors\pal\src\pal_init .c', do we have the same code in it?



Code:
#include <time.h>
#include <stdbool.h>

#include <pal.h>

bool pal_init (void)
{
	/* c-library implementation */
    __clocks_per_sec = PAL_CLOCKHZ;

	if (!pal_architecture_processor_init()) {
    	return false;
    }

    if (!pal_architecture_interrupts_init()) {
    	return false;
    }

#if (__TIMERS__ > 0) && ( __POSIX_KERNEL__ == 0 )
	if (!pal_architecture_timer_interrupt_init()) {
    	return false;
    }
#endif

	if (!pal_architecture_clock_init()) {
    	return false;
    }

#if ( __POSIX_KERNEL__ == 0 )
    pal_architecture_interrupts_enable();
#endif

    return true;
}


Or have you guys tried using the MicroBlaze as your microprocessor? Did you guys encountered the same error as mine or it compiled smoothly for you guys?
 

There are two possible pal_init.c files
One, as fa as I can see, form build 22033, and another from build 22066. The 22033 seems identical to yours (have not checked it literally).

Here is the 22066:
Code:
/******************************************************************************\
|*
|*  PACKAGE:        PAL
|*
|*  DESCRIPTION:    Initialize the processor
|*
|*  COPYRIGHT:      Copyright (c) 2009 Altium
|*
\******************************************************************************/

#include <time.h>
#include <stdbool.h>

#include <pal.h>

// Software Platform init handler
void pal_init (void)
{
    /* c-library implementation */
    __clocks_per_sec = PAL_CLOCKHZ;

    pal_architecture_processor_init();

    pal_architecture_interrupts_init();

#if (__TIMERS__ > 0) && ( __POSIX_KERNEL__ == 0 )
    pal_architecture_timer_interrupt_init();
#endif

    pal_architecture_clock_init();

#if ( __POSIX_KERNEL__ == 0 )
    pal_architecture_interrupts_enable();
#endif
}

And the 22033:
Code:
#include <time.h>
#include <stdbool.h>

#include <pal.h>

bool pal_init (void)
{
	/* c-library implementation */
    __clocks_per_sec = PAL_CLOCKHZ;

	if (!pal_architecture_processor_init()) {
    	return false;
    }

    if (!pal_architecture_interrupts_init()) {
    	return false;
    }

#if (__TIMERS__ > 0) && ( __POSIX_KERNEL__ == 0 )
	if (!pal_architecture_timer_interrupt_init()) {
    	return false;
    }
#endif

	if (!pal_architecture_clock_init()) {
    	return false;
    }

#if ( __POSIX_KERNEL__ == 0 )
    pal_architecture_interrupts_enable();
#endif

    return true;
}

I have not used the MicroBlaze as microprocessor. Only one of the TSK processors (has been some time ago though).
 

yes, 22033 is identical to mine. where did you find the code for 22066, is this the upgraded version of altium designer?

my last resort will be the TSK3000, but before settling for TSK, I really wanted to know what is the cause of such error, and if possible to fix it. Anyway, thanks to all who replied, I really appreciated it. =)

if anyone still got fix ideas please do share them! thanks =)
 

where did you find the code for 22066, is this the upgraded version of altium designer?
Just part of an update, yes (not necessarily the very latest though - my update license stopped some time ago)
 

mine too >.<

I still can't find a solution to this T___T also tried:

Code:
 CLOCKS_PER_SEC 50000000;
Code:
 clock_t 50000000;

none of it works T____T
 

Maybe if you post your -full- project code, someone else might try compiling it ...
Assuming that code can be used directly -as is-, I myself might give it a try ...
 

Oh sorry, here it is. =)

Code:
#include <stdio.h>
#include <graphics.h>

#include "devices.h"

graphics_t *display;
canvas_t *canvas;

extern __no_sdata graphics_bitmap_t _lc_ub_test_bmp; // linker name for beginning of bitmap block
extern __no_sdata graphics_bitmap_t _lc_ue_test_bmp;
graphics_bitmap_t *bmp = &_lc_ub_test_bmp;

void main (void)
{
 display = graphics_open( GRAPHICS_1 );
 canvas = graphics_get_visible_canvas( display );

  graphics_draw_bitmap(canvas, bmp, 0, 0, 320, 240, 0);
  graphics_set_visible_canvas(display, canvas);

}
 

Well, I meant a --complete-- project.
I don't think single piece of code this compiles without doing additional 'work' on it (creating a project; setting it up etc).
You already shown the 'architecture'/'platform'/'code' as screendumps, which I assume are part of the project and are necessary for the correct compilation of the code.
With a complete project, which does not necessarily have to be THE project, but has to be a project that gives the same problem, other persons are more willing to help out (they then only have to put their energy in finding/solving a problem; and not in getting everything setup just to be able to compile).
 

Oh I'm sorry, I misunderstood your message earlier. Thanks for clarifying. I attached the zip file of the project. =)
 

Attachments

  • kthxbye_MicroBlaze.zip
    243 KB · Views: 52

Well yours seems to be a Summer 09 project.
I have Release 10 and I initially tried it using the Summer 09 'setting', but this failed (simply because I don't have the Summer 09 files ...)

After setting it to use Release 10, there were no problems compiling the C code.
Here is the output of the compile process:

Compiling main.c
Compiling swplatform.c
Building Software Platform
Building drv_vga_ili9320 plugin
Building per_vga32_ili9320 plugin
Building pal_arch_mb plugin
Building pal plugin
Building ad_vga_ili9320 plugin
cmb W549: ["C:\Users\Public\Documents\Altium\AD 10\Library\Software Platform\platform\fpga\processors\cmb\src\pal_cmb_interrupts.c" 140/18] condition is always false
0 errors, 1 warnings
Building graphics plugin
Building interrupts plugin


Since I don't have the Summer 09 version at hand, I'm not able to do more than attaching the files generated by compile process.
Note that in the attachment I have omitted some of the output files (all 'binary' files).

Here is an excerpt from the generated map file (see also in attachment):
Code:
**********************************************************************  Processed Files  ***********************************************************************
+-----------------------------------------------------------------------------------------------------------+
| File                                                 | From archive    | Symbol causing the extraction    |
|===========================================================================================================|
| clockspersec.obj                                     | cmba.lib        | __clocks_per_sec                 |
| pal_pal_init.obj                                     | __framework.lib | pal_init                         |



**********************************************************************  Cross References  **********************************************************************
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Definition file                | Definition section             | Symbol                               | Referenced in                                       |
|==============================================================================================================================================================|
| clockspersec.obj               | .data.libc (1547)              | __clocks_per_sec                     | pal_pal_init.obj                                    |
| pal_pal_init.obj               | .text.pal_init.pal_init (1091) | pal_init                             | init___framework_init.obj                           |


*************************************************************************  Call Graph  *************************************************************************
_START
|
+-- main
|   |
|
+-- framework_init
|   |
|   +-- pal_init
|   |   |
|   |   +-- pal_architecture_interrupts_init
|   |   |   |
|   |   |   +-- microblaze_extract_vector_table
|   |   |
|   |   +-- pal_architecture_processor_init
|   |   |
|   |   +-- pal_architecture_clock_init
|   |
|   +-- ad_vga_ili9320_init
|
 

Attachments

  • kthxbye_MicroBlazeR10.zip
    235.8 KB · Views: 65
I see I have to upgrade my Altium designer. It's a big problem, since our school only have license for Summer 09 >__< I think we have to consider using TSK3000 for now. Thank you for that! =)

I have few more questions if you don't mind, this is my first time using altium, our school didn't taught us how to use it so I have to figure it out myself.
> The output files you've mention, are those in the History folder, right? why did you omitted those files?
> I opened your attached zip, I notice there is this new swplatform.C and .H files, why my project didn't generate a swplatform.C file? Is this because of the different version of Altium we are using?
 

I omitted -some- files from the Output folder. I -completely- emptied the History folder, but this holds just old source files.
I left out some (generated) binary and hex files. The reason was their size. With these, the zipped file would have been over 1MB (more than 4 times the current size).
These files would not have had a positive contribution to the problem (only needed when actually programming the FPGA etc).
I don't know if Summer 09 and Release 10 are that different, concerning the files they generate. Swplatform.c was only generated when I used the Release 10 setup, so basically only when the compilation did not fail. It might also be generated by the Summer 09 edition if there was not that nasky problem .....

- - - Updated - - -

Well, I installed Summer 09 (release 20159) and did a compile of the project.
It did go without any problems except some warnings (see below)

Compiling main.c
Assembling main.src
Building Software Platform
Building drv_vga_ili9320 plugin
Building per_vga32_ili9320 plugin
Building pal_arch_mb plugin
Building pal plugin
Building ad_vga_ili9320 plugin
Building graphics plugin
Building interrupts plugin
Building timing plugin
Building init plugin
Building sysutils plugin
cmb W505: ["C:\PROGRAM FILES (X86)\ALTIUM DESIGNER SUMMER 09\Library\Software Platform\make\src\cmb\exit.c" 26/9] implicit declaration of function "_exit"
cmb W577: ["C:\PROGRAM FILES (X86)\ALTIUM DESIGNER SUMMER 09\Library\Software Platform\make\src\cmb\exit.c" 26/14] calling a function without a prototype
0 errors, 2 warnings
Software platform built
Linking and Locating embedded_fpga_based_communication_portal.abs

The attachement has the complete project, including the full Output directory (only History has been cleared).

- - - Updated - - -

And while we are at at.
The clockspersec.c file you had created yourself (..\crm\lib\src\clockspersec.c) -does- exist. Here is the content of the file:

Code:
/**************************************************************************
**                                                                        *
**  FILE        :  clockspersec.c                                         *
**                                                                        *
**  DESCRIPTION :  The __clocks_per_sec variable is used by the time      *
**                 functions to convert the value returned by clock()     *
**                 into seconds.                                          *
**                                                                        *
**  Copyright 1996-2008 Altium BV                                         *
**                                                                        *
**************************************************************************/

#include <time.h>

#define DEFAULT_CLOCKS_PER_SEC  300000000       /* default at startup: 300MHz */

clock_t         __clocks_per_sec = DEFAULT_CLOCKS_PER_SEC;


and pal_init.c

Code:
#include <time.h>
#include <stdbool.h>

#include <pal.h>

bool pal_init (void)
{
	/* c-library implementation */
    __clocks_per_sec = PAL_CLOCKHZ;

	if (!pal_architecture_processor_init()) {
    	return false;
    }

    if (!pal_architecture_interrupts_init()) {
    	return false;
    }

#if (__TIMERS__ > 0) && ( __POSIX_KERNEL__ == 0 )
	if (!pal_architecture_timer_interrupt_init()) {
    	return false;
    }
#endif

	if (!pal_architecture_clock_init()) {
    	return false;
    }

#if ( __POSIX_KERNEL__ == 0 )
    pal_architecture_interrupts_enable();
#endif

    return true;
}
 

Attachments

  • kthxbye_MicroBlazeR9.zip
    960 KB · Views: 51
Thanks for the clarification! =) I have switched to Altium Release 10 already. May I ask what Xilinx ISE version you're using for Altium? I'm using the 10.1 version of Xilinx, and I can't compile the project using Altium Release 10, the error said I don't have EDK installed, so I installed Xilinx 13.2 ISE Suite with EDK, but then at the devices tab, this was displayed "Unsupported version of Xilinx ISE"
 
Last edited:

Well, the error 'EDK not installed' relates to using MicroBlaze. This is part of the EDK (from Xilinx) and is not free (as far as I know).
So up/downgrading to another ISE version will not make any difference, if you don't have a license for the EDK of Xilinx.
Using a TSKxxx processor will not give these kind of problems, although you obviously still have to have a Xilinx version that Altium supports.
If I recollect it correctly, I used either ISE 10 or ISE 11.
However, the december 2011 (23272) of Altium Release 10 should support ISE 13.3 according to some release notes I came accross.
 
However, the december 2011 (23272) of Altium Release 10 should support ISE 13.3 according to some release notes I came accross.

Thanks for this, this gave me the idea to search the release note directly with the version of Altium I have right now. I just realized that Altium Release 10 have lots of sub-versions also with different compatibilities. We decided to drop the interest on MicroBlaze because of software license constraints. We will be using TSK3000 since it's easier and gives less hassle. I am going to mark this thread as solve. Thank you for your help! =)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top