8051 >> HI-TECH C PRO for the Silicon Labs 8051 MCU Family

Pages: 1
pavan01
Tester
***

Reged: Apr 11 2008
Posts: 16
Loc: India
Linking Problem
      #58772 - Wed May 28 2008 03:25 AM

My project is compiled successfully but there are some linking problem and i m not able to solve them.

>C51.exe --chip=c8051f410 --OUTPUT=eomf
51 main.obj
HI-TECH C 51-Pro Pro beta build 2241 V9.70
Copyright (C) 1984-2008 HI-TECH SOFTWARE
licensed for evaluation purposes only
this licence will expire on Tue, 03 Jun 2008
(1269) there are 6 days left until this licence will expire (warning)
: 0: (491) can't find 0x41B words for psect "ramxdata" in segment "XDATA"
: 0: (499) undefined symbol:
__ctype_(main.obj)


(908) exit status = 1
==========================

Project is successfully compiled and linked for SDCC compiler.And the memory map is :

Stack starts at: 0x27 (sp set to 0x26) with 217 bytes available.

Other memory:
Name Start End Size Max
---------------- -------- -------- -------- --------
PAGED EXT. RAM 0 256
EXTERNAL RAM 0x0000 0x0628 1577 2048
ROM/EPROM/FLASH 0x0000 0x7745 30534 32000


Post Extras: Print Post   Remind Me!   Notify Moderator  
clydeAdministrator
HI-TECH team member
*****

Reged: Oct 16 2003
Posts: 633
Re: Linking Problem [Re: pavan01]
      #58802 - Wed May 28 2008 07:17 AM

Can you either post the source code here or send it to support@htsoft.com and we will have a look at it.

Post Extras: Print Post   Remind Me!   Notify Moderator  
pavan01
Tester
***

Reged: Apr 11 2008
Posts: 16
Loc: India
Re: Linking Problem [Re: clyde]
      #58812 - Wed May 28 2008 08:03 AM

We may not be able to share the source code, but it works well with SDCC and is working code. The same is ported for HiTech, although HiTech documentation is quite poor or not up to date and no example code available.

Post Extras: Print Post   Remind Me!   Notify Moderator  
clydeAdministrator
HI-TECH team member
*****

Reged: Oct 16 2003
Posts: 633
Re: Linking Problem [Re: pavan01]
      #58872 - Wed May 28 2008 07:19 PM Attachment (52 downloads)

Ok, if we can't see source code, we may be able to help if you can post the link map.

The error regarding the __ctype_ symbol is due to an error in the ctype.h file (in the include/ directory). I've attached a fixed version.

The error in finding space for the ramxdata psect may be that you have an initialized array that should be qualified "const" so that it is placed in ROM. The ramxdata psect contains non-constant initialized data, e.g. in this example:
Code:

int in_ram[] = {1,2,3,4};

const in_rom[] = { 5, 6, 8};


The first array will have a copy of the data in ROM, which is copied to RAM at startup. The second array will be placed only in ROM, and accessed directly from there. I believe that in other compilers you have to use a non-standard keyword ("code") to achieve the same result.

Clyde


Post Extras: Print Post   Remind Me!   Notify Moderator  
pavan01
Tester
***

Reged: Apr 11 2008
Posts: 16
Loc: India
Re: Linking Problem [Re: clyde]
      #58882 - Thu May 29 2008 02:01 AM

Thanx
The problem was due to large data defined in Code area using "Code" keyword.
Now the code is compile and linked successfully.But there is a problem with the expression

Code:

BYTE *pRTCPtr;
far DWORD g_dwRTCTicks; // 4 Bytes Variable
far BYTE g_byRTCTime[6];// RTC Timer Data Value Array

pRTCPtr = (BYTE*)&g_dwRTCTicks; // 4 Byte RTC Time Ticks in seconds
pRTCPtr[0] = g_byRTCTime[2];
pRTCPtr[1] = g_byRTCTime[3];
pRTCPtr[2] = g_byRTCTime[4];
pRTCPtr[3] = g_byRTCTime[5];



The compiler generates the message

RTC.c: 315: (712) can't generate code for this expression
RTC.c: 316: (712) can't generate code for this expression
RTC.c: 317: (712) can't generate code for this expression
RTC.c: 318: (712) can't generate code for this expression

