How Microcontroller Memory Works | Embedded System Project Series #16

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ • 78

  • @SurvivalSquirrel
    @SurvivalSquirrel Рік тому +6

    I find the first 15 minutes to have 80% of the value of this whole video. Thanks a lot!

  • @isakneuman9995
    @isakneuman9995 Рік тому +22

    Thanks for the probability that I decided to go to UA-cam at 2 o'clock in the morning. You have such a storehouse on the channel. I will definitely watch every video and I am 10,000% sure that every video will be super useful.

  • @code4th
    @code4th Рік тому +3

    I like this kind of detailed low-level explanation. I port a ton of code from c/c++ into forth and basically have to know this stuff at a deep level. Thank you

    • @artfulbytes
      @artfulbytes  Рік тому

      Turn back, you are going the wrong way 😉😉

  • @SiamMiah-v8f
    @SiamMiah-v8f Рік тому +2

    Thanks, you put all the information I wanted into one video. The way a program is stored into the physical memory of a computer which runs a OS and has a MMU is very different to how a program is allocated to the microcontrollers memory. It was confusing to read and make sense of on my own! Thanks for uploading!

  • @abdelrahmanyasser5720
    @abdelrahmanyasser5720 Рік тому +1

    Best video ever in this topic, it gather more than what I've expected together. Thank you very much bruuuuuh

  • @fifaham
    @fifaham 7 місяців тому +1

    One of the best videos detailing the memory work, job well done - thank you.

  • @Illayarajamuruga
    @Illayarajamuruga 8 місяців тому +1

    One of the best explanations I have ever heard before. Thanks a Lot ..👏

  • @elakstein
    @elakstein 2 місяці тому +2

    Please UA-cam recommend me again, i will watch it in the future, very tired right now

  • @Jindraxx20
    @Jindraxx20 7 місяців тому

    Thank you for this great content. This explains very well how the memory is allocated !

  • @AkashModi-l1h
    @AkashModi-l1h Місяць тому

    Amazing Video. Thank you for creating this.

  • @L2.Lagrange
    @L2.Lagrange 8 місяців тому +8

    Commenting as a bookmark to watch this a few times lol

  • @jdaniel0491
    @jdaniel0491 2 місяці тому +1

    How can I learn the details of all of this information? Do you recommend a book or set of books/lectures?

  • @Arkvis10
    @Arkvis10 Місяць тому

    Incredible video❤️ very helpful! Thanks : )

  • @alexgillespie1098
    @alexgillespie1098 Рік тому

    I got interviews coming up and this video is super helpful, thx.

  • @vaishalibiswas5674
    @vaishalibiswas5674 Рік тому

    Best..all in one video🙏

  • @0xbitbybit
    @0xbitbybit 11 місяців тому

    Great stuff mate! Just got myself an MSP430 to follow along with some courses and learn about all this stuff, super excited. Just a side question, what font are you using in your terminal, when you were editing your make file? Looks great! Thanks!

    • @artfulbytes
      @artfulbytes  11 місяців тому

      That would be "Iosevka Nerd Font Mono".

  • @ArdaX95
    @ArdaX95 Рік тому +2

    Hi, thank you for your contributions your videos are really helpful. Would you consider to make a video or video series maybe on how to use unit testing on embedded systems? Thanks in advance.

    • @artfulbytes
      @artfulbytes  Рік тому

      I won't be doing it for this video series since I'm not writing any unit tests in this project, but it is a topic I would like to cover in the future.

  • @pieterboning
    @pieterboning Рік тому

    VERY useful, thank you for your videos!

  • @frankapala6979
    @frankapala6979 Місяць тому +1

    simply wow

  • @JoeBob189
    @JoeBob189 7 місяців тому

    beautifully explained, thank you!

  • @prasenjit134
    @prasenjit134 5 місяців тому

    Memory layout so well explained. What is the IDE you use?

  • @juanrodrigoguerrerozarate2602

    This video is awesome ! Thanks for the information

  • @cantaff0rd2
    @cantaff0rd2 3 місяці тому

    Nice tutorial. But why is this int a[5] = { 0xAAAA, 0xBBBB, 0xCCCC }; placed in .const and .data instead of only in .data? Is this not a variable which can be modified at runtime? As far as I know arrays are not constants like strings?
    Also why is the global int c[5] 'only part of the ram'? Isn't it both in .bss in flash and then in .bss in RAM after the startup code initializes the RAM?

    • @artfulbytes
      @artfulbytes  3 місяці тому

      RAM contains garbage after power reset. So before we get to main(), the RAM variables (variables that can be modified at runtime) must be initialized. But to do this we must know what the the initialization values should be, and that information we are store in flash. In other words, a[5] first contains garbage, but is then overwritten with the initialization values from flash (.const).
      c[5] is also stored in RAM, but it's zero-initialized, and for space-efficiency (bss sometimes called "better save space") we don't store that information in flash. Instead the zero-initialized RAM variables are simply initialized to 0.

  • @rafassm
    @rafassm 7 місяців тому

    Great video! but I have a question, in arduino when you want to burn a bootlader into a custom board (not uploading the code, just programming it) what you are doing in reality is uploading the ELF and linker script files to the MCU? I am not sure if I am misunderstanding the concepts of bootlader and those files.

    • @artfulbytes
      @artfulbytes  7 місяців тому +2

      ELF and linker scripts are not what you flash/upload, they are just intermediate files used during the compilation process that outputs the final machine code (typically a hex file). It's the final machine code (hex file) that is flashed/uploaded to the MCU with a dedicated programmer (e.g. segger-jlink, stlink). A bootloader is a small program that provides a convenient alternative interface (e.g. usb, uart, i2c , wifi, bt...) for uploading your normal application code (typically hex) without the need for a dedicated programmer. The bootloader has the same compilation process as described above and must be flashed with a dedicated programmer (technically not always true, e.g. multi-stage/self-updating bootloader).

  • @cihan1995
    @cihan1995 Рік тому

    Thanks a lot. Could you please explain boot process ?
    I also wonder, is start up code is the equivalent of boot manager and flash loader?

    • @artfulbytes
      @artfulbytes  Рік тому

      Yes this is something I could see myself doing a video about in the future. Until then, I can recommend this blog post series interrupt.memfault.com/tag/zero-to-main/. No they are not equivalent.

    • @cihan1995
      @cihan1995 Рік тому

      thank you, can you please also let me know the tools you used in this video ? I would like to repeat steps learned here on my own@@artfulbytes

    • @artfulbytes
      @artfulbytes  Рік тому +1

      @@cihan1995 The IDE is CCSTUDIO from TI with MSP430 microcontroller. Though you could repeat this with other IDEs and MCUs as well. At the end I just use the bare-bone toolchain, GCC in this case, and Make.

  • @tannguyentrong1142
    @tannguyentrong1142 5 місяців тому

    i have a question, normally, text section will lowest in flash memory , follow it is another section like data, bss,... why in your video. text section have higher address than data and bss section ?

  • @juniorlucival
    @juniorlucival Рік тому

    The variable 'i' cannot be stored in flash because flash memory does not have the ability to write values during runtime.

    • @artfulbytes
      @artfulbytes  Рік тому +1

      Yes you are right, I should have been more clear there. The loop code is in flash, but the variable is in ram.

    • @justaszakarauskas6068
      @justaszakarauskas6068 Рік тому

      Stack or heap

    • @ALIENdrifter66
      @ALIENdrifter66 11 місяців тому

      On some microcontrollers it can, but it's not used for those situations

  • @olivialinden8699
    @olivialinden8699 Рік тому

    educative and informative 👍

  • @isakneuman9995
    @isakneuman9995 Рік тому +1

    Please record a video explaining how to flash a microcontroller without any IDE. No one pays attention to this topic, but I think this will allow you to understand more deeply how the linker and the compiler in general work. That is, it will open up opportunities to flash not only microcontrollers of the same type, but almost all possible ones. After all, the base is that one.

    • @artfulbytes
      @artfulbytes  Рік тому

      I mention it in this video "ua-cam.com/video/HCfq44NNBaU/v-deo.html" and also add a make rule for it. The specific command/tool will vary depending on the microcontroller and debugger.

    • @isakneuman9995
      @isakneuman9995 Рік тому

      @@artfulbytes Do u understand that u brilliant?

    • @artfulbytes
      @artfulbytes  Рік тому

      @@isakneuman9995 😇

  • @RavinderSingh-cd5ei
    @RavinderSingh-cd5ei 8 місяців тому

    awesome explanation 👏

  • @kirillyatsenko5365
    @kirillyatsenko5365 Рік тому

    Thanks for such detailed video, it's nice how you explaining things on such low level.
    I'm working as embedded linux engineer but I'd like to learn more low level "embedded" and want to have a good base.
    Can you recommend your favourite resources for learning?
    Also do you have any recommendation on learning electronics/circuit therory/pcb? :)

    • @artfulbytes
      @artfulbytes  Рік тому +2

      embeddedartistry.com is a good resource for embedded programming. I like Robert Feranec and Phil's lab for UA-cam tutorials on electronics/PCB design. Best way to learn in my opinion is to work on a project, start with a simple one, and let that guide your learning.

    • @kirillyatsenko5365
      @kirillyatsenko5365 Рік тому

      @@artfulbytes thanks for the recommendation!

    • @knowledgesharing5483
      @knowledgesharing5483 2 місяці тому +1

      CFBR ​@@artfulbytes

  • @mhmodsadek7902
    @mhmodsadek7902 11 місяців тому

    why "int d[5]" which is the first thing in main () is not the first address of .text section ? why it is exists in the first address in . const section?

    • @artfulbytes
      @artfulbytes  11 місяців тому

      int d[5] is not constant, it's a variable allocated on the stack. The data it's initialized with is constant, and because of that it's stored in the .const section. The .text section holds the program code so it will have the instructions that copies the const data from .const section to the stack.

    • @gopaltiwari9402
      @gopaltiwari9402 5 місяців тому

      Although the values you are using for initialization are constants, they are not stored in a separate constant section when used in this context. Instead, they are part of the initialization process and directly copied into the memory allocated for the array on the stack.

  • @mursalaboobacker3593
    @mursalaboobacker3593 6 місяців тому

    nice videos and good explanation.

  • @juniorlucival
    @juniorlucival Рік тому

    how about struct union and pointers?

    • @artfulbytes
      @artfulbytes  Рік тому

      In terms of where they are allocated is the same as other data variables, but yes could have been good to include them as examples too.

  • @pyrhockz
    @pyrhockz 3 місяці тому

    Great stuff.

  • @MouhcineAnter
    @MouhcineAnter 2 місяці тому +1

    noob quation : where can i find that page you are working on

  • @b17_igedeparadiptadharmasa7
    @b17_igedeparadiptadharmasa7 8 місяців тому

    what kind IDE u use in this video?

    • @artfulbytes
      @artfulbytes  7 місяців тому

      Code Composer Studio (CCSTUDIO IDE) from TI

  • @jiefang11
    @jiefang11 11 місяців тому

    Thanks a lot 🎉

  • @walidoulondon8107
    @walidoulondon8107 Рік тому

    Awesome explanation which IDE are you using bro?

  • @mazharkhaliq1971
    @mazharkhaliq1971 2 місяці тому

    Nice 👍

  • @JeanDAVID
    @JeanDAVID Рік тому

    Do you use visual studio code as IDE ?

    • @artfulbytes
      @artfulbytes  Рік тому

      Sometimes, but not in this video series.

  • @alirezasalehi9149
    @alirezasalehi9149 5 місяців тому

    great. thx🤗

  • @MrDajiangyoude
    @MrDajiangyoude 10 місяців тому

    why are flash and RAM on the same media?

    • @artfulbytes
      @artfulbytes  10 місяців тому

      Flash and RAM are separate, but both are ntegrated into the microcontroller for benefits of space, cost, latency, design simplicity, and so on. Memory mapping allows us to programmatically access them in a similar manner, but they are still physically separated and behaves differently (e.g. Flash retains data on reset while RAM does not).

  • @isakneuman9995
    @isakneuman9995 Рік тому

    This is brilliant content.
    Жаль что embedded вообще не популярный и умирает. Не подскажете, вы работаете и как обстоит рынок в сфере embedded? Я бы очень хотел в эту сферу, но в связи низким спросом я сейчас учу backend чтобы выжить и прокормить себя.

    • @artfulbytes
      @artfulbytes  Рік тому +3

      I'm not Russian, but I translated. The embedded field is indeed less popular and harder to break into than other fields of programming, but it is by no means a dying field. It's not like we are getting fewer embedded systems around us :) But it is an evolving field, and we are slowly moving up the stack (e.g. less bare-metal, more OS-based systems). Yes, I work as an embedded systems engineer, and the market for embedded programming is good. If you know your way around C/C++ there is no shortage of jobs. Of course, the situation may vary depending on where you are located.

  • @embeddedroom
    @embeddedroom Рік тому

    nice job!

  • @Eto-xg7rr
    @Eto-xg7rr Рік тому

    damn you so good at it

  • @majideidy6513
    @majideidy6513 8 місяців тому

    Good

  • @bhojasd
    @bhojasd 6 місяців тому

    Pls make video in slow motion

  • @dragoniscoming
    @dragoniscoming 10 місяців тому

    subscribed to the shrug

  • @DrGeta666
    @DrGeta666 4 місяці тому +1

    man that is a lot of talking about screenshots