Thanks for sharing your code, you saved me days of work!
Was the board successful? Tried your code, seems to work, but I can't really test until I build a board. I get these warnings for GPIO_EMC_33-GPIO_EMC_41:
warning: conversion from 'long long unsigned int' to 'uint32_t' {aka 'long...