On Tue, Apr 9, 2024 at 2:23 PM Peter Maydell <peter.mayd...@linaro.org> wrote:
> That sounds like a problem with your binary. If the reset vector > needs to be at 0xFFFE then it needs to be there, and you > should arrange for it to be built correctly. It doesn't matter > whether it's an ELF file or a raw binary file, the data has > to be in the right place. (Generally when objcopy creates a raw > binary from an ELF file it doesn't change the address where > the data is, assuming you load the resulting raw binary to the > right starting address.) > > -- PMM It was a problem with me loading it to the right address. Went through the manual again and I found that the ROM address starts at 0xC000. Hence I was supposed to load at that address. Loading at that address places the reset vector interrupt in the right location. Now I get the right program counter value which is 0xC000 which is the code in the ROM. I went ahead to check if I now get the right opcode but I am still getting zeroes. Digging through the code when I do the following for translate: static void translate(DisasContext *ctx) { uint32_t opcode; opcode = cpu_lduw_code(ctx->msp430_cpu_state, ctx->base.pc_next); qemu_fprintf(stderr, "Opcode: 0x%x\n", opcode); } cpu_lduw_code calls mmu_index callback. In my callback I have static int msp430_cpu_mmu_index(CPUState *cp, bool ifetch) { return MMU_CODE_DATA_IDX; } Here I have just set the MMU_CODE_DATA_IDX to 1 which I know does not make sense. I am not sure how this index is supposed to be computed. Any idea on what to look at to understand it? -Gautam.