# Programming with STM32Cube

#### John99407

Joined Jul 12, 2019
77
I need your attention @MrChips Perhaps you can help. I have looked your old threads on forum

I work with PIC microcontroller. I don't use MCC code generator because it generate many source and header files, which is just pain for me to manage. I read the datasheet and set hardware. This is my way of writing program for PIC microcontroller

There is no doubt, STM32Cube code generator is very useful but I don't want to use STM32Cube code generator. I want to follow same technique as I do with PIC. I don't have any idea how to start writing program from scratch for STM32 discovery board

#### MrChips

Joined Oct 2, 2009
25,949
You don't have to use any code generator or any library.
Just start writing as you would any main program.

C:
void main(void)
{
initialize();
while (1)
{
getEvent();
doEvent();
}
}
Be forewarned, initializing STM32 hardware modules on your own is not an easy task. That's where automatic code generation comes in handy.

#### John99407

Joined Jul 12, 2019
77
You don't have to use any code generator or any library.
Just start writing as you would any main program.
Thank you MrChip for quick reply. In PIC I use #include <xc.h> at above of main function

Which header file need to include for STM32F407 discovery board above main function ?

I can't seem to find anything in documentations to point me at Which header file need to include for STM32F407 discovery board above main function ?

#### MrChips

Joined Oct 2, 2009
25,949
Why do you need a header file if you have no intention of using any library?
The simplest way to get started is to look at an example.
What IDE are you using?

Edit: Sorry, I presume you are using STM32CubeIDE?

#### John99407

Joined Jul 12, 2019
77
Why do you need a header file if you have no intention of using any library?
@MrChips
I think using code generator would be a good idea
How do you write program ? Do you use code generator ? What library or header file do you use ?

#### MrChips

Joined Oct 2, 2009
25,949
Have you tried using STM32CubeIDE?
Simply follow the instructions and your program template will be created automatically.
At this point you need not worry about library or header file. They will be installed automatically.