[Tool]FemtoIDE

To ease this situation, I’m considering changing the My_settings.h that comes with FemtoIDE’s template project into something like this:

// This file is organized into the following sections:
// COMMON       - Stuff you are very likely to customize
// SOUND        - All the sound-related options
// TASMODE      - Settings specific to TASMode
// MISC
// ---- SECTION: COMMON ----

// Choose a Screen Mode
// For more information on each mode, see:
// https://talk.pokitto.com/t/wiki-5-pokitto-screen-modes/1180
// Optional. Default is MODE_FAST_16COLOR.
#define PROJ_SCREENMODE MODE_FAST_16COLOR
//#define PROJ_SCREENMODE MODE_HI_4COLOR
//#define PROJ_SCREENMODE MODE13
//#define PROJ_SCREENMODE TASMODE // See also SECTION: TASMODE
//#define PROJ_SCREENMODE MODE13
//#define PROJ_SCREENMODE MODE15
//#define PROJ_SCREENMODE MIXMODE
//#define PROJ_SCREENMODE MODE64


// Choose how to use Pokitto's "extra" 4kb of RAM.
// Optional. Can be:
//   HIGH_RAM_OFF   - Needed for USB to work
//   HIGH_RAM_ON    - Simply enable the RAM hardware
//   HIGH_RAM_MUSIC - Enable and move the soud buffers to high RAM
// Default is HIGH_RAM_OFF.
#define PROJ_HIGH_RAM HIGH_RAM_OFF


// Choose whether to show the startup logo
// Optional. Can be 0 or 1, default is 1.
#define PROJ_STARTUPLOGO 1

// ---- SECTION: SOUND ----


// Choose whether to enable sound or not.
// Optional. Can be 0 or 1. Default is 1.
#define PROJ_ENABLE_SOUND 1


// Enable Pokitto::Sound::playSFX
// Optional. Comment to disable.
#define PROJ_ENABLE_SFX


// Enable streaming music from SD
// Optional. Comment to disable.
#define PROJ_ENABLE_SD_MUSIC


// Enable Synth
// Optional. Can be 0 or 1. Default is 0.
#define PROJ_ENABLE_SYNTH 0


// ---- SECTION: TASMODE ----
// These settings only apply to TASMODE

// Choose the maximum amount of sprites that can be drawn per frame.
// Higher values consume more RAM.
// Optional. Default is 100.
#define PROJ_MAX_SPRITES 100


// Choose the height in pixels of each tile
// Higher values consume more RAM.
// Optional. Default is 16.
#define PROJ_TILE_H 16


// Choose the width in pixels of each tile
// Higher values consume more RAM.
// Optional. Default is 16.
#define PROJ_TILE_W 16


// Choose how many types of tile can be used per map
// Optional. Can be 16 or 256. Default is 16.
#define MAX_TILE_COUNT 16


// ---- SECTION: MISC ----


4 Likes

The problem with removing the macro system is that it is used by C files as well. Changing mbed and the filesystem libraries to not use macros is not trivial, and I prefer having macros for everything than a mix.

I also think that removing macros is something we should only consider for PokittoLib2. For the current library, we can greatly reduce the amount of #ifdefs with some organization.

1 Like

It depends on what the macro represents.

If it’s one of the standard feature detection macros like __cpp_constexpr then the value matters and simply testing for the macro’s presence isn’t always enough.

For the Pokitto settings, some could be a simple ‘exists or doesn’t exist’ without the value being important, but for others the value is important.

In the case of the screenmode macro, the approach of defining PROJ_SCREENMODE as a value representing a particular screen mode is better because instead of a set of conflicting ‘on/off’ values you end up with a single mutually exclusive value and thus don’t have to issue an error when someone accidentally declares two screen modes.

Really though the best solution is to avoid macros for anything other than feature detection and conditional compilation based on those features.


Which C files does the library currently use?
With some effort we could probably upgrade them to C++ files (depending how large they are).

Mbed doesn’t necessarily have to be adapted to not use macros,
but we can get rid of the Pokitto ‘settings’ macros with enough library development.
Similarly if we can develop a replacement filesystem library we can get rid of the filesystem macros (from future code at least).

It doesn’t have to happen all at once.

How do I exclude a folder in project.json? I see that there is “ignore”:

	"libs": {
		"Pokitto": [
			{
				"recurse": "${appPath}/PokittoLib/Pokitto",
				"ignore": "POKITTO_SIM|POKITTO_XTERNALS|ImageFormat|USBDevice|SDFileSystem|MicroPython|JoyHat|FileIO|Physics|Documentation|examples?|Physics|(?:.*_SIM.*)|main.cpp"
			}
		]
	},

So I quess it is something like this:

"ignore": "my_folder_to_exclude"

How do I do that for a subfolder in the project folder? Where do I put “ignore” (under which block?)

There isn’t currently a way to ignore files that are in the project.
I’ll add it to the next release. How does this look?

    "BUILDFlags": {
        "Pokitto": {
            "ignore": "my_folder_to_exclude"
        }
    },
2 Likes

Might be worth allowing regexes, despite the potential cost.
Also presumably an array of folder names will be permitted?

It is a regex. If you want to blacklist multiple files, it would be “file1|file2|file3”.

3 Likes

MixMode doesn’t currently work, there’s a problem with the scanType array.

Third “Tower of Strength” is hereby awarded to Felipe Manga

Without PyInSky and FemtoIDE, Pokitto scene would be much, much smaller and we are all in debt

Congratulations Felipe!

tower of strength @FManga

9 Likes

