Bare metal embedded lecture-5: Linking and analyzing memory map file

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025
  • НаукаНаука

Комментарии • 53

  • @rjgonzalez8108
    @rjgonzalez8108 4 года назад +13

    Hard to find invaluable content. Thanks for sharing.

  • @moseschan6363
    @moseschan6363 2 года назад +5

    Thank you ! Without these great videos I can't imagine how hard learning these things would be.

  • @01wave01
    @01wave01 2 года назад +1

    Thankfully your tutorials I can to understand how to add vectors into start of flash! Your playlist is most informative of RUclips! Thank you very much!

  • @selvalooks
    @selvalooks 2 года назад +1

    excellent, first time clear understanding of relocation from flash to ram !! thanks !!!

  • @PawanKumarYouTube
    @PawanKumarYouTube 4 года назад +2

    Just no words sir!!!!! You are a great teacher.... Thanks a lot for making this video... This is very much useful to me...I have purchased every video of yours on Udemy and it's really an embedded treasure trove... Once again, Dhanyavadagalu...

    • @gautam6050
      @gautam6050 3 года назад

      R u from Kannada language...I don't know anything about embedded systems..if I buy UDEMY course of fastbit academy then can I get enough knowledge

    • @gowrishankar8880
      @gowrishankar8880 3 года назад

      @@gautam6050 Yes, the teacher teaches exceptionally well.. i am his fan...

    • @gautam6050
      @gautam6050 3 года назад

      @@gowrishankar8880 thanks for the information sir..

    • @ghislainmj
      @ghislainmj 3 года назад

      @@gautam6050 Yes Yes Yes. Check the course "MCU1" first. This is what i did. It explains the architecture of the microcontroller and stuff like Bus, Matrix, Clock, GPIOs very well. From there you should feel compfortable with microcontrollers.

    • @gautam6050
      @gautam6050 3 года назад

      @@ghislainmj thank u for responding me brother

  • @dimkars
    @dimkars 4 года назад +5

    Excellent series! Thank you!

  • @stefans2143
    @stefans2143 10 месяцев назад

    Thank you - absolute greatness, very useful and entertaining (for a nerd :)) at the same time!

  • @krishnap685
    @krishnap685 3 года назад +1

    Really great video 👍

  • @Saimoun82
    @Saimoun82 3 года назад +3

    Just a thought: for the copy of .data and the init of .bss it would be much more efficient to use a uint32_t* pointer since this is a 32bit processor (not sure if compiler optimization f.x. set to -O3 would optimise that).

    • @viacheslav1392
      @viacheslav1392 Год назад

      how could that be more efficient if the pointer still takes 4 bytes on 32 bit machine.... The amount of data to be copied is the same.

  • @vevasam
    @vevasam Год назад

    @08:52 Just a quick question. Shouldn't we place stm32_startup.o before main.o ? Since the Entry point is the one that tells the CPU to execute Rest_Handler() first, this should not matter. But at the least aesthetically speaking ?

  • @BAoNguyen-gc9lf
    @BAoNguyen-gc9lf Год назад

    why pointer *pDst & *pSrc declared unint8_t ? Can I declare a pointer is uint32_t *pDst & uint32_t *pSrc ?

  • @taxi_boast
    @taxi_boast 4 года назад +3

    Question. How come start and end addresses the stack and heap aren’t specified in the demo linker script? Would you face runtime errors if you ran the elf generated with this linker script? Since there is no stack space defined?

    • @ilyas.7209
      @ilyas.7209 2 года назад

      MSP is set during boot from 0x08000000, literally the first 32-bit word. There is no section, but the stack pointer is set and ready to shift around when there is an instruction. So I guess not loading something into that part of memory is ok. You can fill stack memory with predetermined data and track peak stack use tho, as I've learned recently. "Painting the stack" it's called, I think.

  • @bonadio60
    @bonadio60 4 года назад +4

    Hello Ravi, thank you, amazing content.
    What happens if you don't align data at the end of the section?

    • @raviranjankishor8960
      @raviranjankishor8960 4 года назад +5

      In many controllers non aligned memory access is not allowed and results in exception. Therefore, it is mandatory to align sections.

  • @gurukiran5814
    @gurukiran5814 Год назад

    Hi , if I want to blink only one led where I need to change in the program because the I commented the function of other led’s but it is not working .

  • @turneroq9888
    @turneroq9888 3 года назад

    Should main prototype be with extern identificator because function implementation resides in different obj file?

  • @prboric
    @prboric 3 года назад +1

    Error on trying to link:
    main.c:(.text+0x8): undefined reference to `initialise_monitor_handles'
    collect2.exe: error: ld returned 1 exit status

    • @michaelbulkley9141
      @michaelbulkley9141 Год назад

      I commented the 'initialize_monitor_handles' function out in the main.c file. This function is defined in the syscalls.c file which is not in our folder yet. The function doesn't do anything in the syscalls.c file anyway. It's empty

  • @chandanbhatia3382
    @chandanbhatia3382 4 года назад +1

    Hello, Can you please tell the reason of structure 'use_task' didn't get include in .bss section initially ? why did it create under COMMON section and what is this exactly ?

    • @dimkars
      @dimkars 4 года назад

      I have same question. GCC documentation says "The default is -fno-common, which specifies that the compiler places uninitialized global variables in the BSS section of the object file."

  • @riyaziskhan
    @riyaziskhan 4 года назад

    Hi , can you give some idea about noinit section of the memory .

  • @turneroq9888
    @turneroq9888 3 года назад

    Thx for lectures
    That's awesome

  • @chandannn
    @chandannn 4 года назад

    Why _etext (flash) is used as source for SRAM data? Is there no data section in flash?

  • @ghislainmj
    @ghislainmj 3 года назад

    i am wondering what will happen with this Reset_Handler if i strip the final.elf file?
    because if i want to reduce the size of final.elf i will strip it, this delete the symbols.
    Will _edata and _sdata become a null pointers or what will happen ?
    thank you.

  • @abhijeetraghuwanshi527
    @abhijeetraghuwanshi527 2 года назад

    can i get all the files? i need those files for my presentation

  • @jugal4607
    @jugal4607 4 года назад +1

    Why are the pointers pDst , pSrc .. declared as uint8_t instead of uint32_t? how does it work?

    • @turneroq9888
      @turneroq9888 3 года назад

      Because pointer variable points to "uint8_t" data type
      Idea is that he is accessing one byte at address of pSrc points at one time and copying it to byte with address pDst points

  • @gsniteesh3794
    @gsniteesh3794 4 года назад +2

    Can you explain about LMA and VMA?

    • @raviranjankishor8960
      @raviranjankishor8960 4 года назад +7

      Load memory address(LMA) is basically the flash memory area where the variables in the data section sit. Now during run time these variable values may be updated and therefore, it is required that mapping of these variables shall be done to RAM and therefore, RAM memory footprint for these variables are called virtual memory address(VMA)

  • @lunuvilaanjana
    @lunuvilaanjana Год назад

    Thanks you very much !!

  • @kaushalkishor6385
    @kaushalkishor6385 3 года назад

    0x20000000 to 0x20000004 of .data section will be copied to 0x800077C to 0x800077F of sram is that correct?
    where is this address 0x20000000 physically present? in data memory?

  • @naveenchaudhary8287
    @naveenchaudhary8287 3 года назад

    @Author : There is a difference between segment and sections. I think you messed them up in this video. What you called sections most of them are actually segments.

  • @mogasatigopikrishna2025
    @mogasatigopikrishna2025 4 года назад

    Hey , why the flash is not starting @ 0x0000_0000 , while reset the program counter is loaded with zero address , but the vector table is starting @ 0x0800_0000 .

    • @FastbitEmbeddedBrainAcademy
      @FastbitEmbeddedBrainAcademy  4 года назад

      actually processor produces 0x0000_0000 , but stm32 internal design maps it to 0x0800_0000 by default. this mapping can be changed using boot pins

  • @gurukiran5814
    @gurukiran5814 Год назад

    I am getting error like in function ‘task1_handler’: main.c:(.text+0xca): undefined reference to ‘puts’ : error: ld returned 1 exit status .
    While doing linker script I am getting like this how to resolve this error?can anyone tell me

    • @mr.developer7648
      @mr.developer7648 Год назад

      I think you should comment the puts function in main file and recompile the code then try linking.

    • @gurukiran5814
      @gurukiran5814 Год назад

      Hi , if I want to blink only one led where I need to change in the program

  • @bennguyen1313
    @bennguyen1313 2 года назад

    I'm trying to create a new memory section in the linker script such that the linker only uses it for variables that I have explicitly set to it.
    For example, if a new 4k ram block is mapped to address 0x40000000..
    I add in the linker's MEMORY section :
    memblock (rw) : ORIGIN = 0x40000000, LENGTH = 4k
    And at the bottom of the SECTION portion:
    .NEWBLOCK (NOLOAD):
    {
    . = ALIGN(8);
    * (NEWBLOCK);
    } > memblock
    Then I declare a variables attempting to place them in this section:
    char initialized_array[100] __attribute__ ((section ("NEWBLOCK"))) = { 0 };
    int non_init_data __attribute__ ((section ("NEWBLOCK")));
    Unfortunately, while it links fine (optimization set to 0/none), the variables are still located in the same space as any other variable (i.e. not 0x40000000)!
    I've tried with and without the NOLOAD, adding KEEP.. adding bss to the var declaration like section(".bss.NEWBLOCK") but nothing seems to map it correctly! Any suggestions?

    • @BinGanzLieb
      @BinGanzLieb Год назад

      what µC are u using? for example in stm32 it is unusual to have ram at 0x40000000

  • @macharlaprasad3064
    @macharlaprasad3064 3 года назад

    Ide you are using to explain?

  • @mogasatigopikrishna2025
    @mogasatigopikrishna2025 4 года назад

    Hi , is there any specific reason for pc relocation ? So , I understand it as pc is actually generating 0x0000_0000, reset vector @ 0x0000_0004 etc.., but why relocation is required?? , Also If I give the start of text section as 0000_0000 will my application works ? Please fill my understanding gap. Thank you.

    • @ambeshbly
      @ambeshbly Год назад

      It depends on arm start address implemented by chip vendor, in this target flash start from 0x0080_0000. if flash implemented in target start from 0000_0000, then you can load it but in arm, it recommended by arm to chip vendor.

  • @yamensaad6832
    @yamensaad6832 4 года назад

    Thanks