live n learn...
so i didn't know that the libraries supplied by ST are crap, i used
cubemx to create a program (usb.c) for an
stm32f070 that would send and receive data over the chip's built-in usb interface. to my surprise, it worked just like they said it would. i got over confident.
i took another pre-existing program (
pwm.c) that i had wrote and tested on the same proto board and figured i could integrate the two into a single program (PWMwithUSB.c)
LOL
the instant i took the
includes from pwm.c and tried to
include them in usb.c, trueStudio literally drew a gun and capped me between the eyes. and it wasn't a little handgun either. it pulled out a laser cannon like they had on the death star and splattered my brains from here to the moon.
commence ignition...ouch....
many hours later i reached the brilliant conclusion that there was no way in hell the cube library and the standard peripheral library (both written by ST) were gonna coexist. this town (Los Angeles, 500 miles^2) just wasn't big enough for both of them.
so, with my brains vaporized, i had to rewrite pwm.c
with no headers. several days later, i was only halfway finished, when i realized... wtf?, i inadvertantly de-
included the most basic (stm32f0xx.h) header file, and the code still compiled and worked correctly without any macro references at all.
all the assignment statements, like "
TIM1->CCR1 = ..." and "
GPIOB->MODER |= ....." the macro expansions. they are compiling with no header present to define them.
how can this be? how does gcc know what "TIM1->CCR1" means?