Shop OBEX P1 Docs P2 Docs Learn Events
Pnut size limits? — Parallax Forums

Pnut size limits?

Is there a limit to the size a program or group of programs can be in Pnut even if the program doesn't exceed cog memory?

I have 2 ASM programs: Blink, and Move6 . Both functions have an "org 0" directive at the start. The initialization code does as well.


the initialization code "fits" in 4 longs.
Blink is a small program that "fits" in 14 longs and runs in cog 3
Move6 "fits" in 264 longs and runs in cog 2


everything together with the variables at the end of the program "Fits" in 356 longs.
However, if I try to add even a single new instruction, into ANY of these 3 functions, something "Breaks" and the code doesn't work any more.

Even a 'nop' anywhere causes it to fail.


Is there something I haven't done to/for Pnut? Am I at a limit? Is there another assembler that others are using that doesn't have these limits?

KB

Comments

  • evanhevanh Posts: 15,915
    edited 2019-01-11 21:46
    Use an ORGH $400 (once) before the ORG 0 of the other cog programs.

    What is happening is, because everything is loaded to hubRAM first and has to be copied/COGINIT'd to cogs, and hub addresses are byte scale, there is only room for 1 KB of code and data to be fitted before the $400 boundary.

  • Thanks evanh,

    That gives me better idea of how the start-up works also. I'll give it a try.

  • HELP!!!

    Lol. no luck evanh, I tried every combination of orgh and org I could think of. NOTHING changes the problem.

    ( and changing the org or orgh to anything else breaks it as well ) I got rid of most of my program and replaced it with NOPs just in case something I was doing in my code was the problem. It breaks just the same. Once you get to a combined total of about 270 longs in the compile, it breaks.

    Attached is my test code filled with mostly NOP's it works fine as is on the P2-EV board. ( it blinks some LEDs )

    Take out a few nops, and there is no problem at all. Add even one more and it breaks.

    I repeat my early question... am I up against some "Hard" limit? Is it a problem with my chip only?

    I can't do anything more until I know how to get around this problem.

    KB
  • RaymanRayman Posts: 14,646
    edited 2019-01-12 17:22
    I see two coginits and then some data...
    That won’t work. Need to either kill cog zero or put in infinite loop after the coginits
    Otherwise it executed data which is bad
  • Thanks Rayman!

    It works that way!

    I went through several of Chips example programs but couldn't find an example that showed WHERE the cogstop for the start-up cog went.

    I thought the addresses for the cogs had to be loaded into cog 0's memory before the startup cog was terminated. I guess I'm confusing cog operation with compiler operation.

    Not having much information about how Pnut works is kicking my tail. ( but them's the breaks of Navel Air. ... and early adopters of new processors)


    Whatever, I greatly appreciate the help. I'm back to adding code again.

    KB



  • RaymanRayman Posts: 14,646
    Glad it worked.
    What I do usually is launch my list of cogs and launch the one for cog #0 last.
    That way, it bootstraps itself and don't have to deal with killing or stalling cog #0...
Sign In or Register to comment.