In this video, we'll be looking into how we can add support for exceptions, how we can handle exceptions
on arm on the context arm.
Machines we're using.
The first eight words in the memory mapped are reserved for the exception vector, and whenever an exception
occurs, the control is transferred to one of the state locations.
If you see below, these are the exception and the addresses where whenever the exception happens,
the program counter will automatically switch to that particular address.
So whenever there is a reset exception, the program counter will automatically switch to that reset
address.
Whenever we press.
Whenever the CPU executes or the processor executes an undefined instruction, it will go into 004,
and whenever there is a software interrupt, it will go into zero eight.
So like this.
We have IRC fir fic uh, fast interrupt and request all those different exceptions which are present.
So normally, uh, this location should have a branch that will control the that will transfer the control
to the appropriate exception handlers.
So we have not added the support for this.
We uh, now, uh, because we did not face any issue because this exception did not happen.
So how we can fix this one is by adding the respective vector section.
So I need to add a vector section at the start of the uh, this particular memory map.
So the start of zero zero my vector section should be present.
So I need to and I need to also have a uh branch statement for each particular exception except reset.
Whenever reset I will branch to my start of my text section.
So and I will update my linker script, uh, accordingly.
So if you see I have my location counter pointing to 000, and then I have my text section where I first
keep my section in the section.
Uh, this is a section merging.
Right.
So I will first keep my vector vector section.
So I'll first keep my branch instructions.
And then I will keep my text section.
And then I'll do the remaining.
So now what we had in the updated the linker script is vector section is placed before all the code,
ensuring that the vector is located at address starting zero zero, and whenever this reset will jump
to the start uh function start label or the start address.