Elon Musk has said he is committed to remaining as Tesla's chief executive for at least five years, as the electric carmaker faces pressure from consumers and the stock market over his work with Donald Trump's government.