Start var viewer, next is a trap viewer for FileClose

This commit is contained in:
meepingsnesroms
2018-04-05 17:23:05 -07:00
parent 7518246877
commit 416fa9c54c
11 changed files with 86 additions and 39 deletions

View File

@@ -11,7 +11,7 @@ CREATORID="guiC"
RESFILE=$APPNAME.rcp
PRC=$APPNAME.prc
SRCS="testSuite.c viewer.c tools.c cpu.c emuFunctions.c debug.c ugui.c"
SRCS="testSuite.c viewer.c tools.c tests.c cpu.c emuFunctions.c debug.c ugui.c"
DEFINES="-DHW_TEST -DDEBUG"
CFLAGS="-O2 -g $DEFINES"

View File

@@ -16,3 +16,4 @@ If you enable unsafe mode you will have to reboot to exit, this is because it wi
In the hex viewer registers that are not safe to read will say "UNSAFE" instead of a hex value, the main unsafe reads are the uart registers.
There is almost no memory, 4KB stack on some devices.
For some reason the official FileClose(FileHandle) crashes with "Fatal Exeption" on Clie Peg-SL10 and "illegal instruction 19F0 at 00000002" on Tungsten E and black screen reboot on Palm T|X, I think that it corrupts the stack triggering a jump to 0x00000000.

View File

