Hi David,
For a baremetal application you are correct.
The nice aspect of the examples and demos in KSDK are they have been created for specific hardware (Tower or Freedom) boards.
As such the code "knows" about the buttons, and LED's and other resources of the processor and board combination.
Peek at the KSDK_Files folder in the lwevent_frdmk22f project.
The gpio_pins.h has the gpio settings for LEDs, switches, and sd card:
enum _gpio_pins
{
kGpioLED1 = GPIO_MAKE_PIN(GPIOA_IDX, 2), /* FRDM-K22F120M LED1 (Green LED) */
kGpioLED2 = GPIO_MAKE_PIN(GPIOA_IDX, 1), /* FRDM-K22F120M LED2 (Red LED) */
kGpioLED3 = GPIO_MAKE_PIN(GPIOD_IDX, 5), /* FRDM-K64F120M LED3 (Blue LED)*/
kGpioSW2 = GPIO_MAKE_PIN(GPIOC_IDX, 1), /* FRDM-K22F120M SW2 */
kGpioSW3 = GPIO_MAKE_PIN(GPIOB_IDX, 17), /* FRDM-K22F120M SW3 */
kGpioSdcardCd = GPIO_MAKE_PIN(GPIOB_IDX, 16),
};
board.h has many #define and MACROs that are convenient for fast playing around with the code base.
So for the known capabilities on the board the RTOS is setting things up for you.
Attached is my updated lwevent.c for KSDK_1.3 and tested with the frdmk22f Freedom board.
Note the RTOS has default PORTC_IRQHandler() defined in startup_MK22F51212.S and when you declare it in your application code, you are overloading the function call so that your PORTC_IRQHandler() handler will be used.
Regards,
David