tools: fix up build_api padding logic and clean up unused code
tools: fix up build_api padding logic and clean up unused code

Patch from the end of the first segment. Remove unused code.

mbedmicro/mbed,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,mbedmicro/mbed,andcor02/mbed-os,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,andcor02/mbed-os,kjbracey-arm/mbed,andcor02/mbed-os,mbedmicro/mbed,andcor02/mbed-os,kjbracey-arm/mbed