“Error: byte or halfword not valid for base register – `strb r3,[sp]’”
This error occurs when the GCC cross compiler for ARM processor generates invalid assembly language instructions.
Generally, the invalid instruction will be created when GCC trie to optimize the code. Hence, this problem will not occur when the code is compiled with no optimization.
Optimization option is represented by -On where n ranges from 0 to 3. –O0 option (which makes optimization off) can be used to compile the code to eradicate this problem.