Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Al

Pages: [1]
1
µTasker general / Re: Serial Loader Timout - back to Application
« on: January 22, 2021, 09:12:09 PM »
Thanks, Mark.

RESET_ON_EJECT did the trick!

It never fails to amaze me how awesome uTasker is.  Thank you for all your hard work developing it and, especially, for making it availabe to all of us.  Much appreciated!

Al

2
µTasker general / Serial Loader Timout - back to Application
« on: January 22, 2021, 06:28:07 AM »
I have everything working with the MSD-device serial loader but have one remaining issue.  The application is a full function battery monitor *inside* a line of high capacity lithium batteries (for marine and auto use).  Since the system is inside a sealed battery, there is no way to recycle power to the system as it is started at the battery factory and runs forever from there.  The concern is that a user or technician can get the system into the serial loader and not have a way to recover.

There is a membrane button switch assembly on the battery to restart the system via a serial connection (among othe things) and if the user holds a specific key while the start-up is in process, the serial loader executes (via FORCE_BOOT).  Once in the serial loader. there is no way to return to the application since the serial port no longer exists.

I am looking for a way to have the serial loader timeout and return to the application.  I could enable the SREC serial loader in addition to the MSD-device but don't know how to use that to get back to the applicaiont firmware. The concern here is that while the serial loader menu  would come up, the user would connect to the system with a PC *after* the menu was sent. I was thinking of how to use the watchdog timer but the timout would have to be maybe 30 seconds but I don't see how to do that.

Any advice on this problem is appreciated!

Thanks
Al


3
NXPTM M522XX, KINETIS and i.MX RT / Re: Serial Loader and EEPROM
« on: January 19, 2021, 07:44:32 PM »
Mark,

The serial loader wasn't clearing out EEPROM, I was! 

When this project is complete I will inialize the EEPROM using external means but right now the way I am initializing EEPROM is using the firmware itself using a #define.  I would run the firmware once to load EEPROM and then turn of the EEPROM #define and load it again, all of that without the serial loader.  Then I would rebuild using *ld file for the serial loader and use a JLINK to load the serial loader.  Well... to load the serial loader I had to erase the chip.  That is where I messed up. Of course the EEPROM was getting cleared!

I can't believe how dumb I was about this!  I apologize for all the confusion.

Al

4
NXPTM M522XX, KINETIS and i.MX RT / Re: Serial Loader and EEPROM
« on: January 19, 2021, 05:05:05 PM »
Could the problem be in my linker load file? 

I am using the "standard" Teensy file (attached) and building the application code using PlatformIO/VSCode which uses the GCC toolchain. I modified the start address to 0x00008080.  I attempted to use K_256_64.ld in the uTasker GNU_Kinetis folder but the linking fails as follows.  I know next to zero about linker scripts.  Do you see anything in here that could cause the EEPROM overwrite?

Code: [Select]
Linking .pio\build\teensy3x\firmware.elf
c:/users/al testani/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: section .fini loaded at [00008080,00008083] overlaps section .text loaded at [00000414,00019723].pio\build\teensy3x\libFrameworkArduino.a(mk20dx128.c.o): In function `ResetHandler':
mk20dx128.c:(.startup+0x17c): undefined reference to `_edata'
mk20dx128.c:(.startup+0x180): undefined reference to `_etext'
mk20dx128.c:(.startup+0x184): undefined reference to `_sdata'
mk20dx128.c:(.startup+0x188): undefined reference to `_sbss'
mk20dx128.c:(.startup+0x18c): undefined reference to `_ebss'
.pio\build\teensy3x\libFrameworkArduino.a(mk20dx128.c.o):(.data.__brkval+0x0): undefined reference to `_ebss'
.pio\build\teensy3x\libFrameworkArduino.a(mk20dx128.c.o):(.vectors+0x0): undefined reference to `_estack'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\teensy3x\firmware.elf] Error 1

EDIT:  I attached the wrong file.  The correct one is now attached

5
µTasker general / Re: Jump to Serial Loader from Within Application code
« on: January 19, 2021, 03:40:43 PM »
I thought you were saying to somehow use that pin to "programmatically" tell the serial loader to go into load mode so the jump works.

Thanks for the information on this.