@@ -234,7 +234,7 @@ static Boolean testerInit(){
framebuffer = BmpGetBits(offscreenBitmap);
UG_Init(&uguiStruct, uguiDrawPixel, SCREEN_WIDTH, SCREEN_HEIGHT);
UG_FontSelect(&FONT_4X6);
UG_FontSelect(&FONT_8X8);
UG_SetBackcolor(C_WHITE);
UG_SetForecolor(C_BLACK);
UG_ConsoleSetBackcolor(C_WHITE);

View File

@@ -7,7 +7,6 @@
/*defines*/
#define PalmOS35 sysMakeROMVersion(3,5,0,sysROMStageRelease,0)
#define PalmOS50 sysMakeROMVersion(5,0,0,sysROMStageRelease,0)
@@ -19,11 +18,11 @@
#define buttonSelect keyBitHard4
#define TYPE_NULL 0x00
#define TYPE_BOOL 0x01/*bool can share with uint*/
#define TYPE_UINT 0x01
#define TYPE_INT 0x02
#define TYPE_FLOAT 0x03
#define TYPE_PTR 0x04
#define TYPE_BOOL 0x01
#define TYPE_UINT 0x02
#define TYPE_INT 0x03
#define TYPE_FLOAT 0x04
#define TYPE_PTR 0x05
#define LENGTH_0 0x00/*for null*/
#define LENGTH_1 0x10
#define LENGTH_8 0x20

10
hwTestSuite/tests.c Normal file
View File

@@ -0,0 +1,10 @@
#include "testSuite.h"
#include "tools.h"
var testFileAccessWorks(){
uint32_t testTook = UINT32_C(0xFFFFFE00);
makeFile((uint8_t*)&testTook, 4, "FILEOUT.BIN");
exitSubprogram();
return makeVar(LENGTH_0, TYPE_NULL, 0);
}

7
hwTestSuite/tests.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef TESTS_HEADER
#define TESTS_HEADER
#include "testSuite.h"
var testFileAccessWorks();
#endif

View File

@@ -1,17 +1,18 @@
#include <PalmOS.h>
#include "testSuite.h"
#include "viewer.h"
#include "debug.h"
#include "ugui.h"
uint32_t makeFile(uint8_t* data, uint32_t size, char* fileName){
Err makeFile(uint8_t* data, uint32_t size, char* fileName){
FileHand file;
Err error;
uint8_t dataBuffer[100];//used to anonymize data source
uint32_t count;
file = FileOpen(0 /*cardNo*/, fileName, 'DATA', 'GuiC', fileModeReadWrite | fileModeAnyTypeCreator, &error);
if(!file || error)
file = FileOpen(0 /*cardNo*/, fileName, (uint32_t)'DATA', (uint32_t)'GuiC', fileModeReadWrite | fileModeAnyTypeCreator, &error);
if(file == fileNullHandle || error)
return error;
count = size;
@@ -28,11 +29,10 @@ uint32_t makeFile(uint8_t* data, uint32_t size, char* fileName){
count -= chunkSize;
}
error = FileClose(file);
if(error)
return error;
UG_PutString(0, 0, "File close next");
return 0;//success
error = FileClose(file);//I have no idea why, but this function causes a fatal execption but i still get valid data in the file after reboot
return error;
}
var hexRamBrowser(){
@@ -86,15 +86,7 @@ var hexRamBrowser(){
}
var dumpBootloaderToFile(){
makeFile((uint8_t*)UINT32_C(0xFFFFFE00), 0x200, "BOOTLOAD.BIN");
makeFile((uint8_t*)UINT32_C(0xFFFFFE00), 0x200, "BOOTLOADER.BIN");
exitSubprogram();
return makeVar(LENGTH_0, TYPE_NULL, 0);
}
var testFileAccessWorks(){
uint32_t testTook = UINT32_C(0xFFFFFE00);
makeFile((uint8_t*)&testTook, 4, "FILEOUT.BIN");
exitSubprogram();
return makeVar(LENGTH_0, TYPE_NULL, 0);
}

View File

@@ -1,10 +1,10 @@
#ifndef TOOLS_HEADER
#define TOOLS_HEADER
#include <PalmOS.h>
#include "testSuite.h"
uint32_t makeFile(uint8_t* data, uint32_t size, char* fileName);
Err makeFile(uint8_t* data, uint32_t size, char* fileName);
var hexRamBrowser();
var dumpBootloaderToFile();
var testFileAccessWorks();
#endif

View File

@@ -14,13 +14,13 @@
#define USE_COLOR_RGB565 // RGB = 0bRRRRRGGGGGGBBBBB
/* Enable needed fonts here */
#define USE_FONT_4X6
//#define USE_FONT_4X6
//#define USE_FONT_5X8
//#define USE_FONT_5X12
//#define USE_FONT_6X8
//#define USE_FONT_6X10
//#define USE_FONT_7X12
//#define USE_FONT_8X8
#define USE_FONT_8X8
//#define USE_FONT_8X12_CYRILLIC
//#define USE_FONT_8X12
//#define USE_FONT_8X12

View File

@@ -1,14 +1,15 @@
#include "testSuiteConfig.h"
#include "testSuite.h"
#include "tools.h"
#include "tests.h"
#include "debug.h"
#include "ugui.h"
#define MAX_OBJECTS 50
#define FONT_WIDTH 4
#define FONT_HEIGHT 6
#define FONT_WIDTH 8
#define FONT_HEIGHT 8
#define FONT_SPACING 0
#define RESERVED_PIXELS_Y (SCREEN_HEIGHT / 4)/*save pixels at the bottom of the screen for other information on the current item*/
@@ -81,7 +82,7 @@ static void hexHandler(uint32_t command){
uint32_t displayAddress = hexViewOffset - bufferAddress;
if(displayAddress + i < listLength){
/*Palm OS sprintf only supports 16 bit ints*/
StrPrintF(itemStrings[i], "0x%04X%04X:0x%02X", (uint16_t)(displayAddress >> 16), (uint16_t)displayAddress , readArbitraryMemory8(hexViewOffset));
StrPrintF(itemStrings[i], "0x%04X%04X:0x%02X", (uint16_t)(displayAddress >> 16), (uint16_t)displayAddress, readArbitraryMemory8(hexViewOffset));
hexViewOffset++;
}
else{
@@ -187,6 +188,36 @@ static var listModeFrame(){
return makeVar(LENGTH_0, TYPE_NULL, 0);
}
var valueViewer(){
static Boolean clearNeeded = true;
var value = getSubprogramArgs();
uint64_t varData = getVarValue(value);
if(getButtonPressed(buttonBack)){
/*go back*/
clearNeeded = true;
exitSubprogram();
}
if(clearNeeded){
char printBuffer[100];
debugSafeScreenClear(C_WHITE);
switch(getVarType(value)){
case TYPE_INT:
StrPrintF(printBuffer, "uint32_t:0x%04X%04X", (uint16_t)(varData >> 16), (uint16_t)varData);
UG_PutString(0, 0, printBuffer);
break;
default:
UG_PutString(0, 0, "Unknown Var Type");
break;
}
clearNeeded = false;
}
}
var hexViewer(){
var where = getSubprogramArgs();
@@ -204,7 +235,7 @@ var hexViewer(){
listLength = UINT64_C(0x100000000);
}
listHandler = hexHandler;
callSubprogram(listModeFrame);
execSubprogram(listModeFrame);
setDebugTag("Hex Viewer Starting");
@@ -215,7 +246,7 @@ var functionPicker(){
resetListHandler();
listLength = totalHwTests;
listHandler = testPickerHandler;
callSubprogram(listModeFrame);
execSubprogram(listModeFrame);
setDebugTag("Test Picker Starting");
@@ -227,15 +258,21 @@ void initViewer(){
totalHwTests = 0;
StrNCopy(hwTests[0].name, "Ram Browser", TEST_NAME_LENGTH);
hwTests[0].testFunction = hexRamBrowser;
StrNCopy(hwTests[totalHwTests].name, "Ram Browser", TEST_NAME_LENGTH);
hwTests[totalHwTests].testFunction = hexRamBrowser;
totalHwTests++;
StrNCopy(hwTests[1].name, "Dump Bootloader", TEST_NAME_LENGTH);
hwTests[1].testFunction = dumpBootloaderToFile;
/*
StrNCopy(hwTests[totalHwTests].name, "Get Trap Address", TEST_NAME_LENGTH);
hwTests[totalHwTests].testFunction = testFileAccessWorks;
totalHwTests++;
*/
StrNCopy(hwTests[totalHwTests].name, "Dump Bootloader", TEST_NAME_LENGTH);
hwTests[totalHwTests].testFunction = dumpBootloaderToFile;
totalHwTests++;
StrNCopy(hwTests[2].name, "File Access Test", TEST_NAME_LENGTH);
hwTests[2].testFunction = testFileAccessWorks;
StrNCopy(hwTests[totalHwTests].name, "File Access Test", TEST_NAME_LENGTH);
hwTests[totalHwTests].testFunction = testFileAccessWorks;
totalHwTests++;
}

View File

@@ -3,6 +3,7 @@
#include "testSuite.h"
var valueViewer();
var hexViewer();
var functionPicker();
void initViewer();