The above line numbers shows are for same code as listed above and if I comment these lines, the code gets compiled and linked OK.


Post Extras: Print Post   Remind Me!   Notify Moderator  
pavan01
Tester
***

Reged: Apr 11 2008
Posts: 16
Loc: India
Re: Linking Problem [Re: pavan01]
      #59102 - Sat May 31 2008 10:24 AM

Well the Code is compiled now successfully after struggling for proper documentation and sample code. But still the code does not execute as expected, it appears that large number of variables initialization takes up too much time that watchdog triggers by that time. I tried to had powerup.as module to disable watchdog but seems it did not work or may be I am not doing the correct steps.

Here is the ASM file for powerup.as
Code:
 
PSECT text,class=CODE

GLOBAL powerup,Init_Device
PSECT text

powerup:
jmp Init_Device

PCA_Init:
anl 0D9h, #0BFh
mov 0D9h, #000h
ret

Voltage_Reference_Init:
mov 0D1h, #017h
ret

Port_IO_Init:
mov 0F2h, #0F0h
mov 0A4h, #0D5h
mov 0A5h, #070h
mov 0A6h, #0FFh
mov 0D5h, #00Fh
mov 0E1h, #003h
mov 0E2h, #040h
ret

Init_Device:
lcall PCA_Init
lcall Voltage_Reference_Init
lcall Port_IO_Init
ret


Could not find the interface for external startup routine.

Code size after compilation is around 40% less as compared with SDCC but first I need to test if everything work fine or not.

Overall here are my observations about the compiler

1. If a C file does not have function main() the compiler crash every time.
2. Manual says memory model can be Small, Medium and Huge but Compiler Supports only Small & Huge
3. We can not specify inappropriate memory model using command line option, it is selected automatically and if Huge model is specified where small can work, there are many syntax errors thrown by the compiler, instead of showing the exact problem.
4. There is no Interrupt Vector Table Translation, each ISR is required to have actual Jump Address to be specified.
5. If a pointer is used to point Code area, the same can not be used to point external RAM area, compiler gives Error.
6. User Startup interface not defined clearly, how to have application specific code before main().
7. SiLabs IDE 3.31 interface does not like to have project defined due to reason 1 as above or may be more, but works with batch file and takes too long time for compilation. Yet to check if Debug works or not.


Finally now compiler is also going to expire in 1-2 days, let me know if I should drop it here.


Regards
Pavan


Post Extras: Print Post   Remind Me!   Notify Moderator  
clydeAdministrator
HI-TECH team member
*****

Reged: Oct 16 2003
Posts: 633
Re: Linking Problem [Re: pavan01]
      #59722 - Thu Jun 05 2008 03:05 AM

Thanks for the detailed feedback - I will respond to the particular points shortly. The expiry date of the beta serial number has been extended to the end of July, by which time the compiler will be released. Beta testers who provided feedback will be rewarded when the compiler is released.


Regards, Clyde


Post Extras: Print Post   Remind Me!   Notify Moderator  
pavan01
Tester
***

Reged: Apr 11 2008
Posts: 16
Loc: India
Re: Linking Problem [Re: clyde]
      #60722 - Thu Jun 12 2008 01:45 AM

>Further update on the same
>
>Application seems working OK, if we reduce the size of powerup.as and
>add "org 00h", so that it can fit into Power ON Reset ISR space.
>
>psect text,class=CODE
>global powerup,start1
>org 00h
>
>powerup:
>
> anl 0D9h, #0BFh
> mov 0D9h, #000h
> jmp start1

Ah, it looks like the powerup file is not correct.

Change the top line to be:

psect powerup,class=CODE

and then you can make the file as long as you want, and you do not need to add the ORG directive, i.e. leave the rest of the file as it was originally.

To confirm it all works, you can look at the startup.as file, after issuing a --runtime=+keep option. You should see it jump to powerup.

I'll get this change implemented for the next release.

Jeff.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
1 registered and 0 anonymous users are browsing this forum.

Moderator:  Andrew L, clyde, Brent W, jeff, dave g, meisty, josh stevo 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 1720

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5