Hi all, I recently started a microcontroller project based on the Renesas M16C family. I successfully built the GNU toolchain (binutils-2.17, gcc-4.1.1, newlib from CVS) and are now able to build executables for the M32C-ELF target. Great! Now, two questions come up:
1) What is the correct way to set the reset vector? When just providing the main() function, the start code is successfully linked in, but the reset vector is not set appropriately. In order to do this manually, I use the following code: void start(void); typedef void (*ifunc)(void) __attribute__ ((mode(SI))); const ifunc __attribute__ ((section(".resetvec"))) reset_vector = start; I'm not sure, if this is the correct way... Why doesn't the linker set the reset vector by itself? 2) What is the correct way to set the "relocatable vector table" (interrupt vector)? I tried the code below, but it doesn't seem to work: void timer0_isr(void) __attribute__ ((interrupt)); void dummy_isr(void) __attribute__ ((interrupt)); static const ifunc interrupt_table[64] = { dummy_isr, dummy_isr, dummy_isr, dummy_isr, dummy_isr, // 0-4 [...] dummy_isr, dummy_isr, dummy_isr, dummy_isr, dummy_isr, // 15-19 dummy_isr, timer0_isr, dummy_isr, dummy_isr, dummy_isr, // 20-24 dummy_isr, dummy_isr, dummy_isr, dummy_isr, dummy_isr, // 25-29 [...] dummy_isr, dummy_isr, dummy_isr, dummy_isr // 60-63 }; void timer0_isr(void) { // ISR stuff } void dummy_isr(void) { } int main(void) { // here: configuration of processor mode registers et. al. asm("ldc #0x0000, intbh"); asm("ldc _interrupt_table, intbl"); // here: init and start timer asm("fset I"); while(1); return 0; } Perhaps someone can point me to an example project for M16C (or compatible), that uses the native startup code and works with interrupts. BTW, does someone know a free flash tool for GNU/Linux that proved to work with Renesas M16C? -- Thanks a lot, Florian