contiki-ng / mspsim

Official MSPSim git repository
BSD 3-Clause "New" or "Revised" License
66 stars 83 forks source link

Loading External ELF Files on MSPSim #32

Closed caioso closed 10 years ago

caioso commented 10 years ago

Hello There! I recently strated using mspsim and I'm really struggling to get some of its functionalities. It is said that it "Supports loading of IHEX and ELF firmware files" but for some reason I didn't manage to find out how can I do it. What I'm really trying to do is to embed msp assembly code to the processor's core and watch to its behavior. I don't actually need any kind of peripheral devices nor RTOS for my purpose. Is my intent suitable to mspsim? How can I embed such an assembly code on the simulador?

I know that it's not the way it is done, but I'm currently trying to simply update memory locations during debug over one of those demo programs that come with the build. However, I'm not even able to make my mset requests get commited. Is there a way to load simple memory files instead of a whole funcional program?

Thank you very much!

cmorty commented 10 years ago

About loading IHEX and ELF: You just pass them as parameter. Have a look at the Makefile on how to do it. Loading Assembler: Do you know how compilers, assembler and linkers work? And what ELF is? If not, you should grab a book about that. mset: Are you sure you know what you are doing. As far as I can see there is no mset for the MSP430.

caioso commented 10 years ago

Thank you very much, cmorty! I'll try to check the make rules in order to load my custom ELF. Regarding the Assembler & mset: MSP does have a few options to directly handle memory and one of them is the MOV instruction, not the mset. If you look carefully at mspsim command list (by using help command) it can be seen that there is a command called mset. Once there isn't further information about this command other than "set memory" I assumed that it lets one to directly change a given memory location (not by means of a MSP430 instruction itself but by the simulator software) to any 8 bit value. I was trying to see if I could freely access the main memory and make the processor core run instructions I've embedded, like mov.w #0x0001, R15 (0x43, 0x1F). I'm currently developing a custom processor core hardware for my purpose, which includes the standard MSP430 instruction set as well as several other custom instructions, and I'm intending to use mspsim to check if the standard MSP430 instructions behave like the ones I implemented in my hardware. MSPSim was an option I considered once tests directly on MSP430 hardware can take much longer to be executes and further analysed. Isn't there a more detailed content regarding the processor's core, other than the help command? It would really help beginners like me =).

Thank you very much!

cmorty commented 10 years ago

Ah ok. So you want to patch the code using the simulator. MSPSim is developed in a research context and as always there is little kudos for writing good documentation. So reading the code is the best way of getting a understanding about what is going on.

caioso commented 10 years ago

Hello cmorty! Thank you very much for your reply! I've already managed t load my custom ELF file on MSPSIM and things are running really smoothly by now! I'd like to thank you for the assistance!