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!
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 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.
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).
@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 ?
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?
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.
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
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 ?
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."
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.
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
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)
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?
@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.
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 .
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
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?
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.
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.
Hard to find invaluable content. Thanks for sharing.
Thank you ! Without these great videos I can't imagine how hard learning these things would be.
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!
excellent, first time clear understanding of relocation from flash to ram !! thanks !!!
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...
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
@@gautam6050 Yes, the teacher teaches exceptionally well.. i am his fan...
@@gowrishankar8880 thanks for the information sir..
@@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.
@@ghislainmj thank u for responding me brother
Excellent series! Thank you!
Thank you - absolute greatness, very useful and entertaining (for a nerd :)) at the same time!
Really great video 👍
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).
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.
@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 ?
why pointer *pDst & *pSrc declared unint8_t ? Can I declare a pointer is uint32_t *pDst & uint32_t *pSrc ?
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?
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.
Hello Ravi, thank you, amazing content.
What happens if you don't align data at the end of the section?
In many controllers non aligned memory access is not allowed and results in exception. Therefore, it is mandatory to align sections.
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 .
Should main prototype be with extern identificator because function implementation resides in different obj file?
Error on trying to link:
main.c:(.text+0x8): undefined reference to `initialise_monitor_handles'
collect2.exe: error: ld returned 1 exit status
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
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 ?
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."
Hi , can you give some idea about noinit section of the memory .
Thx for lectures
That's awesome
Why _etext (flash) is used as source for SRAM data? Is there no data section in flash?
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.
can i get all the files? i need those files for my presentation
Why are the pointers pDst , pSrc .. declared as uint8_t instead of uint32_t? how does it work?
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
Can you explain about LMA and VMA?
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)
Thanks you very much !!
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?
@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.
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 .
actually processor produces 0x0000_0000 , but stm32 internal design maps it to 0x0800_0000 by default. this mapping can be changed using boot pins
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
I think you should comment the puts function in main file and recompile the code then try linking.
Hi , if I want to blink only one led where I need to change in the program
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?
what µC are u using? for example in stm32 it is unusual to have ram at 0x40000000
Ide you are using to explain?
notepad++
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.
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.
Thanks