6
µTasker general / Re: Jump to Serial Loader from Within Application code
« on: January 19, 2021, 07:06:22 AM »
I will look at the mailbox approach but another question...

Would you elaborate on what you mean by "set the force loader input" in the following, please?
Quote
If you set the force loader input and jump it will probably run the serial loader.

Thanks
Al

7
µTasker general / Re: Jump to Serial Loader from Within Application code
« on: January 19, 2021, 03:58:42 AM »
Hi Mark

That does cause a jump but to the application not the serial loader. 

I defined the start_application function as you said:

Code: [Select]
//===============================================
extern void start_application(unsigned long app_link_location)
//===============================================
{
    asm(" ldr sp, [r0,#0]");  // load the stack pointer value from the program's reset vector
    asm(" ldr pc, [r0,#4]");  // load the program counter value from the program's reset vector to cause operation to continue from there
}

I have the following code in the startup of the application:

Code: [Select]
// TEST ------------------------------
prtStrD("Delaying 4 seconds then jumping to serial loader...");
for (int ii=0; ii<4; ii++)
{
delay(1000); 
Serial.println(ii);
}
start_application(0);
// TEST ------------------------------

I loaded the application using the serial loader which was previously loaded directly.  The serial loader loads the code and starts it but the above startup code simply executes over and over again.  What am I missing?

Thanks
Al

8
NXPTM M522XX, KINETIS and i.MX RT / Re: Serial Loader and EEPROM
« on: January 19, 2021, 03:21:31 AM »
I tried setting both the EEPROM and then both Dataflash and EEPROM protect to zero (from 0xff) and neither worked, i.e. the EEPROM was still overwritten (cleared to 0xFF).  I don't know if further EEPROM operation was permitted or not.  I put the two defines back to 0xff and rebuilt the serial loader

You are probably correct that it is another explanation but at this point I am not sure what that is.  Any ideas?

9
µTasker general / Re: Jump to Serial Loader from Within Application code
« on: January 19, 2021, 02:52:19 AM »
Thanks... I will look into this  tomorrow.

However, isn't there an easier way to just jump to the serial loader start address from my C/C++ code? I've tried using function pointers, inline ASM. etc. to jump to 0x0000 but none of them work.  Is 0x0000 not the place to jump to?

10
µTasker general / Jump to Serial Loader from Within Application code
« on: January 19, 2021, 12:31:21 AM »
What is the best way to do this?  I am using the MSD device serial loader.

Basically, I need to start the serial loader from a PC application that is sending a command over serial.  I want that command to execute the jump to the serial loader.  Everything works fine using a switch held during power up but I am looking for a programatic way to invoke the serial loader.


Thanks
Al

11
NXPTM M522XX, KINETIS and i.MX RT / Re: Serial Loader and EEPROM
« on: January 19, 2021, 12:06:52 AM »
Thanks for the reply, Mark.

The data being deleted is strictly in EEPROM.  I am using the Teensy libraries for this project, specifically:
Code: [Select]
    EEPROM.h - EEPROM library
  Original Copyright (c) 2006 David A. Mellis.  All right reserved.
  New version by Christopher Andrews 2015.
  This copy has minor modificatons for use with Teensy, by Paul Stoffregen

I read the contents of multiple EEPROM locations (including strings) on start-up and write occasionally during code execution.  I have code controlled by a #define to load the EEPROM for test pruposes but this is commented out in application the serial loader uses. 

Do the defines I mentioned in my original post have anything to do with protecting EEPROM?

Thanks
Al


12
NXPTM M522XX, KINETIS and i.MX RT / Serial Loader and EEPROM
« on: January 18, 2021, 08:09:15 PM »
I have the MSD serial loader working with a custom NXP MK20DX256 board (same processor as on a Teensy 3.1 and 3.2).  I have searched but cannot find how to prevent the serial loader from overwriting the processor EEPROM. 

I did find these lines in app_hw_kinetis.h but am unsure how to use them (or even if they are appropriate).

#define KINETIS_FLASH_CONFIGURATION_EEPROM_PROT        0xff
#define KINETIS_FLASH_CONFIGURATION_DATAFLASH_PROT     0xff

Is this the way to do it and if so what do I set the values to?

Pages: [1]