Skip to content

Commit cde2bd4

Browse files
committed
move to generic target and .cargo/config
1 parent 6c3090d commit cde2bd4

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

.cargo/config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[target.msp430]
2+
rustflags = [
3+
"-C",
4+
"linker=./msp-gcc.sh",
5+
"-C",
6+
"link-arg=-Lldscripts",
7+
"-C",
8+
"link-arg=-Tmsp430g2553.ld",
9+
"-C",
10+
"link-arg=-nostartfiles",
11+
]

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
DEVICE = msp430g2553
2-
TARGET = target/$(DEVICE)/release/msp
1+
TARGET = target/msp430/release/msp
32

43
all:
5-
xargo build --release --target $(DEVICE)
4+
xargo build --release --target msp430
65
msp430-elf-objdump -Cd $(TARGET) > $(TARGET).lst
76
msp430-elf-size $(TARGET)
87

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Steps:
1616
* Build the project: `$ make`
1717
* or you can build it using xargo directly (if you don't like `make`)
1818

19-
`$ xargo build --release --target msp430g2553`
19+
`$ xargo build --release --target msp430`
2020
* Flash the firmware using mspdebug: `$ make prog`
2121

2222
## How it works
@@ -44,10 +44,9 @@ Steps:
4444

4545
To run this code on the other boards and MCUs, you need to change it in few places:
4646
* Get a linker script for your MCU from msp430-elf-gcc include directory, and place it
47-
inside `ldscripts` folder.
48-
* Rename `msp430g2553.json` and modify it to point to the right liker script from step 1
47+
inside `ldscripts` folder. (Don't forget to get `*_symbols.ld` one as well).
48+
* Modify `.cargo/config` file so it would point to your ld script from step 1.
4949
* Modify `msp-gcc.sh` so it would pass the right mcu name to the gcc.
50-
* Modify `DEVICE` variable inside a Makefile.
5150

5251
## Board
5352

msp430g2553.json renamed to msp430.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"arch": "msp430",
33
"data-layout": "e-m:e-p:16:16-i32:16:32-a:16-n8:16",
44
"executables": true,
5-
"features": "-ext",
65
"llvm-target": "msp430",
76
"max-atomic-width": 0,
87
"no-integrated-as": true,
@@ -11,10 +10,5 @@
1110
"relocation-model": "static",
1211
"target-endian": "little",
1312
"target-pointer-width": "16",
14-
"linker": "./msp-gcc.sh",
15-
"post-link-args": [
16-
"-Lldscripts",
17-
"-Tmsp430g2553.ld",
18-
"-nostartfiles"
19-
]
13+
"vendor": "unknown"
2014
}

0 commit comments

Comments
 (0)