Was running to LSP errors like @spinal had, but on Fedora the fix was to install ncurses-compat-libs so I added that to the list on the wiki installation page.

1 Like

Release v0.1.7

  • Deleted Hello CPP
  • IDE: Prevent opening the same file multiple times
  • IDE: Fix commandline and multiple instances on Windows
  • IDE: No longer ask for keyring password
  • IDE: Allow contextmenu outside file tree
  • IDE: Add Edit -> Go to Declaration
  • IDE: Put directories first in file list
  • C++: Update PokittoLib
  • C++: Enable beautify.js for C++ code, some adjustments so it’s less likely to break code
  • C++: Better jump to error on compile
  • C++: Updated My_settings.h for C++ projects
  • C++: Added TAS template project
  • C++: Allow ignoring certain files during build
7 Likes

Love the splash screen!

4 Likes

Release v0.2.0 PunkJam Edition

8 Likes

One question about the latest version. Using the SpriteConverter script shows “TypeError: Cannot read property ‘frame’ of undefined”. I’ve looked at your Aseprite sprites and they are created with 1.3-dev. I’m using 1.2.17-x64 (the latest in Steam) and the frames format is a little bit different:

This is your bulletSprite for instance:

"frames": [
   {
    "filename": "bullets 0.aseprite",
    "frame": { "x": 0, "y": 0, "w": 8, "h": 8 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 8, "h": 8 },
    "sourceSize": { "w": 8, "h": 8 },
    "duration": 100
   },
   {
    "filename": "bullets 1.aseprite",
    "frame": { "x": 8, "y": 0, "w": 8, "h": 8 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 8, "h": 8 },
    "sourceSize": { "w": 8, "h": 8 },
    "duration": 100
   },...

And this is my test sprite:

"frames": {
   "player 0.aseprite": {
    "frame": { "x": 0, "y": 0, "w": 16, "h": 16 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 16, "h": 16 },
    "sourceSize": { "w": 16, "h": 16 },
    "duration": 100
   },
   "player 1.aseprite": {
    "frame": { "x": 16, "y": 0, "w": 16, "h": 16 },
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": { "x": 0, "y": 0, "w": 16, "h": 16 },
    "sourceSize": { "w": 16, "h": 16 },
    "duration": 100
   }
 },

I think that JSON difference is making the error. I’ll try to fix the script, but maybe someone has encountered this problem before.

Set aseprite to export an array instead of a hash and it should look the same.
If you do make changes to the script, it’s best to do it by adding support to hashes as well as arrays.

2 Likes

Yep, that did the trick, thanks a lot!

I only used Aseprite before in Zombie Jumpig :slight_smile:

1 Like

It has been one full year since the initial FemtoIDE release. The milestones that were set back then have been reached in some form or another. There will always be room for improvements, but all the features I wanted to see are in a useful state.

So it’s about time…

Release v1.0.0 PunkJam Edition

TL;DR

  • Simulator support on Linux and Windows!
  • Better debugging!
  • TASUI! LibLog! init/update! Cool stuff!

IDE Fixes

  • Update PokittoLib
  • Fixed P-Type/TAS-template tilemapconverter when there’s more than one MapEnum on a single tile
  • Added mingw-gcc to Windows build
  • Added Linux and Windows simulator support to projects
  • Improve directory and elf viewers
  • Fix bug in RAM space calculation
  • Added “Compile (debug)” and “Restart” menu options
  • Added support for disassembly debugging
  • Support for Single-instruction step and Next-instruction step
  • Made debugging feel more responsive
  • Automatically reload after compile if connected to J-Link
  • J-Link producess less log spam
  • Projects now have an IDE version identifier to facilitate patching
  • Reduce CPU-usage during log spam

PokittoLib highlights

  • Add init/update as an alternative to int main
  • Call jumpToLoader on powerup with C pressed
  • Fix crash with fileReadBytes/fileRewind
  • Fix bug with MemOps::copy when length == 0
  • Added LibLog
  • TAS 1BPP drawSprite support
  • Added SDFSFile and SIMFile
  • TASUI

What’s this init/update thing?!

To make Pokitto games more cross-platform, you can now use init/update instead of main.

#include <Pokitto.h>
#include <LibLog>
#include "Smile.h"

using PC=Pokitto::Core;
using PD=Pokitto::Display;

void init(){
    LOG("Hello World!\n");
    PD::persistence = true;
    PD::invisiblecolor = 0;
}

void update(){
    PD::drawBitmap(rand()%(PD::width-32), rand()%(PD::height-32), Smile);
}

Using int main() still works, but is frowned upon, as you can see here:

7 Likes

It is a really handy feature that you can run scripts directly from the IDE! I have a batch file which copies the binary to Pokitto. After building, I just put Pokitto in the flash mode and select “Open externally” for my FlashToPokitto.sh script (Linux). Voila! :slight_smile:

image

This is FlashToPokitto.sh:

!/bin/bash

dd bs=1024 conv=nocreat,notrunc if=/home/hannu/bin/FemtoIDE/projects/MyGame/MyGame.bin of=/media/hannu/CRP\ DISABLD/firmware.bin
read -t 5 -p "Finished!"
4 Likes

The simulator menu is a bit confusing in the ide. If I choose “Linux” from the menu, there are two menus of similiar content on IDE: “Debug” and “Simulator”. The titles look to describe different domains.
Choosing “start” from either will start building the project and start the binary. Then there is “Build” menu which has “Build” and “Build(debug)” items. It is not very obvious what binary they will build.

3 Likes

@dreamer This may be the right place to take a look at FemtoIDE. Definitely more information and history than the wiki as well.
It is a full dev environment :slight_smile: