« first day (1620 days earlier)      last day (1233 days later) » 

12:57 PM
@traducerad did you define the EXTERN Mainprog in test.s?
 
 
2 hours later…
user7659542
2:54 PM
@Mgetz yes
 
also you don't want and shouldn't need to set the ORG value in the other modules. They are supposed to be relocatable
 
user7659542
My bad i m not always copying everything because the original code always contains lot of comments etc
 
Oh.. you're redefining Mainprog10 in your test.s
that's a problem
or more the point in the same module as your test main
which cannot be the case
 
user7659542
@Mgetz Dont know I’ve tried so many things its a big mess
 
user7659542
I d need concrete help to get me started and understsnd the issue once and for all
 
2:57 PM
@traducerad so the override must be in a separate module, also relocatable with that specific method declared specifically PUBLIC
it doesn't look like you are declaring modules either
 
user7659542
@Mgetz I’ve don’t that IIRC and got an error related to memory size
 
user7659542
@Mgetz i don’t have to do that explicitly
 
@traducerad it looks like to use PUBWEAK you do
 
user7659542
I managed to make it +\- work in an empty project without defining it explicitly
 
user7659542
Except...
 
user7659542
3:00 PM
This happened
 
user7659542
“Access odd adress” no idea what this means and how to solve this
 
user7659542
So it looks like there are multiple issues mixed
 
@traducerad it means the module is not aligned, or the method is not aligned see the linker directives in the manual on aligning
you probably need to be 2byte aligned
 
user7659542
3:18 PM
@Mgetz how does one do that? Frankly speaking, if you know how to get me started with the weak symbol part i d be willing to get in touch with you via codementor
 
user7659542
Do you use that platform?
 
nope
honestly man I'm just reading the docs and making best guesses
 
user7659542
So do i, but i m stuck up to this point
 
user7659542
Once i manage to get one working i think all the rest will go much more fluently
 
Psudo code:
    MODULE foobar
       RSEG CODE:CODE:NOROOT:REORDER(0) // 0 puts this at 2 byte alignment
       NAME MainProg10
       PUBWEAK MainProg10
    MainProg10:
       //code
    ENDMOD

    testFoobarmocks.s

    MODULE foobar
       RSEG CODE:CODE:NOROOT:REORDER(0) // 0 puts this at 2 byte alignment
       NAME MainProg10
       PUBLIC MainProg10
    MainProg10:
       //code
    ENDMOD

    test.s
    EXTERN MainProg10
    Main:
 
user7659542
4:09 PM
@Mgetz Ok thanks, will test this 1h or so
 
user7659542
6:25 PM
@Mgetz I tried to use this exact suggestion in a new blank template project, but there seems be an error with this. Although as far as I can see your suggestion corresponds to what is written in the system's manual it does not compile:
 
user7659542
test.s:
 
user7659542
#include "msp430.h"                     ; #define controlled include file

        NAME    main                    ; module name
        PUBLIC  main                    ; make the main label vissible
        EXTERN mainRoutine
        EXTERN someSub

        /*----------------------------------------------------------------------
         * MAIN
         *--------------------------------------------------------------------*/

        ORG     0FFFEh
        DC16    init                    ; set reset vector to 'init' label
 
user7659542
codeToTest.s:
 
user7659542
MODULE foobar
  RSEG CODE:CODE:NOROOT:REORDER(0)
  NAME someSub
PUBWEAK someSub
    someSub:
      ret
ENDMOD

mainRoutine:
    jmp someSub
    ret
 
user7659542
MODULE foobar
RSEG CODE:CODE:NOROOT:REORDER(0)
NAME someSub
PUBLIC someSub
someSub:
    ret

ENDMOD
 
user7659542
6:26 PM
mocks.s:
 
user7659542
Error message:
 
user7659542
End-Of-Module missing in codeToTest.s
Unexpected end of file encountered
Error while running Assebler

End-Of-Module missing in mocks.s
Error while running Assebler
 
@traducerad if you have one module in a file you need to have everything in a module in that file it looks
so you'd need a different module for mainRoutine or to include it in foobar
also you can't include the same module twice I don't think
the override would need to be barfoo
 
user7659542
6:42 PM
@Mgetz That s what I tried to, ie including mainRoutine in foobar like so:
 
user7659542
MODULE foobar
  RSEG CODE:CODE:NOROOT:REORDER(0)
  NAME someSub
PUBWEAK someSub
    someSub:
      ret

mainRoutine:
    jmp someSub
    ret

