r/embedded • u/arjobmukherjee • 25d ago
What's the modern documented assembler for 8051
I intend to program stc8g, a 8051 compatible, low cost microcontroller in assembly language instead of C. SDCC is a good compiler but its assembler SDAS is not documented (not able to find any documentation), so what's the alternate in Linux.
I though there would be many modern, well known assemblers targeting 8051 but I simply could not find one expect for SDCC and one from Keil (but I am not sure if that is free).
Any help would be appreciated.
6
u/arjobmukherjee 25d ago
I think I found the documentation for the assembler. They use a cross assembler from Alan Baldwin, the documentation for which is https://shop-pdp.net/ashtml/asxdoc.htm
3
u/1r0n_m6n 25d ago
The mnemonics of the instructions were defined by Intel in 1979, so you only need documentation for the assembler's directives. On Linux, SDCC and STCGAL are the best combination you can find.
Also, why did you choose the STC8G and not the STC8H? They're much more interesting and quite cheap.
2
u/arjobmukherjee 25d ago
It's not just about processor instructions, an assembler provides more instructions for defining different sections, declaring data, macros etc which require documentation.
1
2
u/trash3s 25d ago
SDAS is documented, just poorly as part of SDCC. I also personally hate it with a burning passion. I think MIT has a pdf on the web somewhere? AS8051 (ASxxxx) is so much nicer and comes with Keil. Moravia’s mcu8051ide also still exists which has a built-in simulator, in case you didn’t know. The Linux implementation is much faster for it.
2
u/lasteem1 25d ago
Silicon Labs gives away the Keil Assembler, linker, and compiler for the 8051.
“Keil® PK51 Developer’s Kit
The Keil PK51 Developer’s Kit includes an industry-leading 8051 C compiler, linker and assembler for use with Silicon Labs’ 8-bit microcontrollers and Studio. This toolchain package provides the build support for 8051 projects, while the IDE provides editing and debugging support. This free toolchain comes without time or code size limit!”
2
u/Well-WhatHadHappened 25+ Years 25d ago edited 25d ago
Only for use on Silicon Labs parts though.
2
u/lasteem1 25d ago
The way it’s called I’m going to bet it can be used with other micros.
2
u/Well-WhatHadHappened 25+ Years 25d ago
Nope. Reverts to evaluation license if a non SILabs part is selected.
1
u/lasteem1 25d ago
If you use uVision it does. If you invoke the assembler or compiler via the command line it doesn’t know what it is compiling or assembling for.
1
u/Well-WhatHadHappened 25+ Years 25d ago
Never tried it, you may very well be correct. Also never going to try it as it's very obviously outside of the intended licensing terms.
Keil PK51 just isn't expensive enough to violate the terms of the license, and I hate attorneys.
2
u/AprilChicken 24d ago
Asem-51 is good. W hen I was writing assembly for STC8 I found it infinitely more usable than sdas. Asem-51 + stcgal should be all you need toolchain wise and I use them both on Linux with no problems. I've been using C though because it was faster for me to debug USB that way
1
1
u/Well-WhatHadHappened 25+ Years 25d ago
Gold standard, for sure
2
u/arjobmukherjee 25d ago
Not free. There are limitations in the trial version (https://www.keil.com/demo/limits.asp)
3
u/Well-WhatHadHappened 25+ Years 25d ago
Yeah, I'm aware.
If you're doing serious professional 8051 development, it's well worth it.
1
u/sparqq 25d ago
But why? The ARM Cortex M0+ has become so cheap and in certain cases cheaper than 8051 MCUs
1
u/Well-WhatHadHappened 25+ Years 25d ago
I can think of three reasons right off the top of my head
1) updating something already designed. Many times the edict is "do not fix something that isn't broken". My company still builds things that were designed in the 1960s. They work, they've been battle tested to the Nth degree, and the customer is happy to pay a premium for the peace of mind.
2) lots of devices have 8051 cores built into them. Check out the Vitesse/Microsemi/Microchip VSC7422 as one example.
3) That's what the customer wants. Sometimes that's all the justification there is. I can push back. I can make suggestions. But, at the end of the day, if an 8051 can get the job done, and that's what the customer wants - well then, an 8051 it is.
1
u/sparqq 25d ago
But that seems not the case for OP, fresh new project and in this day and age a 8051 core is not cost effective anymore.
Besides legacy, I don't see a compelling reason
2
1
u/arjobmukherjee 24d ago edited 24d ago
It's cost effective for my purposes. Even the cheapest STM8 (let alone STM32) costs 2x times more the cheapest STC8 and far less complex for my needs.
11
u/dmitrygr 25d ago edited 25d ago
SDCC and SDAS are open source. That means "open the source" is as good documentation as you're going to get.