Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. AVR Assembler article

AVR Assembler article

Scheduled Pinned Locked Moved The Lounge
comquestion
33 Posts 13 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dougy83

    Most of the Arduino boards use a processor with 32kB flash ('328, or '32), and all use C++ for 'wiring' code http://arduino.cc/en/Products.Compare[^]

    Mike HankeyM Offline
    Mike HankeyM Offline
    Mike Hankey
    wrote on last edited by
    #20

    A lot of hobbyists use the Arduino IDE which has a lot of C++ code and I don't use it so haven't delved to deep in it. But most people that use it seriously use Asm or C for production!

    VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

    1 Reply Last reply
    0
    • R R Erasmus

      I'm working on AVR so wouldn't mind you posting on it. But whether anyone else would be interested on CP I don't know.

      "Program testing can be used to show the presence of bugs, but never to show their absence." << please vote!! >>

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #21

      Submitted it yesterday AVR Assembler 101[^] Didn't realize so many people on CP were interrested or worked on AVR.

      VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

      1 Reply Last reply
      0
      • Mike HankeyM Mike Hankey

        Does this subject appeal to the masses here?, and would anyone be interested in it? I have it on my site and it gets a lot of hits but don't know if it would be an interesting addition here.

        VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

        L Offline
        L Offline
        L e g i 0 n
        wrote on last edited by
        #22

        count me up as interested :)

        Mike HankeyM 1 Reply Last reply
        0
        • L L e g i 0 n

          count me up as interested :)

          Mike HankeyM Offline
          Mike HankeyM Offline
          Mike Hankey
          wrote on last edited by
          #23

          Done! AVR Assembler 101[^]

          VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

          L 1 Reply Last reply
          0
          • Mike HankeyM Mike Hankey

            It's hard to get people to change I've been in a couple of positions where I've pushed C++ even to the point of writing a framework, giving classes and such but they were set in there ways and I finally just did my own thing and left them to there's. I'm using the ATMega1280 and ATMega2560 boards for my C++ projects and the have 128K and 256K flash memory respectively so there's no "limited memory" excuse and since C++ runs just about as fast as C that shouldn't be a problem. The IDE has finally started to support it and I've been writing a lot of libraries in C++.

            VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

            B Offline
            B Offline
            Bitbeisser
            wrote on last edited by
            #24

            Mike Hankey wrote:

            I'm using the ATMega1280 and ATMega2560 boards for my C++ projects and the have 128K and 256K flash memory respectively so there's no "limited memory" excuse and since C++ runs just about as fast as C that shouldn't be a problem. The IDE has finally started to support it and I've been writing a lot of libraries in C++.

            The "memory problem" rather lies in the fact that even on a Mega2560, you still have only 8KB of RAM. So you have to still be fairly conscious about any dynamic memory allocation (avoid virtual methods at all cost) on top of the fact that AVR MCUs are prone to lock up on heavy memory fragmentation... And the Arduino IDE was always using C++, the "sketch" that you write is nothing more than an include file for a main() file wrapper and the "Arduino language" isn't actually more than using methods of the default libraries (which in turn are written in C++). After all, the compiler underneath is nothing more than a AVR targeted GCC (ok, there's now a ARM option to support the Due and Intel has their own version of the IDE to support the x86 in their Galileo board). Ralf ;)

            Mike HankeyM 1 Reply Last reply
            0
            • B Bitbeisser

              Mike Hankey wrote:

              I'm using the ATMega1280 and ATMega2560 boards for my C++ projects and the have 128K and 256K flash memory respectively so there's no "limited memory" excuse and since C++ runs just about as fast as C that shouldn't be a problem. The IDE has finally started to support it and I've been writing a lot of libraries in C++.

              The "memory problem" rather lies in the fact that even on a Mega2560, you still have only 8KB of RAM. So you have to still be fairly conscious about any dynamic memory allocation (avoid virtual methods at all cost) on top of the fact that AVR MCUs are prone to lock up on heavy memory fragmentation... And the Arduino IDE was always using C++, the "sketch" that you write is nothing more than an include file for a main() file wrapper and the "Arduino language" isn't actually more than using methods of the default libraries (which in turn are written in C++). After all, the compiler underneath is nothing more than a AVR targeted GCC (ok, there's now a ARM option to support the Due and Intel has their own version of the IDE to support the x86 in their Galileo board). Ralf ;)

              Mike HankeyM Offline
              Mike HankeyM Offline
              Mike Hankey
              wrote on last edited by
              #25

              Bitbeisser wrote:

              The "memory problem" rather lies in the fact that even on a Mega2560, you still have only 8KB of RAM

              Agreed but that is always a consideration no matter what language you are using.

              Bitbeisser wrote:

              (avoid virtual methods at all cost)

              Why? It just uses a virtual table right? I tend to stay away from doing to much dynamic allocation because as you say memory does get fragmented easily and the memory management sucks.

              VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

              B 2 Replies Last reply
              0
              • Mike HankeyM Mike Hankey

                Bitbeisser wrote:

                The "memory problem" rather lies in the fact that even on a Mega2560, you still have only 8KB of RAM

                Agreed but that is always a consideration no matter what language you are using.

                Bitbeisser wrote:

                (avoid virtual methods at all cost)

                Why? It just uses a virtual table right? I tend to stay away from doing to much dynamic allocation because as you say memory does get fragmented easily and the memory management sucks.

                VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                B Offline
                B Offline
                Bitbeisser
                wrote on last edited by
                #26

                Mike Hankey wrote:

                Bitbeisser wrote:

                The "memory problem" rather lies in the fact that even on a Mega2560, you still have only 8KB of RAM

                Agreed but that is always a consideration no matter what language you are using.

                But with C++ and the craze of a lot of people to inherit the heck out of it, it is much more likely becoming a problem as it isn't as obvious how much RAM a certain object/method is using...

                Mike Hankey wrote:

                Bitbeisser wrote:

                (avoid virtual methods at all cost)

                Why? It just uses a virtual table right?

                Correct. And where do you think those VMTs are created? Ralf

                Mike HankeyM 1 Reply Last reply
                0
                • B Bitbeisser

                  Mike Hankey wrote:

                  Bitbeisser wrote:

                  The "memory problem" rather lies in the fact that even on a Mega2560, you still have only 8KB of RAM

                  Agreed but that is always a consideration no matter what language you are using.

                  But with C++ and the craze of a lot of people to inherit the heck out of it, it is much more likely becoming a problem as it isn't as obvious how much RAM a certain object/method is using...

                  Mike Hankey wrote:

                  Bitbeisser wrote:

                  (avoid virtual methods at all cost)

                  Why? It just uses a virtual table right?

                  Correct. And where do you think those VMTs are created? Ralf

                  Mike HankeyM Offline
                  Mike HankeyM Offline
                  Mike Hankey
                  wrote on last edited by
                  #27

                  I guess my point is in my Init method I create say an CSpi object and use it for the lifetime of the run I don't create and destroy every time I use it. I agree when you're working with limited resources of any kind you need to be conscious of what you're doing but I believe the price is worth it for the extra benefit gained from C++. I believe we're saying the same thing!

                  VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                  1 Reply Last reply
                  0
                  • Mike HankeyM Mike Hankey

                    Does this subject appeal to the masses here?, and would anyone be interested in it? I have it on my site and it gets a lot of hits but don't know if it would be an interesting addition here.

                    VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                    B Offline
                    B Offline
                    BotReject
                    wrote on last edited by
                    #28

                    As a 'hobbyist' (and one who is not at all insulted by the term) I love assembly language. It is fascinating to see how computers work on a more fundamental level. I would like to see more articles on assembly language - any instruction set.

                    Mike HankeyM 1 Reply Last reply
                    0
                    • B BotReject

                      As a 'hobbyist' (and one who is not at all insulted by the term) I love assembly language. It is fascinating to see how computers work on a more fundamental level. I would like to see more articles on assembly language - any instruction set.

                      Mike HankeyM Offline
                      Mike HankeyM Offline
                      Mike Hankey
                      wrote on last edited by
                      #29

                      I love assembly language also, it has a kind of elegance to it. I don't use it as much as I use to but at least I know how. Over the years it has allowed me to get very close to the hardware I was on.

                      VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                      1 Reply Last reply
                      0
                      • Mike HankeyM Mike Hankey

                        Done! AVR Assembler 101[^]

                        VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                        L Offline
                        L Offline
                        L e g i 0 n
                        wrote on last edited by
                        #30

                        thank you

                        1 Reply Last reply
                        0
                        • Mike HankeyM Mike Hankey

                          Should be similar. Published it about 1-2 hours ago! AVR Assembler 101[^]

                          VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                          B Offline
                          B Offline
                          BotReject
                          wrote on last edited by
                          #31

                          Great! I am really looking forward to studying that over the weekend.

                          Mike HankeyM 1 Reply Last reply
                          0
                          • B BotReject

                            Great! I am really looking forward to studying that over the weekend.

                            Mike HankeyM Offline
                            Mike HankeyM Offline
                            Mike Hankey
                            wrote on last edited by
                            #32

                            Cool let me know what you think! Enjoy!

                            VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                            1 Reply Last reply
                            0
                            • Mike HankeyM Mike Hankey

                              Bitbeisser wrote:

                              The "memory problem" rather lies in the fact that even on a Mega2560, you still have only 8KB of RAM

                              Agreed but that is always a consideration no matter what language you are using.

                              Bitbeisser wrote:

                              (avoid virtual methods at all cost)

                              Why? It just uses a virtual table right? I tend to stay away from doing to much dynamic allocation because as you say memory does get fragmented easily and the memory management sucks.

                              VS2010/Atmel Studio 6.1 ToDo Manager Extension Relax...We're all crazy it's not a competition!

                              B Offline
                              B Offline
                              Bitbeisser
                              wrote on last edited by
                              #33

                              Bitbeisser wrote:

                              (avoid virtual methods at all cost)

                              Why? It just uses a virtual table right?
                               That is the point, those VT are using up (a lot!) of the valuable RAM space... Ralf

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups