This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

banking without bank switching with SILabs f12x

I have a unique application that is about to overflow 64k.

I can not use bank switching because of the overhead. PLEASE do not reply anything about how small the overhead is - I do not care, there IS overhead.

Now this application process ONLY ONE OF two formats "classic" and "current".

My idea is to locate all common code in the lower 32 k and, immediately after reset detect which format it is and set the COBANK bits so that either page 1 or page 2 would be code addresses 8000 to ffff to process the actual format.

I know of no simple way to do this, suggestions appreciated.

Erik

Cross posted on the SILabs forum.

Parents
  • "The usual solution to this quandary is a vector table. One well-known location, say the start of the bank region, contains a table with the addresses of the functions in the API ..."

    Or a table of JMP instructions to minimize the overhead...

    /* A table of vector (ASM JMP) instructions instead of pointers resides at
     * 0x8000 in both pages 1 and 2 with each vector LJMP'ing to its associated
     * function.  The target function addresses can be different for either page,
     * but the vector instruction is at its known location.  The overhead is an
     * LJMP.
     */
    #define F0  ((FP)0x8000)
    #define F1  ((FP)0x8003)
    #define F2  ((FP)0x8006)
    #define F3  ((FP)0x8009)
    
    typedef void (*FP)(void);
    
    void main(void)
    {
        /* Determine format and set COBANK accordingly, then ...
         */
    
        for (;;) {
            F0();   /* Generates an LCALL 0x8000, which LJMPs to f0. */
            F1();
            F2();
            F3();
        }
    }

Reply
  • "The usual solution to this quandary is a vector table. One well-known location, say the start of the bank region, contains a table with the addresses of the functions in the API ..."

    Or a table of JMP instructions to minimize the overhead...

    /* A table of vector (ASM JMP) instructions instead of pointers resides at
     * 0x8000 in both pages 1 and 2 with each vector LJMP'ing to its associated
     * function.  The target function addresses can be different for either page,
     * but the vector instruction is at its known location.  The overhead is an
     * LJMP.
     */
    #define F0  ((FP)0x8000)
    #define F1  ((FP)0x8003)
    #define F2  ((FP)0x8006)
    #define F3  ((FP)0x8009)
    
    typedef void (*FP)(void);
    
    void main(void)
    {
        /* Determine format and set COBANK accordingly, then ...
         */
    
        for (;;) {
            F0();   /* Generates an LCALL 0x8000, which LJMPs to f0. */
            F1();
            F2();
            F3();
        }
    }

Children