ENDMOD
 
that wouldn't work
 
user7659542
But that gave exactly the same error
 
because you have it in the same module you might swap out
if it's the last module in the file you need to put an END directive anyway
 
user7659542
I m not a fan of moving that module for someSub to the bottom of the file, I d like to keep everything as-is
 
user7659542
6:45 PM
What is the correct way of proceeding in codeToTest.s going from here?
 
user7659542
MODULE foobar
  RSEG CODE:CODE:NOROOT:REORDER(0)
  NAME someSub
PUBWEAK someSub
    someSub:
      ret

mainRoutine:
    jmp someSub
    ret

ENDMOD

END
 
user7659542
based on what you said, I guess I have to write something on the line before the label mainRoutine, but it s not clear what
 
6:58 PM
or you could just wrap mainroutine in its own module?
 
user7659542
@Mgetz nope, there is something else wrong, when I do so it says end-of-module missing for someSub and mainRoutine as well
 
user7659542
MODULE foobar
  RSEG CODE:CODE:NOROOT:REORDER(0)
  NAME someSub
PUBWEAK someSub
    someSub:
      ret
ENDMOD

MODULE mainRoutineModule
  RSEG CODE:CODE:NOROOT:REORDER(0)
  NAME mainRoutine
mainRoutine:
    jmp someSub
    ret

ENDMOD

END
 
user7659542
It specifically complains about these lines:
 
user7659542
NAME someSub
 
user7659542
and
 
user7659542
7:05 PM
NAME mainRoutine
 
user7659542
removing those lines leads to other issues. So I end up removing more lines up untill the point I get an error about the PC Offset being out of range
 
user7659542
so yhea...
 
user7659542
8:27 PM
@Mgetz are you supposed to include those other 2 files in test.s?
 
@traducerad Don't think so, the EXTERN wouldn't be necessary then and I'm pretty sure it is
 
user7659542
@Mgetz indeed. Yet, it still does not see the function. This is the current situation:
 
user7659542
test.s:
 
user7659542
#include "msp430.h"                     ; #define controlled include file

        NAME    main                    ; module name
        PUBLIC  main                    ; make the main label vissible
        EXTERN mainRoutine

        /*----------------------------------------------------------------------
         * MAIN
         *--------------------------------------------------------------------*/

        ORG     0FFFEh
        DC16    init                    ; set reset vector to 'init' label
 
user7659542
codeToTest.s:
 
user7659542
8:37 PM
MODULE foobar
  RSEG CODE:CODE:NOROOT:REORDER(0)
PUBWEAK someSub
    someSub:
      ret
ENDMOD

MODULE foobar
  RSEG CODE:CODE:NOROOT:REORDER(0)
EXTERN someSub
mainRoutine:
    jmp someSub
    ret

ENDMOD
END
 
user7659542
mocks.s:
 
user7659542
MODULE foobar
RSEG CODE:CODE:NOROOT:REORDER(0)
PUBLIC someSub
someSub:
    ret

ENDMOD
END
 
user7659542
And it still says:
 
EXTERN mainRoutine should be above the main declaration
at the top of the file
 
user7659542
You mean like so?
 
user7659542
8:38 PM
#include "msp430.h"                     ; #define controlled include file

        EXTERN mainRoutine
        NAME    main                    ; module name
        PUBLIC  main                    ; make the main label vissible

        /*----------------------------------------------------------------------
         * MAIN
         *--------------------------------------------------------------------*/

        ORG     0FFFEh
 
user7659542
If yes, the error persists
 
Yes
 
user7659542
Error[e46]: Undefined external "mainRoutine" referred in main
 
one sec, checking the manual
 
user7659542
thanks a lot :/
 
8:44 PM
@traducerad these can't all be named foobar
@traducerad and these need to be in separate segment parts
so CODE and CODET
you can only have one public definition of a symbol in any given segement part
 
user7659542
@Mgetz afaik only the definition inside mocks.s is public the other one is pubweak
 
> A symbol defined as PUBWEAK must be a label in a segment part, and it must be the only
symbol defined as PUBLIC or PUBWEAK in that segment part.
 
user7659542
This is how I corrected it so far:
 
user7659542
@Mgetz yes, i remember having read that. You re right, yet...
 
user7659542
codeToTest.s:
 
user7659542
8:48 PM
MODULE foobarSomeSub
  RSEG CODE:CODE:NOROOT:REORDER(0)
PUBWEAK someSub
    someSub:
      ret
ENDMOD

