It's yours - do what you like with it
Assuming that you are the legal owner of the device then you are entitled to do whatever you like with it: smash it with a sledgehammer, brush your teeth with it, upload firmware, etc.
Unless, what you would like to do is otherwise illegal ...
It is unlikely that in buying the item you also bought the copyright in the firmware. More likely you have a licence to use it and that permission is limited to what the licence allows.
So, if you can write the firmware without using their firmware as a starting point then you can upload your new firmware. Personally, I think it would be next to impossible to build working firmware without knowing what their firmware does but if you can do so: well done.
Some of the things you name require government regulated designs - cars and telephones spring to mind. Your firmware is not part of that government approval so, for example, you couldn't drive a modified car on a public road, or connect a modified telephone to a telecommunications carrier without getting those approvals.