Does anyone have a copy of MPLAB or XC8 -- AVR includes? - Page 1
Forum section: electronics / general

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 19, 2022, 08:14:22 am
content: Specifically whatever they're using for avr-libc, because AVR-DA isn't supported by any version that exists on the internet.(And no, I'm not installing that pig just to grab a few hundred bytes of plain text, that's asinine.)Tim

author: oPossum
author_rank: Super Contributor
timestamp: February 19, 2022, 08:44:28 am
content: attached

author: cv007
author_rank: Frequent Contributor
timestamp: February 19, 2022, 09:02:10 am
content: https://packs.download.microchip.com/These are zip files so just rename it, open it and find what you wanted.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 19, 2022, 11:19:07 am
content: Appreciate the effort, but those are io headers, not avr-libc. You know, inc/ and inc/avr/*.h, other than io*.h's.Tim

author: TomS_
author_rank: Frequent Contributor
timestamp: February 19, 2022, 11:31:46 am
content: Have you looked at the github repository of avr-libc?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 19, 2022, 12:01:49 pm
content: They don't Github, officially speaking:http://svn.savannah.gnu.org/viewvc/avr-libc/trunk/avr-libc/Most of it around 6 years old.There's an updated fork here:https://github.com/stevenj/avr-libc3but again no AVR-DA.Tim

author: oPossum
author_rank: Super Contributor
timestamp: February 19, 2022, 12:23:09 pm
content: Why would libc headers need to be changed for DA???More stuff attached.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 19, 2022, 06:56:29 pm
content: Compare sleep.h, old (from line 140):Code:/* Define an internal sleep control register and an internal sleep enable bit mask. */#if defined(SLEEP_CTRL)/* XMEGA devices */#define _SLEEP_CONTROL_REG SLEEP_CTRL#define _SLEEP_ENABLE_MASK SLEEP_SEN_bm...new:Code:/* Define an internal sleep control register and an internal sleep enable bit mask. */#if defined(SLEEP_CTRL)/* XMEGA devices */#define _SLEEP_CONTROL_REG SLEEP_CTRL#define _SLEEP_ENABLE_MASK SLEEP_SEN_bm#define _SLEEP_SMODE_GROUP_MASK SLEEP_SMODE_gm#elif defined(SLPCTRL)/* New xmega devices */#define _SLEEP_CONTROL_REG SLPCTRL_CTRLA#define _SLEEP_ENABLE_MASK SLPCTRL_SEN_bm#define _SLEEP_SMODE_GROUP_MASK SLPCTRL_SMODE_gm...AVR-DA are xmega2 core, but don't have the same registers. Old headers get the error (on usingsleep_enable():Code:main.c|237|error: 'MCUCR' undeclared (first use in this function); did you mean 'MCU'?|which occurs because the above #if-else falls through to the default (!defined(__DOXYGEN__)) case.Oh interesting, stdlib.h doesn't define itoa family. Easy enough to fix.That does it, thanks!Edit: Let it be known, I have stumped the internet at large. Searching for "_SLEEP_SMODE_GROUP_MASK" as a keyword turns up only:https://www.avrfreaks.net/forum/attiny104-power-down-mode-and-external-interruptwhich, as far as Google knows, is the only example in the entire internet (or, second once this post gets indexed shortly).Tim

author: cv007
author_rank: Frequent Contributor
timestamp: February 19, 2022, 10:28:33 pm
content: Some of these things you are better off dealing with yourself. A few lines of code, stick it a header, and you are all set. No need for a library to do all this for you.Code://Slp.h#include <avr/io.h>typedef enum { SLP_IDLE, SLP_STANDBY, SLP_PDOWN } slp_t;static inline void slp_sleep(slp_t e){SLPCTRL.CTRLA = (e<<1)|1;sei();asm("sleep");SLPCTRL.CTRLA = 0;}Compare what you then get-slp_sleep( SLP_PDOWN );vs what libc will make you do, if you can figure out what all the macros are up to.