Code visionAVR to ATMEL studio 7

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

Hi,

We have a code visionavr build code but in our firm we have only evaluation software we made some change and complied its successful

Major problem on the that we can't build due to size limitation on the evaluation software.

I tried to open through atmel but it show so many difference in the coding and it become error like BIT syntax is not in atmel , timer declaration is different .

so, is there any way to solve this issues please provide an ans below.

 

Regards

Mohammed saleh

Regards,
Mohammed Saleh

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

Mohammed aboo saleh wrote:

so, is there any way to solve this issues please provide an ans below.

 

You really only have two options...

 

1) Buy a full licence for Codevision or

2) Rewrite the software to use GCC's syntax.

 

1) is obviously the quicker and, as you say that you are a commercial operation, will cost less in real terms.

2) might mean going through each error (start at with the first one in the list) and changing each erroneous line of code or you might be lucky and be able to use macros to implement the CVAVR specific bits.

 

 

The key word in your post is 'evaluation'. If you are using CVAVR for real work then you should buy a licence.

 

 

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

Last Edited: Fri. Feb 14, 2020 - 08:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mohammed aboo saleh wrote:
BIT syntax is not in atmel

It is a proprietary language extension - it is not in standard 'C' at all.

 

This is always going to be the problem with relying upon proprietary language extensions.

So the question is: do you want to commit to that particular compiler, or do you want to be able to move freely to different compilers.

 

Brian Fairchild wrote:
The key word in your post is 'evaluation'. If you are using CVAVR for real work then you should buy a licence.

Indeed.

 

In many cases, it is explicitly prohibited to use the "Evaluation" version for commercial work.

 

EDIT

 

typo

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Codevision costs €150. If this is for a commercial development surely you just buy a copy then amortize that costs across the number of units you make.

 

If you do want to "port" the code to GCC with an equivalent of "bit variables" then you can do the usual struct bitfield cast onto GPIOR0 thing to achieve that:

typedef struct {
    int b0:1;
    int b1:1;
    int b2:1;
    int b3:1;
    int b4:1;
    int b5:1;
    int b6:1;
    int b7:1;
} bits_t;

#define bitreg (*(volatile bits_t *)&GPIOR0)

#define switch_var bitreg.b3
#define pump_var bitreg.b5

int main(void) {
    switch_var = 1;
    if (switch_var) {
        pump_var = 0;
    }
}

This yields the code:

0000007a <main>:

#define switch_var bitreg.b3
#define pump_var bitreg.b5

int main(void) {
	switch_var = 1;
  7a:	f3 9a       	sbi	0x1e, 3	; 30
	if (switch_var) {
  7c:	f3 99       	sbic	0x1e, 3	; 30
		pump_var = 0;
  7e:	f5 98       	cbi	0x1e, 5	; 30
	}
}

which would appear to do the trick!

Last Edited: Fri. Feb 14, 2020 - 09:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

 

bit <any name>;

 

the above syntax in code visionavr

can anyone suggest syntax for Atmel studio 7.0?                          
 

 

Regards,
Mohammed Saleh

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

 

Mohammed aboo saleh wrote:
can anyone suggest syntax for Atmel studio 7.0?      
Which bit of #4 did you not understand then? You replace:

bit <any name>;

with:

#define <any name> bitreg.bN

(N=0..7).

 

Looking at the Codevision manual it seems that:

 

so that looks like it automatically allocates N=0, N=1 in order. In my code you have to manually select N=0, N=1 etc. so this manual example would become:

#define alfa bitreg.b0
#define beta bitreg.b1

 

Last Edited: Mon. Feb 17, 2020 - 10:37 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a feeling that a combination of C++ class templates with the gcc  __COUNTER__ built in macro could replicate this, while generating optimal code. The drawback is that you go from codevision specific code to gcc specific code.