TINY OS CODE FOR ATMEGA 2560

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

I need fully funtional and well commented running Operating System for Atmega 2560.It should tiny not very complicated. I need to perform toggling of LEDs through it.

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

Welcome to AVRFreaks!

 

Should it be /by what default/ C, C++, ASM or what else language, please.

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

Welome to AVR Freaks!

 

One rarely needs an "operating system" for an 8-bit micro. Flashing LEDs is pretty simple and few would bother with an operating system for that. If you insist on some kind of operating system, then you want to look for an RTOS. There are some moderately useful (and free) ones out there. In fact, one of the more popular ones is FreeRTOS.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Jul 31, 2021 - 06:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My basic need is to run Micro Linux on AVR Atmel 2560 through programming/coding via Atmel/Microchip Studio.Kindly help me throughout via proper procedure as I am a newbie in this field.

Thanks !

ENGR ABDULLAH 

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

It Should Be in C.

Thanks! 

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

The smallest Linux distro I've found is "Tiny Core" and "At 11MB for a text console" I don't see it running on a 2560.

Happy Trails,

Mike

JaxCoder.com

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

abdullahnasir wrote:
My basic need is to run Micro Linux on AVR Atmel 2560

Perhaps this will help: https://bit-tech.net/news/tech/c...

or this: https://hackaday.com/2012/03/28/...

all seem to point to the first link: http://dangerousprototypes.com/f...

 

Good luck!

 

 

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

 

Last Edited: Sat. Jul 31, 2021 - 01:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
Perhaps this will help: https://bit-tech.net/news/tech/c...

 

But have you really achieved anything?

 

While it works, the result isn't exactly a speed demon: Grinberg has timed the boot process at around two hours to reach the BASH shell - something an average netbook can achieve in around two seconds - and a further four hours to load the rest of the operating system. 'Starting X [the graphical user interface] takes a lot longer,' Grinberg adds.

Happy Trails,

Mike

JaxCoder.com

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

abdullahnasir wrote:
My basic need is to run Micro Linux on AVR Atmel 2560 through programming/coding via Atmel/Microchip Studio

This doesn't sound much like a Product Requirement; a bit more like a school/university assignment perhaps.

Just so that we freaks know the background - is this an academic exercise (or even a "for fun" exercise) ?

 

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

in #1, abdullahnasir wrote:
I need fully funtional and well commented running Operating System for Atmega 2560.It should tiny not very complicated.

As others have said, there is really no need for any OS at all for blinking LEDs,  so your requirements can easily met with no operating system at all - it doesn't get any less complicated than that, and it will be fully functional and well commented!

 

in #4, abdullahnasir wrote:
My basic need is to run Micro Linux

Is that a specific product, or do you just mean "a very small Linux" ?

 

 

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

"Dare to be naïve." - Buckminster Fuller

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

Alternatives include LiteBSD and RetroBSD (PIC32MZ, PIC32MX)

 

Home · sergev/LiteBSD Wiki · GitHub

start - RetroBSD

 

"Dare to be naïve." - Buckminster Fuller

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

gchapman wrote:
If the answers are no and no then an event framework.

even that sounds overkill for just blinking LEDs ?

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

May I ask about the statement:

My basic need is to run Micro Linux on AVR Atmel 2560

Where did this requirement come from? Did someone tell you that you MUST do this? Did someone tell you that you SHOULD do this? Did you read, somewhere, that it is a GOOD IDEA? Or, is it something that you think will help you?

 

Let me describe an application that I know. I sell data logging accelerometers. The MCU is Mega328. Here is what it does (in no particular order)

 

(1) monitors states of reed switches that control its operation

 

(2) controls three red/green LEDs that display operating status (uses some complex flash patterns)

 

(3) maintains a real-time clock (second, minute, hour, day, month, year)

 

(4) reads data (6 bytes) from an acceleration sensor IC every 10ms

 

