I've heard about a few small lawsuits here and there, but honestly most of the game companies aren't that worried about end-users; especially flashcart end-users who already bought the hardware. They're more interested in the programmers of the emulators and flashcart firmwares, and the manufacturers of the flash carts. However, as you stick to homebrew programming, it is technically legal - that's part of the ruling Tengen got back in the day, claiming that Nintendo North America was acting against market interests, yadda-yadda. Now, ROM piracy and emulation is a slightly different scenario, but comparatively the fact is that they really don't care anymore.