rudolfgeosits / msp430-emulator Goto Github PK
View Code? Open in Web Editor NEWProviding a software model of the TI MSP430
License: GNU General Public License v3.0
Providing a software model of the TI MSP430
License: GNU General Public License v3.0
That name was much better. I can not see myself contributing to the project under the new name.
Are the client side sources not available anywhere else, so we can run the whole thing locally?
Hello!
The web site doesn't seem to function. Would you consider sharing the frontend portion of your project? It's not clear how to use this emulator without a frontend.
Thanks a lot!
It worked for me not too long ago. Is there any particular reason it has stopped?
Thanks.
I think I'm running into a problem with the right-shift operation. It seems that the rrc operation in-fills zeros or ones, independently of the carry flag.
I'm trying to emulate the following C code:
#include <stdlib.h>
#include <stdint.h>
void xprintf(const char *fmt, unsigned int val)
{
(void)fmt;
volatile unsigned int xxx = val;
(void)xxx;
}
int main(void)
{
volatile uint16_t val1 = 0xf001;
volatile uint16_t val2 = 0x4f85;
xprintf("res: %#x\n", val1 ^ (val2>>4));
return 0;
}
I think I run into a problem with the right-shift (val2>>4). This code is compiled as:
c04a: b4 40 85 4f mov #20357, -4(r4) ;#0x4f85, 0xfffc(r4)
c04e: fc ff
c050: 1f 44 fc ff mov -4(r4), r15 ;0xfffc(r4)
c054: 12 c3 clrc
c056: 0f 10 rrc r15
c058: 12 c3 clrc
c05a: 0f 10 rrc r15
c05c: 12 c3 clrc
c05e: 0f 10 rrc r15
c060: 12 c3 clrc
c062: 0f 10 rrc r15
In the online emulator I get the sequence of values of:
0x4f85
0xa7c2
0xd4e1
0x69f0
0xb4f8
I.e. sometimes I get a zero infill, sometimes I get a 1 infill, even though the carry flag should be cleared by the clrc instruction.
I compile with msp430-gcc version 4.6.3:
msp430-gcc -mmcu=msp430g2553 -O0 -g -W -Wall -std=c99 -c -o main.o main.c
msp430-gcc -mmcu=msp430g2553 -O0 -g -o firmware.elf main.o
@RudolfGeosits I just found this tool and I think is great. Unfortunately, I can't run either the examples provided here or the code I am compiling by myself. Is the tool online but not working or I am missing something? What is the process for running the examples or compiled code?
Thanks for the answer!
It trows following warnings and error:
In file included from main.h:57:0,
from main.c:19:
debugger/websockets/emu_server.h:90:27: warning: ‘enum libwebsocket_callback_reasons’ declared inside parameter list
void user, void *in, size_t len);
^
debugger/websockets/emu_server.h:90:27: warning: its scope is only this definition or declaration, which is probably not what you want
debugger/websockets/emu_server.h:90:27: warning: ‘struct libwebsocket’ declared inside parameter list
debugger/websockets/emu_server.h:90:27: warning: ‘struct libwebsocket_context’ declared inside parameter list
debugger/websockets/emu_server.h:95:26: warning: ‘enum libwebsocket_callback_reasons’ declared inside parameter list
void *user, void *in, size_t len);
^
debugger/websockets/emu_server.h:95:26: warning: ‘struct libwebsocket’ declared inside parameter list
debugger/websockets/emu_server.h:95:26: warning: ‘struct libwebsocket_context’ declared inside parameter list
debugger/websockets/emu_server.h:97:38: error: array type has incomplete element type ‘struct libwebsocket_protocols’
static struct libwebsocket_protocols protocols[] = {
^
main.c: In function ‘main’:
main.c:80:3: warning: implicit declaration of function ‘display_registers’ [-Wimplicit-function-declaration]
display_registers(emu);
^
main.c:81:3: warning: implicit declaration of function ‘disassemble’ [-Wimplicit-function-declaration]
disassemble(emu, cpu->pc, 1);
^
Makefile:12: recipe for target 'main.o' failed
make: ** [main.o] Error 1
It seems like that link to the emulator is broken: http://www.msp430emulator.com/emu.html
Jump +778 jumps backwards.
devices/cpu/formatIII.c:decode_formatIII contains the following code:
int16_t signed_offset = (instruction & 0x03FF) * 2;
bool negative = signed_offset >> 9;
char value[20];
char mnemonic[100] = {0};
/* String to show hex value of instruction */
char hex_str[100] = {0};
sprintf(hex_str, "%04X", instruction);
if (negative) { /* Sign Extend for Arithmetic Operations */
signed_offset |= 0xF800;
}
The sign on bit 9 is tested after the offset is already multiplied by 2, without adjusting for the shift of one bit to the left, yielding an incorrectly negative value.
Multiplying the offset after the sign test and sign extension (with mask set to 0xFC00 to adjust) seems to work correctly and is more readable.
While using the emulator online, I could not give inputs to the microcontroller via S2 pushbutton on the launchpad. I could not find any interface to give digital inputs via the ports. Am I missing something?
Hello,
I compiled my code but the emulator can't recognize the format when loading the file.
Is there instrcution as to which format should I use?
Thanks
I can't reach the webpage.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.