Bare metal embedded lecture-4: Writing linker scripts and section placement

  Рет қаралды 96,644

Fastbit Embedded Brain Academy

Fastbit Embedded Brain Academy

Күн бұрын

Пікірлер: 84
@ahbarahad3203
@ahbarahad3203 Жыл бұрын
I have been searching for something exactly like this for months on end, tried a dozen books, searched countless tutorials on the internet but i think this is hands down the best resource for arm bare metal programming, only wish i had discovered it earlier
@jundo374
@jundo374 5 ай бұрын
Yeah, same issue, but for me, it's only been about one week. One week ago, I didn't even know what an MCU was.
@pitankar
@pitankar 4 жыл бұрын
This is pure gold! Thanks for doing this. When you put this course up for sale, do let me know. I'll buy it :) I've bought all your courses already.
@MA-td2ic
@MA-td2ic 4 жыл бұрын
me too :) they deserve every penny spent :D I am hoping that they also make a series for advanced communication interface stacks topics (i.e. LWIP, TLS, ethernet, wifi, etc...)
@vb9950
@vb9950 3 жыл бұрын
Check Udemy
@FastbitEmbeddedBrainAcademy
@FastbitEmbeddedBrainAcademy 3 жыл бұрын
Thank you Piyush for your support
@bobweiram6321
@bobweiram6321 2 жыл бұрын
LOL! I was about to make the same exact statement, so I will take it a step further. These videos are exceptionally good and pure Iridium. Iridium is more rare and more expensive than gold. I believe it also has the highest melting point.
@padmaraghunathan4849
@padmaraghunathan4849 3 жыл бұрын
The best ever course on linker scripts, thanks a lot Sir !!!
@ulysses_grant
@ulysses_grant 2 жыл бұрын
Hi Kiran, Why do you use - 4 in SRAM2 origin calculation? (Timestamp: 10:56) Thanks so much for the video!
@prometheus05developer68
@prometheus05developer68 4 жыл бұрын
I love you for this precise and on-point explanation of Linker scripts!
@pranit2112
@pranit2112 4 жыл бұрын
Can you suggest books referred here, which covers all these things?
@24deepakjoy
@24deepakjoy 4 жыл бұрын
What a stuff. So encouraging.. pls continue this series, there’s lot more to learn. 👍
@sirajtayyabkhan6820
@sirajtayyabkhan6820 2 жыл бұрын
True value addition on KZbin! ✔
@anasskhaldi7840
@anasskhaldi7840 Жыл бұрын
Think you for your patience and your explanation
@AndresFH7233
@AndresFH7233 Жыл бұрын
This class was great, I've already purchased the full course on udemy.
@linkc598
@linkc598 6 ай бұрын
video of the week! thank you.
@DimaS-nq4rq
@DimaS-nq4rq 4 жыл бұрын
Thank you, will buy the course at a full price when it will be released!!
@HimanshuSharma-du9nz
@HimanshuSharma-du9nz 4 жыл бұрын
First of all thank you sir for this series its really helpful at this time. I been working on QEMU emulator, it will be really helpful if you could make a educational video on this topic.
@jdwlsn
@jdwlsn 7 ай бұрын
Great Stuff, Curious why you made SRAM attribute RWX did you plan to store instructions in the same place as data?
@MohamedMohamed-zg5hg
@MohamedMohamed-zg5hg 3 жыл бұрын
Thank you so much for this . I have a question is what happened if linker script is not provided to the linker ?
@omercaylan6623
@omercaylan6623 4 жыл бұрын
Hi Kiran, thanks for everything, will you explain the "GROUP"section? How to set stack and heap and where is the stack pointer stored after set in startup?
@danielwarzecha2007
@danielwarzecha2007 3 жыл бұрын
at 11:09 why do you -4??
@kirtikumarbaba
@kirtikumarbaba Жыл бұрын
I also had same question. maybe a mistake?
@vevasam
@vevasam Жыл бұрын
@12:00 We mentioed SRAM1 and SRAM2 memories as just SRAM as they both occupy contiguous memory locations on the processor memory map. Shouldn't this be the case, we would define them explicitly in the MEMORY layout. Isn't it? Please corect me if I am wrong.
@jankeshchakravarthy9389
@jankeshchakravarthy9389 Жыл бұрын
hi kiran - why do you subtract 4 while calculating SRAM2 ORIGIN ?
@Monk-wv4ub
@Monk-wv4ub 4 жыл бұрын
Which book should we refer for this course .
@Monk-wv4ub
@Monk-wv4ub 4 жыл бұрын
Wonderful lecture .
@jimkokko5
@jimkokko5 4 жыл бұрын
Thank you so much for these videos! Just wanted to add the following: I'm following along with an STM32L452RE, and in the .map file I could see that my .isr_vector table as well as any Handlers I had defined in my startup file were discarded (basically mapped to address 0x0). It turns out that instead of `*(.isr_vector)` I needed to write `KEEP(*(.isr_vector))`; the symbols are otherwise thrown away because they are not referenced somewhere else in the .o files. Just thought I'd put that out there for anyone who got stuck like me.
@mortenlund1418
@mortenlund1418 18 күн бұрын
Thank you for sharing. : )
@benjwill3828
@benjwill3828 3 жыл бұрын
thank you, very helpful!
@selvalooks
@selvalooks 2 жыл бұрын
perfect , clean and clear !!!
@gauravpuri8716
@gauravpuri8716 2 жыл бұрын
Very Nice set of videos!!! thanks a lot
@amitdhiman420
@amitdhiman420 4 жыл бұрын
why is 4 subtracted from SRAM 2 Origin??
@khoahuynh6884
@khoahuynh6884 4 жыл бұрын
I have the same question.
@bobesfanchi
@bobesfanchi 4 жыл бұрын
Me too
@stana.281
@stana.281 3 жыл бұрын
Has to be a mistake
@pitankar
@pitankar 4 жыл бұрын
I am thinking on this for quite some time now. The FLASH starts at 0x08000000 and because the isr_vector is put first, the stack pointer value is stored at 0x08000000. Is that correct? If so, then when the microcontroller powers up the PC would be pointing at 0x00 (please correct me if I am wrong). My understanding is that for the cortex controllers the stack pointer value needs to be stored at 0x00. But in our case it is at 0x08000000. I am a bit confused as to how the controller will pickup the stackpointer value if FLASH doesn't start at 0x0. Can you please help me understand? Am I missing something?
@FastbitEmbeddedBrainAcademy
@FastbitEmbeddedBrainAcademy 4 жыл бұрын
Thats a good question . The processor produces 0x00000000 but the STM32 internal design maps it to 0x08000000 based on the settings of boot pins. so by default 0x00000000 mapped to 0x08000000 in stm32.
@pitankar
@pitankar 4 жыл бұрын
Fastbit Embedded Brain Academy thanks. Now the story is complete :)
@Eren-yl2qi
@Eren-yl2qi 4 жыл бұрын
Hi, When power up MCU and reset mechanism release the reset condition,it means reset interrupt occured and than cpu internally read(not by code just fetch it internally) 0x08000004 address and branch to actual reset handler function to execute.In the reset handler first thing to do read 0x08000000 by our code and set it to process stack pointer or main stack pointer to set up c function call environment.PC counter never points 0x08000000 address because it is initial stack address pointer it is not a opcode.This is architecture specific mechanism.
@khoahuynh6884
@khoahuynh6884 4 жыл бұрын
to people who confuse, you may want to check this video, kzbin.info/www/bejne/aZPVgK2Cf9KYm80
@ixnisarg
@ixnisarg 4 жыл бұрын
@@FastbitEmbeddedBrainAcademy is that written in any sort of document? for other controllers where to find?
@fawad9407
@fawad9407 4 жыл бұрын
Thank you so much for this, this is exactly what I needed and you explained it so well
@ravitejaj473
@ravitejaj473 Жыл бұрын
Thank you very much.....✨💫🌟
@TSS_CLIPS
@TSS_CLIPS 8 ай бұрын
Super lecture.
@sevenfernns
@sevenfernns 10 ай бұрын
Hi, thanks for the tutorial. One question, I checked the reference manual for stm32f407xx and it says that SRAM1 has a size of 112KB, how come we write it as 116KB in this linker script? thanks! EDIT: I checked other comments and it seems it was a mistake, SRAM1 indeed has a size of 112KB.
@DevendraGuptaProfile
@DevendraGuptaProfile 2 жыл бұрын
Sir on the slide linker script symbol: I guess the address are allocated after linking before that every object file maintain relocatable address against the symbols, please correct me if I m wrong.
@yasirarafat9946
@yasirarafat9946 3 жыл бұрын
Wish I could press like button 1000 times. :)
@hownottobeanengineer3927
@hownottobeanengineer3927 2 жыл бұрын
very nice lecture
@Danielmelvin7
@Danielmelvin7 4 жыл бұрын
Awesome stuff!!
@bennguyen1313
@bennguyen1313 2 жыл бұрын
The fpga/board designers suddenly said 'here is another 4k memory block at address 0x40000000. How can I 1) add it to the existing memory pool so that the linker uses it as it pleases.. and/or 2) add it as a separate section, so that is not available for linker's general use but rather is used only for specific variables For example in the case of #2 above, I added in the linker's MEMORY section : memblock (rw) : ORIGIN = 0x40000000, LENGTH = 4k And at the bottom of the SECTION portion, I added: .NEWBLOCK (NOLOAD): { . = ALIGN(8); * (NEWBLOCK); } > memblock But when I declare a variable attempting to place it in that section, char initialized_array[100] __attribute__ ((section ("NEWBLOCK"))) = { 0 }; int non_init_data __attribute__ ((section ("NEWBLOCK"))); It links fine (optimazation set to 0/none), yet these variables are located in in the same space 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!
@miguelduran900
@miguelduran900 4 жыл бұрын
Which one of the courses in fastbitlab page cover these topics?
@AlifSayAwais
@AlifSayAwais 2 жыл бұрын
what if we remove attributes like xrw and rw ?
@emiemi295
@emiemi295 Жыл бұрын
Hey, i bought your course and it s amazing, but i would like to know how to write the linker script for an arduino(ex: atmega328p chip) and i don t know how to set the memory command because the arduino doesn t have a memory map from what i found or any other explanation on how to load the global variables into sram, any tips would be very helpful, thanks!!
@raghul1208
@raghul1208 3 жыл бұрын
thank you for the content
@karthiknmurthy
@karthiknmurthy 4 жыл бұрын
Very good Tutorial...
@mohamedessam2760
@mohamedessam2760 4 жыл бұрын
at the end of the lecture, you make _sbss = . ; and you've said location counter is tracking VMA, so the location counter is equal to SRAM , due to that it will overwite the .data section .. am i wrong ??
@codeplug
@codeplug 3 жыл бұрын
Doubt: Why do we load .data to Flash first and then to SRAM? Why not we directly load it into SRAM like we do for .bss section?
@ghislainmj
@ghislainmj 3 жыл бұрын
I am also wandering. Somebody commented before that ".data needs to be initialized somewhere". i am wandering what that means ?
@codeplug
@codeplug 3 жыл бұрын
@@ghislainmj I guess I figured it out - it means you have to store that data somewhere on flash. This is needed because SRAM will lose data on restart. If we store the data directly on SRAM it will be gone after first reset/restart.
@ghislainmj
@ghislainmj 3 жыл бұрын
@@codeplug that makes sense. very nice
@codeplug
@codeplug 3 жыл бұрын
@Martin LibTec yes I meant power off. Thanks for correcting
@rahulkumar-bf4cq
@rahulkumar-bf4cq 3 жыл бұрын
can you make tutorial on FOTA
@Ibrahimkhan-qo5vw
@Ibrahimkhan-qo5vw Жыл бұрын
Hi ..are these knowledge available on udemy ...I have taken some advanced course...but can any one provide link for these video where this topics are covered want to buy
@FastbitEmbeddedBrainAcademy
@FastbitEmbeddedBrainAcademy Жыл бұрын
Hi, these videos are part of this course www.udemy.com/course/embedded-system-programming-on-arm-cortex-m3m4/
@2605mac
@2605mac 4 жыл бұрын
What IDE should I use to comfortably programming the stm32 husarion board? Are there any ide's that have libraries for it built in?
@vladimirtatarchevskiy5886
@vladimirtatarchevskiy5886 4 жыл бұрын
Use Atollic True Studio. It's free and accessible to download from the st.com website.
@mislavkulas4422
@mislavkulas4422 4 жыл бұрын
you have write SRAM1 = 116k and SRAM2 = 16k. Why you didnt then write SRAM 132k but you write it 128k?
@FastbitEmbeddedBrainAcademy
@FastbitEmbeddedBrainAcademy 4 жыл бұрын
Hi. Thats a mistake. SRAM1 is 112K not 116K
@ulysses_grant
@ulysses_grant 10 ай бұрын
@@FastbitEmbeddedBrainAcademyThank you. I'm still wondering why you put "-4" there in the calculation anyway.
@jagadeeshgottapu6115
@jagadeeshgottapu6115 4 жыл бұрын
GNU compiler is there in website for 32 bit system which is mentioned in first lecture. My system is 64 bit. Will it work on my system or not. Please confirm.
@FastbitEmbeddedBrainAcademy
@FastbitEmbeddedBrainAcademy 4 жыл бұрын
why dont you try it ? or are you saying you tried and it didnt work ?
@sandhyayegireddi4428
@sandhyayegireddi4428 4 жыл бұрын
I installed in 64 bit system and it is working.
@abhijeetraghuwanshi527
@abhijeetraghuwanshi527 2 жыл бұрын
can you share the ppt please
@thineshwarv993
@thineshwarv993 4 жыл бұрын
hi sir, you have not told anything about stack pointer initialization(plzz.. correct me if i am wrong).
@brianthompson876
@brianthompson876 Жыл бұрын
He also didn't cover how to create the Interrupt Vector Table (a.k.a .isr_vector section) in the C or assembly code. This comment may be old, but for anyone else who is curious: The Stack Pointer Register is always initialized with the very first long word in the vector table. The default linker script for cortex-m4 processors for CMSIS has a __StackTop symbol that is calculated as at the top of the SRAM (as long as it is an 8 byte aligned address) which can be used at the top of the vector table which initializes the Stack Pointer Register on startup. In assembly use: `.long __StackTop` at the top of the vector table. In C use: `extern uint_32_t __StackTop;` then put `(void (*)(void))(&__StackTop)` at the top of the vector table. If you'd rather not define the symbol in the linker script: `#define __StackTop ` ... In vector table ... `(void (*)(void))__StackTop`
@ashutoshtiwari2611
@ashutoshtiwari2611 Жыл бұрын
10 crore bahut sahi
@mogasatigopikrishna2025
@mogasatigopikrishna2025 4 жыл бұрын
Please upload lec5 .
@FastbitEmbeddedBrainAcademy
@FastbitEmbeddedBrainAcademy 4 жыл бұрын
ok sir. Thanks for watching
@sad_old_git
@sad_old_git 3 жыл бұрын
Does anyone have experience converting scatter files (Keil toolchain equivalent) to linker scripts?
@hgl9590
@hgl9590 4 жыл бұрын
Hi, Can we just load the .data section to SRAM, i.e. set LMA to SRAM, so that we do not need to copy the the .data in the Reset_Handler().
@stana.281
@stana.281 3 жыл бұрын
You have to initialize the data in SRAM from somewhere
@mohamedessam4704
@mohamedessam4704 4 жыл бұрын
at the end of the lecture, you make _sbss = . ; and you've said location counter is tracking VMA, so the location counter is equal to SRAM , due to that it will overwite the .data section .. am i wrong ??
Bare metal embedded lecture-5:  Linking and analyzing memory map file
25:15
Fastbit Embedded Brain Academy
Рет қаралды 44 М.
Bare metal embedded lecture-1: Build process
27:58
Fastbit Embedded Brain Academy
Рет қаралды 100 М.
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН
-5+3은 뭔가요? 📚 #shorts
0:19
5 분 Tricks
Рет қаралды 13 МЛН
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
How a Microcontroller starts
28:49
Artful Bytes
Рет қаралды 76 М.
What Actually is Embedded C/C++? Is it different from C/C++?
11:05
Jacob Sorber
Рет қаралды 159 М.
Bare metal embedded lecture-3: Writing MCU startup file from scratch
25:24
Fastbit Embedded Brain Academy
Рет қаралды 52 М.
Lecture 15: Booting Process
9:35
Embedded Systems and Deep Learning
Рет қаралды 329 М.
In-depth: ELF - The Extensible & Linkable Format
19:02
stacksmashing
Рет қаралды 202 М.
Embedded C Programming Design Patterns | Clean Code | Coding Standards |
1:38:10
Lecture 9: Interrupts
20:43
Embedded Systems and Deep Learning
Рет қаралды 275 М.
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 520 М.
Andro, ELMAN, TONI, MONA - Зари (Official Audio)
2:53
RAAVA MUSIC
Рет қаралды 8 МЛН