(5) filters, processes, and formats the data (into CSV format for spreadsheet analysis)

 

(6) monitors battery health with the built-in analog/digital converter

 

(6) Writes the data, including clock and battery, in a microsoft-compatible disk format to a microSD memory card

 

That is a pretty fantastic set of things that it does, no? But, let me tell you a secret. There is no OS! Not even an RTOS! And it does all that in 32K of program space. Written in C. Am I a super programmer who can do great things with almost nothing? NO! My skills are actually pretty mediocre.

 

SO, if your task is to flash some LEDs, Linux, of any size or flavor, is a gross overkill. Even an RTOS is overkill. Even a Mega2560 is overkill. Odds are that you could do that with a Tiny chip and less (and maybe a LOT less) than 8K of memory. Perhaps, all of this is an attempt to avoid learning C because you only know python, or something like that? Hint: you will spend far more time and energy trying to get your high level OS to be useful than would ever be required to learn the differences between what you do know and C or C++.  My recommendation is to take a little time and really (I mean REALLY) rethink what you are trying to do and how you need to do it.

 

Somewhat as a post-script, it is pretty common for folks who have never worked with 8-bit micro hardware to grossly under-estimate or over-estimate what one of these things can do. And, it is also pretty common to badly estimate the programming requirements. For that matter, its hard for many of us with experience. For example, flashing an LED barely takes 10 or 15 lines in C or double that in assembler (or less); and, if you add "flash LED" to an existing running program, it might easily take only 3 or 4 lines. 

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Jul 31, 2021 - 09:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No one mentioned my tutorial thread? ;-(

 

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

 

Of those I'd maybe suggest FreeRTOS simply because it's so widely used for AVR and the documentation happens to explain exactly how the AVR version works!

 

But by "micro Linux" do you actually mean "an application operating system" - that is something like Windows or Linux that actually lets you run multiple "programs" (not just threads) at once ? Most RTOS for micrcontrollers like AVR are simply for letting you split the "periphearl support" (drivers?) into multiple threads of execution.

 

On the whole it's only worth adding the complexity and overhead of an "OS" to a micro when you get above something like 32K-64K of binary.

Last Edited: Mon. Aug 2, 2021 - 09:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm sure OP means μClinux

http://www.uclinux.org/ is unresponsive.

 

However I cannot imagine even in my wildest dreams that this will run on an 8-bit micro. The 64K SRAM address space of AVR is surely just too small.

 

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

N.Winterbottom wrote:
http://www.uclinux.org/ is unresponsive.

Seems it was dead 4 years ago: https://www.reddit.com/r/embedded/comments/79wq1j/what_happened_to_uclinux/ and, even then, "it hasn't been in active development in a while"

 

I cannot imagine even in my wildest dreams that this will run on an 8-bit micro

Indeed: Looking at the list of Supported Architectures, nothing seems to in the AVR league:

 

https://en.wikipedia.org/wiki/%CE%9CClinux#Supported_architectures

 

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

clawson wrote:
FreeRTOS ... it's so widely used for AVR

Is it ?

 

I guess of the AVR systems which use an (RT)OS it may well be the most common choice  - but is it actually "widely used" in terms of AVRs in general?

 

Genuine question - I have no data.

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

Andy just try a search for "Freertos" on Freaks and see how many hits you get. Now try the same with any other RTOS for AVR you may happen to choose (see my Tutorial list). I bet FreeRTOS wins!

 

As for uCLinux. There's no way something like that would work for AVR. It's still an "application OS" and it will want to load programs into RAM (which even a 2560 does not have much of). The only difference between ucLinux and "real Linux" is that it is for DRAM based CPUs but ones that do not contain an MMU (so that basically meant ARM7 rather than ARM9 in the era it dates from). I used it in an ARM7+DSP project once. It is something I would not want to repeat. Because there is no memory virtualisation anything that deals with real memory addresses has to have statically assigned locations. While the code is usually OK as it is built -pic the RAM layout for data is another thing.

 

If the project eventually "died" I can't say I'm really surprised. There's so many ARM9 or Cortex-A CPUs to choose from these days that if you want true Linux with MMU you can easily pick a CPU with MMU.

 

(in our case we wanted access to a DSP co-processor so the ARM7 was a fixed choice but one of our software suppliers said "we only dal in Linux" - hence exploring ucLinux).

 

EDIT: ah yes, reading https://en.wikipedia.org/wiki/%C... reminds me it was specifically done for the Motorola DragonBall. I think it was the ADI Blackfin we were hoping to use it on. That page also says it was integrated into the Linux mainline which is presumably why it no longer exists as a separate entity ?

Last Edited: Mon. Aug 2, 2021 - 11:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Forget the liniux/os complexity...use something useable and efficient...a state machine.

 

Have you looked at those???---do so today and sleep better. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

clawson wrote:
Andy just try a search for "Freertos" on Freaks and see how many hits you get. Now try the same with any other RTOS for AVR you may happen to choose (see my Tutorial list). I bet FreeRTOS wins!

Yes, that is the "of the AVR systems which use an (RT)OS it may well be the most common choice"

 

By my real question is whether using FreeRTOS is actually widespread amongst AVR projects in general.

 

My feeling is that using FreeRTOS (or, in fact, any RTOS)  is actually rare amongst AVR projects. 

 

IOW, FreeRTOS may be the biggest fish - but it's a very small pool.

 

That feeling is borne-out by the likes of #3 & #14 & #20 - which tends to be the general response to such questions - but I have no solid data.

 

 

PS

 

I had an enquiry earlier this year about someone wanting to use what they called "Free Artos" - I guess that must be the pirate version ... ?

 

laugh

 

EDIT

 

Added #20

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: Mon. Aug 2, 2021 - 12:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
μClinux
copied from that

Since version 2.5.46 of the Linux kernel, the major parts of μClinux have been integrated with the mainline kernel for a number of processor architectures.[4]

EmCraft Systems has patches up to Linux 4 and is partnered with Microchip Technology (Arm Cortex-M on FPGA)

N.Winterbottom wrote:
The 64K SRAM address space of AVR is surely just too small.
Enough for a MicroPython though XMEGA AVR has the 16MB address spaces (program and data) and an SDRAM controller (ATXMEGA128A1U)

 


GitHub - EmcraftSystems/linux-upstream: Emcraft BSPs ported to mainline Linux tree, versions 4.2, 4.5, 4.9.51 and 4.9.88

Linux for Cortex-M: STM32, LPC, Kinetis, and SmartFusion - Emcraft Systems

 

Python for the 8bit AVR mocrocontroller · Issue #3699 · micropython/micropython · GitHub

https://github.com/slavaza/micropython-avr8 (ATmega2560)

 

"Dare to be naïve." - Buckminster Fuller

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

I argued in #14 that there is hardly any reason for an OS, even an RTOS, in the "flash LED" application that the OP described. For a program-executing OS, forget about it. Given the Harvard architecture of AVRs and the fact that there are ONLY two independently loadable sections, the entire OS would have to be reloaded every time the code changes. Imagine a string that contained "gub" instead of "gun"... reload an entire OS to change one text character?

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

My basic need is to run Micro Linux on AVR Atmel 2560 through programming/coding via Atmel/Microchip Studio.

Well, that hardly sounds like a basic need.. .what is it you are doing that requires such a resource?  Maybe general interests? Blinking an led is hardly a strong reason!

Perhaps setting a bunch up in separate threads, but even that can be handled many other ways.   

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

ka7ehk wrote:

Imagine a string that contained "gub" instead of "gun"... reload an entire OS to change one text character?

 

Oh, this is a holdup?

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

Were we trolled?

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Another user that signs up then barely communicates, other than mostly nonsense.

Maybe it makes perfect sense to them! They take what they need & turn in their assignment!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!