sim: msp430: set initial PC to ELF entry if available
[deliverable/binutils-gdb.git] / sim / msp430 / msp430-sim.c
index c3fa4a9621bc22a5408240d4191e03ec0c63da84..2a648f58468359228e4ca76ba04a98b165034051 100644 (file)
@@ -249,9 +249,14 @@ sim_create_inferior (SIM_DESC sd,
   int c;
   int new_pc;
 
+  /* Set the PC to the default reset vector if available.  */
   c = sim_core_read_buffer (sd, MSP430_CPU (sd), read_map, resetv, 0xfffe, 2);
-
   new_pc = resetv[0] + 256 * resetv[1];
+
+  /* If the reset vector isn't initialized, then use the ELF entry.  */
+  if (abfd != NULL && !new_pc)
+    new_pc = bfd_get_start_address (abfd);
+
   sim_pc_set (MSP430_CPU (sd), new_pc);
   msp430_pc_store (MSP430_CPU (sd), new_pc);
 
This page took 0.023098 seconds and 4 git commands to generate.