relocate DEBUGCONFIG, and add a master debug switch