On Arduino I can set digital pins by setting special variables PORTB and PORTD (or maybe they are not variables?). Where are those variables defined? I grepped /usr/share/arduino, but found nothing.
grep -r 'PORTB' /usr/share/arduino/
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.Sign up to join this community
PORTB is defined by the "toolchain". It is not defined by Arduino. For instance in my setup the Arduino Uno uses "toolchain" avr-gcc\4.9.2-amtel3.5.3-arduino2\avr.
If you grep that folder (location dependent on tool and installation options) you will find a file called
iom328p.h that defines
#define PORTB _SFR_IO8(0x05)
This is a mapping to a physical address of the cpu.