RCGES: Retargetable code generation for embedded systems. With the integration of computer technology, consumer products, and communication facilities, the software in an embedded system now accounts for as much as 70% of total system functionalities. In this paper, we propose a code generation methodology called RCGES (Retargetable Code Generation for Embedded Systems) for the automatic code generation on retargetable embedded systems and two issues are solved. Firstly, an embedded C code for embedded processor is generated automatically from ANSI (American National Standards Institute) C code based specification using our proposed code generation algorithm. Secondly, we develop a graphical user interface to configure the parameter for retarget processor of embedded system. Two embedded system examples, 8051-based and PIC (Peripheral Interface Controller)-based, are used to illustrate the feasibility of the RCGES methodology.