Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time out error when writing to 128k Flash memory on hardware #2

Open
GearsProgress opened this issue Dec 2, 2023 · 0 comments
Open

Comments

@GearsProgress
Copy link

GearsProgress commented Dec 2, 2023

Initializing the Flash size as 128KB and then writing data causes a time out error. This issue only happens on physical hardware, not emulation. Running the following program on mGBA with a Flash 128KB save prints "all good". However, when uploaded to a GBA through Multiboot with a copy of Pokemon FireRed inserted, it returns "Two: 5", which refers to a time out error. The only other thing included besides the libsavgba library is Tonc's Text Engine for output.

int main(void){
	REG_DISPCNT = DCNT_MODE0 | DCNT_BG0 | DCNT_BG1 | DCNT_BG2 | DCNT_BG3 | DCNT_OBJ | DCNT_OBJ_1D;
        tte_init_se(3, BG_CBB(3) | BG_SBB(28) | BG_PRIO(0), 0, CLR_WHITE, 14, NULL, NULL);
	flash_init(FLASH_SIZE_128KB);

	u8 test = 1;
	int one = flash_read(0x1D7F0, &test, 1);
	if (one != 0){
		tte_set_pos(0,0);
		tte_write("one: ");
		tte_write(std::to_string(one).c_str());
		while(true){}
	}
	int two = flash_write(0x5000, &test, 1);
	if (two != 0){
		tte_set_pos(0,0);
		tte_write("two: ");
		tte_write(std::to_string(two).c_str());
		while(true){}
	}
	int three = flash_write(0x10000, &test, 1);
	if (three != 0){
		tte_set_pos(0,0);
		tte_write("three: ");
		tte_write(std::to_string(three).c_str());
		while(true){}
	}
	tte_set_pos(0,0);
	tte_write("All good!");
	while(true){}
}

Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant