Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
carticket
Jun 28, 2005

white and gold.

I started out CS, switched to CpE before classes started, at some point switched to EE, and then switched back to CpE.

Adbot
ADBOT LOVES YOU

Pollyanna
Mar 5, 2005

Milk's on them.


Anyone got suggestions for diving into assembly programming (Z80, 6502, etc.)? I've been interested in it ever since I put together a CHIP-8 VM but never really figured out how to get started with a deep dive, especially on OSX.

carticket
Jun 28, 2005

white and gold.

I'd suggest ARM assembly. It's a neat language to learn, and there are a LOT of ARM devices to use.

Pollyanna
Mar 5, 2005

Milk's on them.


Mr. Powers posted:

I'd suggest ARM assembly. It's a neat language to learn, and there are a LOT of ARM devices to use.

Sounds interesting, but my Google Fu is failing me - I'm not sure what toolchain I should use, or how to write the files and everything. Seems like there's a lot of one-off options out there for OSX but no commonly agreed-upon answer, especially for something that seems relatively basic like assembly programming. A newbie's guide would be really helpful, especially if it's OSX-specific! I might also hunt down a book or something for some guidance...

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

Why do you think you want to program directly in assembly?

e: play TIS-100 instead

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer

peepsalot posted:

Why do you think you want to program directly in assembly?

e: play TIS-100 instead

I was thinking the same thing, just play really any Zachtronic game if you have nothing in particular you want to accomplish.

carticket
Jun 28, 2005

white and gold.

It looked like Human Resource Machine was a good assembly intro, too.

Silver Alicorn
Mar 30, 2008

𝓪 𝓻𝓮𝓭 𝓹𝓪𝓷𝓭𝓪 𝓲𝓼 𝓪 𝓬𝓾𝓻𝓲𝓸𝓾𝓼 𝓼𝓸𝓻𝓽 𝓸𝓯 𝓬𝓻𝓮𝓪𝓽𝓾𝓻𝓮

Pollyanna posted:

Sounds interesting, but my Google Fu is failing me - I'm not sure what toolchain I should use, or how to write the files and everything. Seems like there's a lot of one-off options out there for OSX but no commonly agreed-upon answer, especially for something that seems relatively basic like assembly programming. A newbie's guide would be really helpful, especially if it's OSX-specific! I might also hunt down a book or something for some guidance...

I'm at work right now so I can't reference much, but hit me up later and I'll try to find some of the info I used when I was hacking on the Nintendo DS

Hint, arm assembly is really niche and there aren't really any in depth guides. I learned a lot by disassembling homebrew demos

Spatial
Nov 15, 2007

Hi Pollyanna. Part of my day job is writing ARM assembly. There's a small chance a device you own runs my fast memcpy implementation. :banjo:

I would recommend starting off with an ARM Cortex M3. Simple enough to understand without being overly limited. Plus they're as cheap as dirt. A board with an integrated debugger that runs off a single USB cable is under $15 shipped.

I found the best way to get familiar with assembly language was to write some C code, look at how it compiles, then check out the ARM reference manual to find out what the instructions do. More detail here. They are terribly unclear manuals very obviously written by hardware people, but you'll get a feel for it after a while.

If you'd like, I can give you a whole project with commented example assembler you can open in IAR EWARM. (Not sure if it runs on OSX). It has a simulator so you don't need any hardware to run code. It's a crap IDE, but fairly straightforward and will allow you to assemble code and step through it. It's free to use as long as the project compiles to 32KB or less (get the Kickstart version). Only restriction is that to see the assembly output of a C program you have to run it in the simulator and step through.

Spatial fucked around with this message at 22:16 on Jun 2, 2017

carticket
Jun 28, 2005

white and gold.

Do you work for IAR?

Spatial
Nov 15, 2007

No, but I do use EWARM at work. Sometimes this results in posts to the coding horrors thread.

Hoping to cut some IAR fools? :v:

carticket
Jun 28, 2005

white and gold.

No, I like IAR. Good toolchain, but the IDE is about a decade behind where it should be.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Write homebrew video games for old consoles :sun:

NES has a lot of tools and is documented inside and out. 6502 assembly is pretty fun. cc65 is a C compiler and assembler combo that can spit out NES ROM images.

Spatial
Nov 15, 2007

IAR, go to the definition of this function. *nothing happens* *fart*

IAR, autocomplete this name. *the screen flickers, then nothing happens* *fart*

Thankfully searching works well enough.

carticket
Jun 28, 2005

white and gold.

Spatial posted:

IAR, go to the definition of this function. *nothing happens* *fart*

IAR, autocomplete this name. *the screen flickers, then nothing happens* *fart*

Thankfully searching works well enough.

The eclipse plugin is a little hokey, but it works and lets you use a modern IDE.

Spatial
Nov 15, 2007

I'll have to give that a shot, thanks.

JawnV6
Jul 4, 2004

So hot ...

Silver Alicorn posted:

Hint, arm assembly is really niche and there aren't really any in depth guides. I learned a lot by disassembling homebrew demos
How's that now?

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer

JawnV6 posted:

How's that now?

Cause everyone is actually using Thumb mode.

Pollyanna
Mar 5, 2005

Milk's on them.


Luigi Thirty posted:

Write homebrew video games for old consoles :sun:

NES has a lot of tools and is documented inside and out. 6502 assembly is pretty fun. cc65 is a C compiler and assembler combo that can spit out NES ROM images.

That's what I wanted to do. This all started because I wanted to try writing a Game Boy emulator, then decided it'd be easier to learn assembly first, so I started looking into the Z80 and 6502. I was looking for tools and resources on programming the latter (i.e. NES) for my first venture. I got stuck on finding a way to assemble 6502 ASM on OSX, though.

It seems that I can use cc65 on OSX though! I haven't the faintest on how to get IO stuff happening so I can see what happens if I do X Y Z, but I think I can figure that out.

And yes, I've played TIS-100, Shenzhen IO, and am currently playing Human Resources Machine. They're very fun (though TIS-100 made me want to die at points).

Luigi Thirty
Apr 30, 2006

Emergency confection port.

The Nesdev wiki documents pretty much everything.

Pollyanna
Mar 5, 2005

Milk's on them.


Luigi Thirty posted:

The Nesdev wiki documents pretty much everything.

If this will help me learn 6502 assembly as well as NES dev, then I'll start here for sure. Thanks!

Edit: aaand I'm already lost. I'll figure it out somehow, though.

Pollyanna fucked around with this message at 00:39 on Jun 3, 2017

nmfree
Aug 15, 2001

The Greater Goon: Breaking Hearts and Chains since 2006

Pollyanna posted:

If this will help me learn 6502 assembly as well as NES dev, then I'll start here for sure. Thanks!

Edit: aaand I'm already lost. I'll figure it out somehow, though.

The Something Awful Forums › Discussion › Serious Hardware/Software Crap › The Cavern of COBOL › aaand I'm already lost. The Embedded Programming Microthread!

feedmegin
Jul 30, 2008

Popete posted:

Cause everyone is actually using Thumb mode.

Not in 64 bit they're not.

carticket
Jun 28, 2005

white and gold.

Everyone should be using Universal ARM Assembler.

yippee cahier
Mar 28, 2005

I'm really impressed with ChibiOS' HAL component after only a day of messing around and integrating it into my build system. I'm kinda leaning towards getting rid of a collection of ST CubeMX and HAL uses left by my predecessors and replacing it with this. Using FreeRTOS, but the osal abstraction seems like it'll be pretty clean. Any drawbacks I should look out for or should I plunge into it?

carticket
Jun 28, 2005

white and gold.

My time with ChibiOS was miserable.

yippee cahier
Mar 28, 2005

I'm more interested in the HAL with prewritten drivers that use DMA and that optionally support an RTOS. Tired of seeing vendor libraries where the UART driver spins on the transmit register empty flag. What didn't you like?

carticket
Jun 28, 2005

white and gold.

The internals are all over the place and a bunch of default behaviors are completely not realtime unless you flip a switch to nondefault behavior. It also choked under heavy interrupt load (i.e. crashed), so I suspect there is a bug in the port. This was back in 2.x, though.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
The HAL drivers seemed fairly awful (slow and unergonomic) when I tried using them, but portability isn't a huge concern for what I'm doing so it might be more painful than just going your own way if you need enough different chips to run the same code.

carticket
Jun 28, 2005

white and gold.

The only ports for the HAL are for STM32s of various types. I don't know if that's really any more portable than CubeMX generated code.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
The CubeMX generates HAL code I believe. I just use manual register manipulation, because it's by far nicer to just work from the documentation, since there's not that much that the official code does for you that is actually good if you know what you're doing, the interface is mostly the same as the hardware with some slightly nicer register macros than the old libraries but with a ton of super obvious error checking to slow things down.

Volguus
Mar 3, 2009
After a couple of days of figuring out the correct incantation to get the RN42 bluetooth module working, i finally saw the leds blinking, the commands being written and responses being read. It's loving black magic and the documentation writers are the laziest people on the planet. If you change UART pin 0 to be pin 4, please loving update the drat poo poo so that i don't lose my mind. Or that the default state of the device is X instead of Y, that's fine, but would letting me know about it kill ya?

Sigh. I'm on my way to finally have a bluetooth driver working. I need a beer :cheers: .

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
I hate doing low power stuff on small boards. Where's this power going? Who knows and nobody wants to spend hours cutting traces and putting in a bypass to measure

JawnV6
Jul 4, 2004

So hot ...
Just put jumpers everywhere with a DNP 0ohm bypass :v:

Hyvok
Mar 30, 2010

JawnV6 posted:

Just put jumpers everywhere with a DNP 0ohm bypass :v:

Even this is not so easy. What happens quite often then is that chips get powered on via IO-signal ESD protection diodes (there are internal diodes going from each each IO pin to Vcc and ground) and then they can work erratically or just fine. So you need to be really sure the things are ACTUALLY turned off by removing the jumper. 0 ohm jumpers is usually a good idea though, easier to work with them than cutting traces.

There are some pretty neat power analyzers (from Keysight for example) which enable you to pinpoint power use to some certain lines of code etc.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

nmfree posted:

The Something Awful Forums › Discussion › Serious Hardware/Software Crap › The Cavern of COBOL › aaand I'm already lost. The Embedded Programming Microthread!

[Ask] me about figuring out how to drive a TMS5220 LPC speech chip using a 6502 accepting commands from a 68000, with speech data created using a program for Windows 3.1 from nothing but datasheets and MAME source code :suicide:

It works real well now though!

TTerrible
Jul 15, 2005

Luigi Thirty posted:

[Ask] me about figuring out how to drive a TMS5220 LPC speech chip using a 6502 accepting commands from a 68000, with speech data created using a program for Windows 3.1 from nothing but datasheets and MAME source code :suicide:

It works real well now though!

I would like to know more. :stare:

hendersa
Sep 17, 2006

TTerrible posted:

I would like to know more. :stare:

You'll get all that and more through his Patreon. This is the sort of stuff that I am happy to be a patron for. :eng101:

JawnV6
Jul 4, 2004

So hot ...

Hyvok posted:

There are some pretty neat power analyzers (from Keysight for example) which enable you to pinpoint power use to some certain lines of code etc.
I'm not really understanding how this would work in the case where cutting traces helps.

"Boy howdy these wfi instructions are burning sooooo much power, better get rid of them!"

Adbot
ADBOT LOVES YOU

carticket
Jun 28, 2005

white and gold.

Anyone here a Keil user? I'm evaluating their middleware, and I'm a bit lost with their IDE. I've installed a bunch of support packs and tried to build the FRDM-K64 HTTP server example, but it doesn't build. It doesn't claim to be missing any packs anymore, but it looks like the API has changed with the example having not been updated with it. Maybe it's something easy.

  • Locked thread