Refactor x-core and aos-rpc routines

m6