Alternative names for vocabulary research

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

I'm working on my UC3 project again in IAR EWAVR32, and I'm running into a bit of a C language vocabulary hole.

 

IAR comes with a boatload of predefined...macros? keywords?... for various registers and hardware addresses. Thing is, I don't know what they are unless I can figure them out from some other part of the code. In this instance, I'm looking for something like a free-running timer register to read from make use of a non-blocking timing operation to do serial comms with. I can supply psudo code for what I want to do, if desired. 

 

So, if there's anyone who knows anything about IAR or the specific vocabulary that might lead this horse to water where I might educate myself I would greatly appreciate it. 

 

And before anyone says it, yes I know the UC3 is basically legacy at this point, but it's what was used when the product this developed more than 10 years ago and I can't change it. 

This topic has a solution.
Last Edited: Mon. Jan 6, 2020 - 12:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Time to give their support line a call, that is what the license is all about!

 

Jim

 

 

 

 

 

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

Fair enough! 

 

Don't know what that says about me; when my first instinct is to research, second is to ask the enthusiasts, and last to contact the manufacturer. :P

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

If it's things like a timer you are looking for it will be in the datasheet - the names used in C then generally just follow the datasheet naming pattern.

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

erenard wrote:
macros? keywords?

"keywords" generally refers to parts of the programming language itself - things like 'char' and 'if' and 'switch' and 'volatile'.

 

If IAR have added any proprietary keywords as extensions to the language, these should be clearly documented in that compiler manual.

 

"macros" are just source code - you should be able to find their definitions by using the IDE's 'Go To Definition' feature - hopefully, they should be documented in the source comments.

 

As Jim, you need to contact IAR support for help with their product - that's a key part of what you pay the licence fee for!

 

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...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Sounds like you want to use the CPU Cycle Counter.  This is a 32 bit counter that increments on every CPU clock cycle and is always available (enabled by default IIRC).  It is located within a special block of registers that Atmel call "system registers" (look for documentation on these in the "Processor and Architecture" chapter of your UC3 datasheet).  These registers are accessed using the MFSR and MTSR assembly instructions (Move From/To System Register).  To use these from a C program you can use the macros provided by Atmel in file called "compiler.h".  Excerpt from compiler.h:

/* This file defines commonly used types and macros.
 *
 * - Compiler:           IAR EWAVR32 and GNU GCC for AVR32
 * - Supported devices:  All AVR32 devices can be used.
 */

 /*! \name System Register Access
 */
//! @{

/*! \brief Gets the value of the \a sysreg system register.
 *
 * \param sysreg  Address of the system register of which to get the value.
 *
 * \return Value of the \a sysreg system register.
 */
#if __GNUC__
  #define Get_system_register(sysreg)         __builtin_mfsr(sysreg)
#elif __ICCAVR32__
  #define Get_system_register(sysreg)         __get_system_register(sysreg)
#endif

/*! \brief Sets the value of the \a sysreg system register to \a value.
 *
 * \param sysreg  Address of the system register of which to set the value.
 * \param value   Value to set the \a sysreg system register to.
 */
#if __GNUC__
  #define Set_system_register(sysreg, value)  __builtin_mtsr(sysreg, value)
#elif __ICCAVR32__
  #define Set_system_register(sysreg, value)  __set_system_register(sysreg, value)
#endif

As you can see above, both the IAR and GCC compilers provide built-in intrinsics to use these instructions directly from c code.

 

Letting the smoke out since 1978

 

 

 

 

Last Edited: Fri. Jan 3, 2020 - 11:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

erenard wrote:

Fair enough! 

 

Don't know what that says about me; when my first instinct is to research, second is to ask the enthusiasts, and last to contact the manufacturer. :P

I think what the point that was being made, is that for the high price you paid for an IAR license you should use their support number rather than asking a general internet community hoping someone might know something.

But hey, its your money and were a happy lot anyway :)

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

for the high price you paid for an IAR license you should use their support number rather than asking a general internet community hoping someone might know something.

 

Meh.  Internet communities are frequently faster and friendlier that Customer Support departments.  The latter is for complaints...

 

 

If it's things like a timer you are looking for it will be in the datasheet - the names used in C then generally just follow the datasheet naming pattern.

 Yes, this.   If your compiler doesn't name things based on the datasheet, you should get a new compiler.
 

Usually, there's an additional layer of "standardization" that you'll need to figure out.   For example, Atmel mega-0 AVRs have multiple USARTs with registers named "RXDATAL" in the datasheet, and the gcc include files have both

USART0_RXDATAL, USART1_RXDATAL for an individual registers as well as USARTn structures defined so that you can use "USART0.RXDATAL"   The ARM processors have structure-based defines based on the datasheet and ARM's CMSIS specification, but each bottom-level register had a union to allow access of either the whole registers (USART0.STATUS.reg and USART0.STATUS.bit.TXE, for instance)(this seems to be an Atmel-specific thing.)

 

Note that these definitions are usually provided by the chip vendor rather than the compiler vendor, so you may not have much luck finding explanations in the compiler documentation.  Atmel/Microchip provides theoretically compiler-independent defintions via what they call "packs."

 

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

Wow, yes, this is exactly what I was looking for, thank you!

 

 

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

But the point is that if you know there's something called "RXDATAL" as mentioned in the datasheet the you can simply grep the part header (io??.h or whatever) for that symbol. You are either going to find XXXX_RXDATAL or you are going to find RXDATAL is the member of a struct and then that typdefd stuct is cast onto some UARTn or whatever so access will be UARTn.RXDATAL etc.

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

And it is exactly that level of standardization that i'm finding difficult. 

I posted a question earlier, relating to that standardization (on reflection), where they had different meanings behind capitalized and lowercase register names. 

 

The trick is discovering these special standardizations for a dying chip on a less-than-popular compiler and coding platform. 

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

clawson wrote:
You are either going to find XXXX_RXDATAL or you are going to find RXDATAL is the member of a struct

+1

 

Or, if they decide to be awkward and use a different name from the datasheet, there should at least be a cross-reference in a comment or other documentation ...

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: 0

erenard wrote:
I posted a question earlier

Here:  https://www.avrfreaks.net/forum/quick-question-conventions

 

erenard wrote:
they had different meanings behind capitalized and lowercase register names

Not sure that the "they" there was IAR - was it?

 

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

In this case, yes it was. 

 

Also,I found the register I wanted, COUNT. Though, I had to refer to it by the address (264) in the Get_system_register() function. IAR hadn't included a mapping of system registers to names.

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

erenard wrote:
standardization

As noted in the other thread, it's not much of a "standard" - more of a quirk of an off-the-beaten-track compiler on an out-of-the-way target!

 

Which brings us back  to the need to go to IAR for IAR-specifics.

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: 0

erenard wrote:

Fair enough! 

 

Don't know what that says about me; when my first instinct is to research, second is to ask the enthusiasts, and last to contact the manufacturer. :P

 

Just typical geek.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut.