How a Microcontroller starts

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ธ.ค. 2024

ความคิดเห็น •

  • @DoubleDee364
    @DoubleDee364 หลายเดือนก่อน +144

    Please never leave us again 🙏🏾

  • @olokelo
    @olokelo หลายเดือนก่อน +53

    So much really interesting stuff. I feel like this 30 minute video is equivalent to weeks of reading the manuals without fully understanding them. Really well presented. Wow.

  • @pritonce6562
    @pritonce6562 หลายเดือนก่อน +10

    I programmed an STM32 for the first time 2 days ago. This really gave me a so much deeper insight into how these controllers work.
    Honestly loving how simple stupid it really is.
    I am also once again surprised and also not surprised that we can just use C to generate the startup assembly only using a few compiler flags.

  • @sauravkumaragarwal6598
    @sauravkumaragarwal6598 หลายเดือนก่อน +7

    This is the type of content, I want to pay the internet bill for. Thanks a lot bro❤

  • @kyle6344
    @kyle6344 หลายเดือนก่อน +16

    Every video is a banger. I love these deep dives into the "basics" we often forget or never learn properly

  • @thaithinhtran5055
    @thaithinhtran5055 หลายเดือนก่อน +9

    Very clearly, thanks man. I also devevop the bare metal embedded at the MCU company. This is very valuable lesson.

  • @thargor2k
    @thargor2k หลายเดือนก่อน +6

    Great video! Two small notes: most recent controllers will actually run vendor code from a ROM before jumping into user code - you sadly can't debug that in many cases since the debugger gets enabled after that... What is done there? E.g. loading calibration values that must be loaded in all circumstances.
    And the other: even without linking the C standard library you may have to provide memset/memcpy/... since gcc will (at some optimization levels) replace loops with those functions - independent of command line flags

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +2

      Thanks, appreciate the input! Lots of details to keep track of and I try to get away with brushing over many of them :)

    • @thargor2k
      @thargor2k หลายเดือนก่อน +1

      No shade, makes total sense - as I said its a great video as it is
      Just thought it might be interesting to some - surprised me a bit in the beginning but makes sense that there might be some other code hidden...

  • @stainlessCode
    @stainlessCode หลายเดือนก่อน +8

    Excellent, very straightforward explanation that completely cleaned up my confusions. I'm trying to bringup my own programming language on RP2040, that was super helpful to me.
    Although I have a few questions about bootloaders:
    * how and where do they fit into the whole picture
    * why someone would need one
    * how to deal (or not) with them from the point of view of writing everything from scratch. Basically how to write a barebones C program that will work under a bootloader.

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +4

      It depends :) But I think it makes sense to think of a bootloader as another small standalone program that runs before your main program. So, just like you need startup code to make the MCU ready to run the main program, you need startup code before the bootloader program. A bootloader is optional, but it's often used to separate the update mechanism from the main program, and to allow the main program to be upgraded without a dedicated debugger. If your bootloader is simple and perhaps not written in C, it may not require as much startup code though. In practice it may be like this: startup code 1->bootloader->startup code 2->main program.

    • @stainlessCode
      @stainlessCode หลายเดือนก่อน

      @@artfulbytes Thanks for the reply, that makes sense. But what I still do not fully understand is if the bootloader has to live somewhere in the flash, it will basically have to take the space of the interrupt table, so the main program cannot provide ISRs directly via a table. Is that correct?
      So the bootloader has to provide the interrupt stubs, and then before loading the main program the bootloader has to do some kind of dynamic linking to wire up main program's ISRs, or am I compeletely wrong here?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +5

      @@stainlessCode STM32 allows you to change the address of the interrupt vector table (IVT) by writing to a register (VTOR). And yes bootloader would live in flash and it can have its own IVT and startup code. You would then place your main program including its IVT somewhere else in flash memory. Then just before the bootloader jumps to the main program it can write to VTOR to change the address to the IVT of the main program. Moving the IVT is not possible on all MCUs and in those cases you may have to partly share the IVT or solve it some other clever way.

    • @stainlessCode
      @stainlessCode หลายเดือนก่อน +1

      @@artfulbytes I see, that makes sense, thank you for the reply!

  • @MarkVolosov-zb3wc
    @MarkVolosov-zb3wc หลายเดือนก่อน +13

    You’re knowledgeable of the gcc tool chain is insane!!! Keep up the great videos!!

  • @ltkdt
    @ltkdt หลายเดือนก่อน +1

    Nice to see this channel uploading again! Hope to see more content on low-level stuffs!

  • @sinamathew
    @sinamathew หลายเดือนก่อน +8

    Welcome back
    This time, teach us electronics and programming from scratch.

    • @sinamathew
      @sinamathew หลายเดือนก่อน +2

      C and ASM

  • @panagiotischagias4119
    @panagiotischagias4119 หลายเดือนก่อน +9

    Literally I was thinking about this channel yesterday.
    He's back boys!

    • @norbertbatiuk121
      @norbertbatiuk121 หลายเดือนก่อน +1

      Haha same here. I actively searched for his channel yesterday and noted it was long time ago he uploaded. Quite scary

  • @iggypei
    @iggypei หลายเดือนก่อน +4

    Thanks for making this video. I had saved Memfault and EmbeddedArtistry's articles in my "read someday" list, but they are not light reading. This video makes these concepts much more enjoyable for me to follow along to (an engineer transitioning from mechatronics to embedded systems).

  • @MikeBondar
    @MikeBondar หลายเดือนก่อน +2

    this is gold! 🙏 thank you for laying it out, can't tell how much time I spent digging through internet trying to make sense out of linker scripts and how they are related to the startup scripts

  • @broadestsmiler
    @broadestsmiler 29 วันที่ผ่านมา

    Super informative! I do not work with embedded systems, but I found it fascinating to see how the start up process works here. Thank you!

  • @Ziferten
    @Ziferten หลายเดือนก่อน +1

    I was super excited to see a new video from you, and it did not disappoint! I always thought it was interesting that C-only startup code was a selling point of ARM Cortex M, but most vendors still used assembly. Very interesting to see how it's done. Keep up the awesome videos!

  • @ulysses_grant
    @ulysses_grant หลายเดือนก่อน

    So glad to see you're posting.
    Your videos are the best on microcontrollers and embedded systems!

  • @diegoporras7769
    @diegoporras7769 8 วันที่ผ่านมา

    6:01 I think the SP is actually changing after the mov sp, r0
    Amazing video so far, watching till the end.

    • @diegoporras7769
      @diegoporras7769 8 วันที่ผ่านมา

      From …17F8 to …1800

    • @artfulbytes
      @artfulbytes  7 วันที่ผ่านมา

      @@diegoporras7769 The sp increases from 0x200017f8 to 0x20001800 after stepping over the first instruction (ldr and not mov). I haven't checked, but I think it may be a debug artifact, i.e. register view not refreshing properly until stepping over the first instruction.

  • @der.Schtefan
    @der.Schtefan หลายเดือนก่อน +2

    This is great if you want to play with things like Ben Eater's 6502 project and want to add C code

  • @歪果仁-q4x
    @歪果仁-q4x 15 วันที่ผ่านมา +1

    long time no see !!!!

  • @陈歌珊
    @陈歌珊 หลายเดือนก่อน +1

    welcome back for detailed teaching

  • @rehannasar5354
    @rehannasar5354 หลายเดือนก่อน +1

    Buddy, your videos are a goldmine! Thanks for sharing.

  • @1van_ka
    @1van_ka 21 วันที่ผ่านมา

    It’s the most useful video i’ve ever seen. My life will never be the same. Awesome, please, do more like this. Maybe compile smallest linux kernel for stm32?🤓

  • @sad_tuna
    @sad_tuna หลายเดือนก่อน +1

    This video is so much gold. It gives so much insight of how things work in a microcontroller. Thank you so much. Keep that going! PS: Are you considering linking agains picolibc?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +1

      I think I've linked with picolibc in a few zephyr projects without thinking about it :) Not really considered the differences between picolibc vs newlib.

  • @Bestcuriosity_1
    @Bestcuriosity_1 หลายเดือนก่อน

    Thankyou for coming back please keep carry on quality informative contents for Us

  • @kittitouchlelapiyamit5625
    @kittitouchlelapiyamit5625 หลายเดือนก่อน

    You're back! I really enjoy watching your videos very informative and full of valuable information. Keep up the great work!

  • @resethel3843
    @resethel3843 หลายเดือนก่อน +1

    So glad to see you back 🎉

  • @NithinJune
    @NithinJune หลายเดือนก่อน +2

    9:38 Just curious what reason is there not to use -std=c23 every time?

    • @artfulbytes
      @artfulbytes  29 วันที่ผ่านมา

      Compiler/toolchain may not support it yet, compatibility with existing code (e.g. stm32 HAL), potential issues/bugs. So unless you really need the latest C features, probably safer to stick with something more established. With that said, I have not tested it extensively.

    • @NithinJune
      @NithinJune 29 วันที่ผ่านมา

      @ interesting…

  • @gtrfanboy4933
    @gtrfanboy4933 หลายเดือนก่อน

    Teach us embedded systems you are so good in this please share your knowledge with us🙏🏻

  • @dohack
    @dohack 16 วันที่ผ่านมา

    Welcome back, keep uploading :)

  • @zazazi95
    @zazazi95 หลายเดือนก่อน

    Happy yo see you back again! Thank you

  • @btconstantin3682
    @btconstantin3682 หลายเดือนก่อน

    Ohhhh, finally a video where they explain this! Thanks!!

  • @magnoliacomputerscience7334
    @magnoliacomputerscience7334 หลายเดือนก่อน

    Amazing video! Great work!! I learned a lot!

  • @ltd5480
    @ltd5480 26 วันที่ผ่านมา

    Can you do a long series like you did the past but with STM32 microcontrollers, I really wanted to write code on it from scratch, and understand all the concept MCU-related also, but I can’t find any suitable resources than yours. Thank you for bringing this such a nice educational videos!

  • @RicardoBHubner
    @RicardoBHubner หลายเดือนก่อน +1

    Eu não entendi nada, mas entendi tudo.
    ótimo trabalho amigo.

  • @albertkennis
    @albertkennis หลายเดือนก่อน

    Deep. Learned so much!

  • @AK-vx4dy
    @AK-vx4dy หลายเดือนก่อน

    Nice explanation, excelent job and mega respect, outstanding knowledge !
    But i have feeling like with ORM vs SQL, so much boilerplate around C code, that assembly looks clearer to me ;)
    Yes, i know, C will be partialy portable between simillar architecures/boards, but still i have no clear winner.

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      I was a bit more verbose in my C code than necessary here as well

  • @Unknown-s2v4h
    @Unknown-s2v4h หลายเดือนก่อน

    Welcome back man!!

  • @Emb_Sys
    @Emb_Sys หลายเดือนก่อน

    Good to be back 😊

  • @Jonathan-ru9zl
    @Jonathan-ru9zl หลายเดือนก่อน

    Hi!
    In 7:14, doesn't debug trace usually move forward in a program?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +1

      Is it not moving forward? You mean in the terminal below right? I may have cut the video a bit weird in certain places so they don't always line up.

    • @Jonathan-ru9zl
      @Jonathan-ru9zl หลายเดือนก่อน +1

      @@artfulbytes No, I meant actually in the code. Maybe not in this case, but sometimes I see that the debug trace doesnt progress sequentially, especially in low level code (goes back and forth)

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +1

      ​@@Jonathan-ru9zl Normally the program counter just increments, but there are branch/jump instructions such as bcc, which can jump to a specific address. For example, these instructions are used when repeating a code block such as in a loop, or when jumping to a function.

  • @nfjeldberg
    @nfjeldberg หลายเดือนก่อน

    To long since the last video Niklas! Please give us more content!

  • @krishnababu5190
    @krishnababu5190 หลายเดือนก่อน +1

    It would be great if we move from bare metal to any RTOS and do some stuff there as well 😊.

  • @agnisri1201
    @agnisri1201 หลายเดือนก่อน

    I am waiting for your video so long

  • @timello
    @timello 11 วันที่ผ่านมา

    Really nice content!

  • @subashgowtham6165
    @subashgowtham6165 หลายเดือนก่อน

    Thank you for the amazing content 🎉

  • @kyambaddemarkarthur6733
    @kyambaddemarkarthur6733 หลายเดือนก่อน

    He's back!!

  • @marcomeli9882
    @marcomeli9882 หลายเดือนก่อน

    Welcome back!

  • @wahidvianash
    @wahidvianash หลายเดือนก่อน

    welcom back

  • @arya8431
    @arya8431 หลายเดือนก่อน

    Welcome back 🎉

  • @aleksandarglisic9384
    @aleksandarglisic9384 หลายเดือนก่อน

    I wish I could've seen this two years ago 😅

  • @AK-vx4dy
    @AK-vx4dy หลายเดือนก่อน

    @27:15 i'm not sure but call to _start() should be befor call to main() ?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +1

      You would call _start instead of main(). The function _start includes a call to main.

    • @AK-vx4dy
      @AK-vx4dy หลายเดือนก่อน

      @artfulbytes i see, now it make sense 😀

  • @Cristi4n_Ariel
    @Cristi4n_Ariel หลายเดือนก่อน

    Hi, have you ever used the C2000/C6000 MCUs from Texas Instruments? There isn't much information about them on this site and since their architecture differs from that of ARM, I thought I'd be interesting to create a series around them. Although, I would think it'd be for a very niche audience.

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      I haven't, yes quite niche :)

  • @ahmetcanaksu6821
    @ahmetcanaksu6821 หลายเดือนก่อน

    Incredible video

  • @fixfaxerify
    @fixfaxerify 22 วันที่ผ่านมา

    Awesome!

  • @QuanLe-xy7uh
    @QuanLe-xy7uh หลายเดือนก่อน

    the goat return

  • @Lentato
    @Lentato หลายเดือนก่อน

    Welcome back

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +1

      Roberto, good to see you

  • @emomaxd
    @emomaxd หลายเดือนก่อน

    kinda similar to writing an OS from scratch and writing a bootloader I passed that stage so I could understand what's going on in here, of course this is more specific to the MCU archtiecture and startup code needs to be configured according to the manufacturer and needs lots of datasheet checking about MCU specifically STM32 for this video
    In the end, it's a great vid.
    And I wonder your background like Electronics or CS?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      Yes some similarities indeed. Thanks. I studied CS, but do quite a bit of hardware design professionally atm.

  • @bas7650
    @bas7650 หลายเดือนก่อน

    Thanks for the video!

  • @ahmetefeakyazi
    @ahmetefeakyazi หลายเดือนก่อน

    Amazing video!

  • @ManitRubiks
    @ManitRubiks 15 วันที่ผ่านมา

    The value of sp increases from 0x200017f8 to 0x20001800 on running the first two assembly code lines.
    If estack was 0x20001800, then why was sp initialized by HW to 0x200017f8?

    • @artfulbytes
      @artfulbytes  15 วันที่ผ่านมา

      The sp increases from 0x200017f8 to 0x20001800 after stepping over the first instruction. I haven't checked, but I guess it may be a debug artifact, i.e. register view not refreshing properly until stepping over the first instruction.

    • @ManitRubiks
      @ManitRubiks 15 วันที่ผ่านมา

      @artfulbytes that's possible - may be due to debug interface
      Ldr command doesn't change the value of sp so it does not make sense that it changes after ldr.

  • @blcouz
    @blcouz หลายเดือนก่อน

    Thanks for the video.

  • @windigo000
    @windigo000 14 วันที่ผ่านมา

    just wow. very cool. 👍 will it run PHP tho 🤣

  • @m-electronics5977
    @m-electronics5977 หลายเดือนก่อน

    What Desktop Environment so you use?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      ubuntu linux

    • @m-electronics5977
      @m-electronics5977 หลายเดือนก่อน

      @ But the default from Ubuntu? It doesn't look like that

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      ​@@m-electronics5977 i3 window manager

  • @Andile-jz1vs
    @Andile-jz1vs หลายเดือนก่อน

    bare metal programming , is field iam looking to breaking into , i thought you were going to take out the bios chip set and flash it with program

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +1

      Microcontrollers typically don't have any bios chipset.

    • @Andile-jz1vs
      @Andile-jz1vs หลายเดือนก่อน

      @artfulbytes its kinda interesting ,maybe i should look at the architecture including flash memory and how its stores bootloader

  • @Prabagaran-s3b
    @Prabagaran-s3b หลายเดือนก่อน

    I have stm32 bule phill it comes under arm Cortex m3 architecture I but doesn't reach main it goes half fault . I don't where the mistake is where any problem in openocd

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      You can step from the beginning like I did in the video to identify the instruction that causes the hard fault.

  • @Prabagaran-s3b
    @Prabagaran-s3b หลายเดือนก่อน

    Can you make video about make files for stm32.

  • @Prabagaran-s3b
    @Prabagaran-s3b หลายเดือนก่อน

    how to set up these environment

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      Install ubuntu linux and vs code.

  • @bananaear23
    @bananaear23 หลายเดือนก่อน

    Can you make a mini C course

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      I think there already is quite good content out there on that already.

  • @randomsearches369
    @randomsearches369 หลายเดือนก่อน

    I just love you!

  • @Prabagaran-s3b
    @Prabagaran-s3b หลายเดือนก่อน

    Can you make vedio makefile for this project.

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      I explain Makefiles in my video series. A different microcontroller/toolchain, but the Makefile structure would be the same.

  • @johanliebert2048
    @johanliebert2048 หลายเดือนก่อน

    go more stm32? And if it possible, I think parallel compare with AVR8 like atmega8 most be very understandable and opens up understanding. Yes it must be hard to make video, but u can make most greate course and try sell them

  • @TunifyBasic
    @TunifyBasic หลายเดือนก่อน

    yo pls do a vid about the stm32f407 i got one as a gift and i'm stuck with it i wanna use do something and i need to work around the roll,pitch & yaw it has builtin osciloscope and idk how to work with it. thx btw for your content

  • @user-ik6mh8xb6c
    @user-ik6mh8xb6c หลายเดือนก่อน

    Could this startup code can technically be called bootloader?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      In practice, there may be some overlap, but roughly speaking, a bootloader is a small program that runs before the main application, while startup code is code that runs before any program, including the bootloader.

  • @Z0gos_
    @Z0gos_ หลายเดือนก่อน

    Please make more videos

  • @scottspitlerII
    @scottspitlerII หลายเดือนก่อน

    0:02 a lot of prayer

  • @sulikszabolcs
    @sulikszabolcs 5 วันที่ผ่านมา

    The content is great. However this is not an action movie, no need for fast cuts. This is a bit heavy topic, it'd be better to slow down a bit.

  • @TheGabrielMoon
    @TheGabrielMoon หลายเดือนก่อน

    nice

  • @Prabagaran-s3b
    @Prabagaran-s3b หลายเดือนก่อน

    It is possible to expect vedios on weekend . We are already waited for longtime so plese make Quickly and discuss various concepts as soon as possible. thanks artful bytes❤

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +2

      No specific day. Quality videos take time :)

  • @reinasama904
    @reinasama904 หลายเดือนก่อน

    Ommmggg you're baaack!

  • @oasdflkjo
    @oasdflkjo หลายเดือนก่อน

    🙏

  • @兼明-p2b
    @兼明-p2b หลายเดือนก่อน

    good

  • @eranze
    @eranze หลายเดือนก่อน +1

    Microntoller.

  • @SuperElephant
    @SuperElephant หลายเดือนก่อน

    Bruh

  • @pajeetsingh
    @pajeetsingh หลายเดือนก่อน

    Windows 😒

    • @Lentato
      @Lentato หลายเดือนก่อน

      ?

    • @iggypei
      @iggypei หลายเดือนก่อน

      ?

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน

      ?

  • @JayDee-b5u
    @JayDee-b5u หลายเดือนก่อน +2

    I appreciate the lesson as always. However this is way too dense. I, and perhaps others, may be out my depth especially as I don't know what 'gcc expects...' really entails.

    • @1343-p4u
      @1343-p4u หลายเดือนก่อน +2

      This probably isn’t for people with little to no knowledge. Might need watch other videos for that

    • @artfulbytes
      @artfulbytes  หลายเดือนก่อน +1

      I assume some prior knowledge to be able to follow along in this video.