Portenta H7 Baremetal Porgramming

I have just started in the field of Embedded System Firmware Development, and I was working on a project with Portenta H7, I really find it overwhelming sometimes.
I want to learn baremetal development, for example I was searching for timers [although i have very few idea about these terms watchdog, interrupts, timer , ISR] I was trying to implement a simple baremetal timer .
Then I found this forum where some one just implemented a timer using the regs directly , with least abstraction.
this "Thread"

Please guide me with some steps/resources , to learn more about ARM , MCU/MPU Architecture , and Firmware Development also how can I begin with Portenta H7 , as i found out STMCube IDE Doesnt supports the Portenta H7 board directly , and also the bootloader is different.

The STM32H7 is probably the worst MCU to start with for a beginner in baremetal programming...

I would suggest starting with the basic timers (TIM6 and TIM7) as they are simple to start (almost as simple as an AVR timer)

Use this piece of code as a starting point (this is for an STM32F4 but it's almost the same with all STM32F/H series with these two basic timers)

void periphInit_TIM6(void)
{
	// enable TIM6 clock
	RCC->APB1ENR |= RCC_APB1ENR_TIM6EN;

	// set TIM6 prescaler for 10 KHz operation [84 MHz / 8400]
	TIM6->PSC = 8400 - 1;

	// set initial TOP value to generate 1000 ms
	TIM6->ARR = 10000;

	// reset CNT to zero
	TIM6->CNT = 0;

	// disable DMA or interrupt generation
	TIM6->DIER = 0<<TIM_DIER_UDE_Pos | 0<<TIM_DIER_UIE_Pos;

	// initiate force update of timer registers
	TIM6->EGR = TIM_EGR_UG;

	// clear timer flags
	TIM6->SR = 0;

	return;
}

Just one thing, what is a prescaler value, and can you suggest me a book or resource where I can learn all this things about programming a ARM board baremetal

Prescaler is just a fancy term for a clock divider

Most STM32s have a CPU clock, an AHB clock, and APB clock

AHB clocks are for the high speed peripherals (DMA, GPIO, etc) and they can run the same as the CPU clock (prescaler is one)

APB clocks are for slower peripherals like USART, SPI, I2C etc. You usually divide the CPU by some value (2,4,8,16...) to get the APB clock

In my example, TIM6 is an APB peripheral, and my APB clock is 84 MHz (CPU_clock_168MHz/4)

Because I only need 10 KHz for TIM6, I have to "prescale" the 84MHz clock to get 10 KHz, so I used a 8400 value
(84MHz/8400) = 10 kHz

Since TIMERS are basically counters, you also have a "TOP" value which is the ARR register. So the TIMER counts from 0 to the value of ARR, then start from 0 and so on. This is how you generate a "timer interrupt" that creates a defined interval based on the TIMER "clock" and the value of ARR (TOP)

The Reference manual for each MCU family has a lot of details regarding the clock tree and all the peripheral registers to fiddle in. Its not going to be easy, you have to have an understanding of CPU and hardware in general.

The STM32H7 is not the best place to start learning, it's a too complicated hardware. Start with an AVR first, then you can graduate to the STM32s

Thanks a lot sir, really appreciate that :+1: