Trying to compile a very old project, stuck on far pointers

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I'm pretty new to general AVR programming (have some experience with Arduino but that's it).

I'm now trying to compile a about 15 year old project where a small variation needs to happen.

I'm not sure but I guess it was compiled back then with IAR.

I have a dtp and prj file...but no idea what to do with those :)

 

When I try to compile my compiler stops on some typdefs which use far pointers (maybe there are more issues but that's the first thing he complains about).

 

typedef unsigned char U8, *P_U8, **PP_U8, far *LP_U8;
typedef signed char   S8, *P_S8;
typedef unsigned int  U16, *P_U16, far *LP_U16;
typedef int           S16, *P_S16;
typedef unsigned long U32, *P_U32, far *LP_U32;
typedef long          S32, *P_S32;
typedef enum{false, true} BOOLEAN, far *LP_BOOLEAN;

I tried to compile with the modern AIR compiler as well as with avr-gcc.

I would prefer to get it compiled with avr-gcc.

Can someone help to say me what to do maybe I can compile this?

Oh the target device is an ATMEGA103

And if I posted this in the wrong subforum -> sorry and thanks for moving it to the correct place.

 

Thanks a lot.

 

 

EDIT for now I've just removed that far pointers (may be they are not used in my project, it's in a common header).

Now stuck on

 

extern  union     {SYSREG name;U8 addr[SYSREGSIZE];} sysReg;

 

Sysreg is unknown...

 

Last Edited: Fri. Feb 19, 2021 - 03:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you have a licensed copy of IAR you really should approach them for support as the very reason you pay €3000 for that compiler is to get access to that level of support.

 

But does this program really have meg103 flash data in the upper 64K anyway (that would require pointers wider than 16 bit) ? It can't be RAM data that is out of range of normal pointers as there is only 4K and it's well within the first 64K.

 

EDIT:

Sysreg is unknown...

That's the kind of thing you really do need to ask IAR about. because of the cost we don't see many IAR users here who could advise.

Last Edited: Fri. Feb 19, 2021 - 03:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Clemens123 wrote:
I tried to compile with the modern AIR compiler as well as with avr-gcc.

Well if you have a license for IAR, I would call their support for help with this, I'm assuming the newer versions of IAR handle pointers differently, but they should be able to tell you that.

Porting from one compiler to another i.e. from IAR to GCC will require more changes and possibly take longer and require more debugging, but doable if you have the time.

Compare the cost of a renewed IAR license against the cost of your time to do the porting.

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BTW this mentions "SYSREG":

 

https://www.avrfreaks.net/forum/...

 

but that seems to suggest it is an AVR32-UC3 thing which has a "SYSREG" that is the CPU cycle counter.

 

If you are getting mentions of "SYSREG" are you sure you are building for AVR8 not AVR32 ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Clemens123 wrote:
trying to compile a about 15 year old project

Where did this project come from?

 

Can you post a link to the original project?

 

 guess it was compiled back then with IAR

On what do you base that guess?

 

Porting code from one compiler to another requires a good understanding of both compilers - probably also a good understanding of the code itself.

It is certainly far easier if you have a known-working setup to start with.

 

I have a dtp and prj file

I don't recognise them. If you think they may be IAR, you could ask IAR about them.

If they're text files, look to see if they identify what tool they're for; eg, an Atmel Studio .atsln Solution file starts with


Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1

and the .cproj file begins:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectVersion>7.0</ProjectVersion>
    <ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Feb 19, 2021 - 03:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to say that there is a 4K version of IAR for free so if you want to see if it is the thing that uses .DTP and .PRJ and also whether it admits to anything called SYSREG then one could use that even if it could not build the whole 128K code image.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Clemens123 wrote:

Now stuck on

 

extern  union     {SYSREG name;U8 addr[SYSREGSIZE];} sysReg;

 

Sysreg is unknown...

Now as I'm sure you are aware C/C++ is case sensitive. Here we have 3 different identifiers all called "SYSReg" (just to add another). This looks like something that should appear in a system header rather than user code. Can we see this in context and the exact error ?

 

I'm sure this can be solved using your favourite search engine, but we'll need good search terms.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
Here we have 3 different identifiers all called "SYSReg"

Now that rings a bell - wasn't there an AVR32 post with someone confused by exactly that ... ?

 

EDIT

 

As AVR32 posts are few and far between, it didn't take long: https://www.avrfreaks.net/commen...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Sat. Feb 20, 2021 - 12:19 AM