MODULE foobarMainRoutine
  RSEG CODE:CODE:NOROOT:REORDER(0)
EXTERN someSub
mainRoutine:
    jmp someSub
    ret

ENDMOD
END
 
user7659542
mocks.s:
 
user7659542
MODULE foobarSomeSubMock
RSEG CODET:CODE:NOROOT:REORDER(0)
PUBLIC someSub
someSub:
    ret

ENDMOD
END
 
user7659542
this leads to the same error, ie main not seeing the definition
 
@traducerad you may not be able to have these both in the same code segment
 
user7659542
MODULE foobarSomeSub
  RSEG CODE:CODE:NOROOT:REORDER(0)
PUBWEAK someSub
    someSub:
      ret
ENDMOD

MODULE foobarMainRoutine
  RSEG CODET:CODE:NOROOT:REORDER(0)
EXTERN someSub
mainRoutine:
    jmp someSub
    ret

ENDMOD
END
 
8:50 PM
@traducerad no I'm thinking it has to be completely different
CODEM
 
user7659542
@Mgetz replaced CODET from above by CODEM: same error
 
user7659542
all 3 are not in different segments using the RSEG directive
 
@traducerad CODET was fine, I meant move mainRoutine to CODEM
they are just random names
 
user7659542
CODE (for someSub), CODEM (for mainroutine) and CODET (for mock)
 
user7659542
-> same error
 
user7659542
8:54 PM
to be clear this is what I have:
 
user7659542
codeToTest.s:
 
user7659542
MODULE foobarSomeSub
  RSEG CODE:CODE:NOROOT:REORDER(0)
PUBWEAK someSub
    someSub:
      ret
ENDMOD

MODULE foobarMainRoutine
  RSEG CODEM:CODE:NOROOT:REORDER(0)
EXTERN someSub
mainRoutine:
    jmp someSub
    ret

ENDMOD
END
 
user7659542
mocks.s:
 
user7659542
MODULE foobarSomeSubMock
RSEG CODET:CODE:NOROOT:REORDER(0)
PUBLIC someSub
someSub:
    ret

ENDMOD
END
 
@traducerad again... not sure these can be in the same file... but dunno
 
user7659542
8:55 PM
I ll split them to check
 
user7659542
@Mgetz Nope...
 
hmm close and yet no luck
weird
OH LOL we're idiots
 
user7659542
tell me!
 
you forgot to make mainRoutine PUBLIC
so it's hidden
 
user7659542
fcking hell...
 
user7659542
9:00 PM
I m really the big idiot here
 
user7659542
jezus christ
 
worked that time?
 
user7659542
Yes!!!!
 
user7659542
It does mock when I want it to!!
 
user7659542
@Mgetz Is there any way I can thank you?
 
user7659542
9:01 PM
even a donnation is OK, really
 
user7659542
(I don t have an American wage though :p )
 
@traducerad NOPE.jpg
 
user7659542
Well either way, thanks a lot!
 
user7659542
@Mgetz If you ever happen to change your mind feel free to ping me
 
user7659542
Indeed it seems like you also need to put the module in a different file, if I am not mistaken
 
user7659542
9:04 PM
I quickly put it back in the same file (the 2 routines) and it doesn t see it neither
 
@traducerad yeah that's an EXTERN thing
 
user7659542
weird...
 
but it's not the worst thing in the world
you can just make a file with a ton of mocks in their own segments
technically the mocks can all be in the same module... just not the same segment if I'm reading the documentation right
up until 65535 of them
 
user7659542
@Mgetz how does that look like?
 
user7659542
Because putting them in a different segment but same file like so:
 
user7659542
9:06 PM
MODULE foobarSomeSub
  RSEG CODE:CODE:NOROOT:REORDER(0)
PUBWEAK someSub
    someSub:
      ret
ENDMOD


MODULE foobarMainRoutine
  RSEG CODE_I:CODE:NOROOT:REORDER(0)
EXTERN someSub
PUBLIC mainRoutine
mainRoutine:
    jmp someSub
    ret

ENDMOD
END
 
user7659542
does not do the trick
 
user7659542
this gives a horrible error...
 
@traducerad you can put multiple things in the same module
just not the same symbol twice
so if you put mock1 and mock1 in the module mock (single declaration of the MODULE directive) it should work insofar as they have individual segment directives
 
user7659542
@Mgetz OK I think I need to play around a bit to have a better understanding of all of this...
 

« first day (1620 days earlier)      last day (1233 days later) »