Page 1 of 1

FLOWCODE ARM

Posted: Sun Mar 02, 2014 9:06 am
by Sergiv
I bought on the development board AT91SAM7S256, Decided LED blinked.

Actually, that's a piece of circuit evaluation board (ports with LEDs)

Image

here's a program written in flowcode

Image

compiling reports:

Code: Select all

Target folder: D:\test
Source name:   D:\test\test.fcfx
Title:         
Description:   
Device:        ARM.AT91SAM7S.AT91SAM7S256
Generated by:  Flowcode v6.0.1.0
Date:          Saturday, March 01, 2014 13:24:55
Users:         0
Registered to: 54177102
Licence key:   PN3MUR
   NOT FOR COMMERCIAL USE
http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files (x86)\Flowcode 6\compilers\arm\batchfiles\arm7comp.bat  "test" "D:\test\"
Launching compiler...

Compilation successful!
Completed compilation, return = 0

Launching the linker/assembler...
C:\Program Files (x86)\Flowcode 6\compilers\arm\batchfiles\arm7link.bat  "test" at91sam7s256

D:\test>arm-elf-gcc -mcpu=arm7tdmi -O2 -Wall "C:\PROGRA~2\FLOWCO~1\COMPIL~1\arm\BATCHF~1\..\Global\Cstartup.o"  "test".o -lm -aln="test".lst --output "test".elf -nostartfiles  -T"C:\PROGRA~2\FLOWCO~1\COMPIL~1\arm\BATCHF~1\..\Global\at91sam7s256-ROM.ld" -L"C:\PROGRA~2\FLOWCO~1\COMPIL~1\arm\BATCHF~1\..\arm-elf\lib" -L"C:\PROGRA~2\FLOWCO~1\COMPIL~1\arm\BATCHF~1\..\lib\gcc\arm-elf\4.0.1" 

D:\test>arm-elf-objcopy -O ihex "test".elf "test".hex 

D:\test>arm-elf-objcopy -Osrec --srec-forceS3 "test".elf "test".s19 

s19 file creation successful!

D:\test>hex2bin "test".hex 
hex2bin v1.0.1, Copyright (C) 1999 Jacques Pelletier
Lowest address = 00002000
Highest address = 000059FF

BIN file creation successful!

D:\test>arm-elf-readelf -s "test".elf  1>"test".fkt 

ICD file creation successful!


FINISHED

compiled C code:

Code: Select all

//************************************************************************************
//**  
//**  Source name:   D:\test\test.fcfx
//**  Title:         
//**  Description:   
//**  Device:        ARM.AT91SAM7S.AT91SAM7S256
//**  
//**  Generated by:  Flowcode v6.0.1.0
//**  Date:          Saturday, March 01, 2014 13:24:55
//**  Users:         0
//**  Registered to: 54177102
//**  Licence key:   PN3MUR
//**  
//**  
//**     NOT FOR COMMERCIAL USE
//**  
//**  http://www.matrixmultimedia.com
//**  
//************************************************************************************

#define MX_ARM

#define MX_CAL_ARM

#define MX_CLK_SPEED 47923200

//Configuration Start
//Configuration End

#define MCK MX_CLK_SPEED
#define MCKKHz (MCK/1000)
#define MCKMHz ((MCKKHz+500)/1000)

#include <Cstartup_SAM7_FCV4.c>
#include <Board_EB031.h>
#include <arm7io.c>
#include <MX_interrupts.h>
#include <stdlib.h>
#include <OSstubs.c>
int errno;
/*========================================================================*\
   Use :Include the type definitions
\*========================================================================*/
#include "C:\Program Files (x86)\Flowcode 6\CAL\internals.c"
/*========================================================================*\
   Use :panel
       :Variable declarations
       :Macro function declarations
\*========================================================================*/
#define FCV_FALSE (0)
#define FCV_TRUE (1)
MX_GLOBAL MX_BOOL FCV_A;
/*========================================================================*\
   Use :Include the chip adaption layer
\*========================================================================*/
#include "C:\Program Files (x86)\Flowcode 6\CAL\includes.c"
/*========================================================================*\
   Use :panel
       :Macro implementations
\*========================================================================*/
/*========================================================================*\
   Use :Main
\*========================================================================*/
int main()
{

AT91F_PIO_CfgInput(AT91C_BASE_PIOA, 0xffffffff);
   AT91C_BASE_PIOA->PIO_IFER = 0xffffffff;
   AT91C_BASE_PIOA->PIO_PPUDR = 0xffffffff;
   AT91C_BASE_TCB->TCB_BMR = 0;

InterruptCfg();
   // Loop
   // Loop: While 1
   while (1)
   {
      // Output
      // Output: true -> D0
      FCP_SET_BIT(D, 0x01, 0xFE, 0, (FCV_TRUE));
      // Delay
      // Delay: 500 ms
      FCI_DELAYINT_MS(500);

      // Output
      // Output: false -> D0
      FCP_SET_BIT(D, 0x01, 0xFE, 0, (FCV_FALSE));
   }

   mainendloop: goto mainendloop;
}

/*========================================================================*\
   Use :Interrupt
\*========================================================================*/
void FC_Interrupt(unsigned int, unsigned int);
void FC_Interrupt(unsigned int periphID, unsigned int IFlags)
{

}
Firmware to load the HEX using the programmer via JTAG. In general, after all manipulations LED does not blink. Tell me, please, what am I doing wrong?

Re: FLOWCODE ARM

Posted: Sun Mar 02, 2014 11:58 am
by medelec35
Hi Sergiv,
One issue I can spot with your flowchart is you're missing a delay after Output: false -> D0.
You should have:
LED Flash1.png
(5.04 KiB) Downloaded 7423 times
Whats happening is LED will stay on for 500ms, switch off for a few nano seconds then back on for 500ms
So the LED will look like is on all the time.
Is that's whats happening since you stated LED does not blink, But you did not say if LED stays on or off?

Martin

Re: FLOWCODE ARM

Posted: Sun Mar 02, 2014 7:28 pm
by Sergiv
Thanks for your help, Martin!
LED is off. I tried to port fed only "true", but it did not help. LED does not light.
I changed the program on your screenshot, but still does not work. Perhaps I am wrong somehow sews.
Please look at the screens where I sews chip. Maybe you can tell me what I mistake. Thanks again for your help!

Я выбираю хекс файл, подключаю чип. Answer to this question is "yes." Thereafter, the chip is flashed. If you click "no", then the chip is not stitched.
Image

Message about the successful programming of the chip, but flashing does not work.
Image

В чём ещё может быть проблема ?

Re: FLOWCODE ARM

Posted: Sun Mar 02, 2014 7:29 pm
by Sergiv
What else could be the problem?

Although, I tried to download the firmware obviously working through SEGGER - everything works, the LEDs flash.
So, the problem in FlowCode. Just what the problem - I do not know.

Re: FLOWCODE ARM

Posted: Wed Mar 05, 2014 5:20 am
by Sergiv
Can anybody help me with this problem?

Re: FLOWCODE ARM

Posted: Wed Mar 05, 2014 11:28 am
by Benj
Hello,

Looking at the mapping file for the Generic style board RD0 maps to pin PA24 so the FCD pin out looks to be slightly incorrect as it references pin PA17.

Here is the mapping file.

Code: Select all

#define PORTA0 		( 1<<0 )
#define PORTA1			( 1<<1 )
#define PORTA2			( 1<<2 )
#define PORTA3			( 1<<3 )
#define PORTA4			( 1<<4 )
#define PORTA5			( 1<<5 )
#define PORTA6			( 1<<6 )
#define PORTA7			( 1<<7 )

#define PORTA (PORTA0|PORTA1|PORTA2|PORTA3|PORTA4|PORTA5|PORTA6|PORTA7)

#define PORTB0			( 1<<8 )
#define PORTB1			( 1<<9 )
#define PORTB2			( 1<<10 )
#define PORTB3			( 1<<11 )
#define PORTB4			( 1<<12 )
#define PORTB5			( 1<<13 )
#define PORTB6			( 1<<14 )
#define PORTB7			( 1<<15 )

#define PORTB (PORTB0|PORTB1|PORTB2|PORTB3|PORTB4|PORTB5|PORTB6|PORTB7)

#define PORTC0			( 1<<16 )
#define PORTC1			( 1<<17 )
#define PORTC2			( 1<<18 )
#define PORTC3			( 1<<19 )
#define PORTC4			( 1<<20 )
#define PORTC5			( 1<<21 )
#define PORTC6			( 1<<22 )
#define PORTC7			( 1<<23 )

#define PORTC (PORTC0|PORTC1|PORTC2|PORTC3|PORTC4|PORTC5|PORTC6|PORTC7)

#define PORTD0			( 1<<24 )
#define PORTD1			( 1<<25 )
#define PORTD2			( 1<<26 )
#define PORTD3			( 1<<27 )
#define PORTD4			( 1<<28 )
#define PORTD5			( 1<<29 )
#define PORTD6			( 1<<30 )
#define PORTD7			( 1<<31 )

#define PORTD (PORTD0|PORTD1|PORTD2|PORTD3|PORTD4|PORTD5|PORTD6|PORTD7)
Is there anything happening on pin PA24?

Re: FLOWCODE ARM

Posted: Wed Mar 05, 2014 11:43 am
by Benj
Looking again at the C file you posted it mentions the Board_EB031 not the Board_Generic.

On the EB031 pin D0 is connected to pin PA17 so this should be correct for you.

Re: FLOWCODE ARM

Posted: Wed Mar 05, 2014 11:46 am
by Benj
Also just noticed you are running Flowcode version 6.0.1.

If you goto Help -> Check for updates then you will get 6.0.4 which I have checked is referring to the correct board layout file.

Re: FLOWCODE ARM

Posted: Wed Mar 05, 2014 8:29 pm
by Sergiv
Benj, thank you very much for your help in getting acquainted with flowcode.
I installed the patch 6.0.4 as you advised. But still I do not blink LEDs.
1.png
(143.91 KiB) Downloaded 2904 times
Port P24 I can not see because it is used in the circuit and is not separately displayed.
This datasheet on SAM7-P256:
SAM7-Pxxx.pdf
(2.25 MiB) Downloaded 288 times
Could you give a working example of flashing LED?

Thanks for the help!

Re: FLOWCODE ARM

Posted: Sat Mar 08, 2014 8:32 pm
by Sergiv
help me, please :cry:

Re: FLOWCODE ARM

Posted: Tue Mar 11, 2014 5:23 am
by Sergiv
Hello. Using FlowCode can program the controller or not? Does anyone do that? Sad that bought development board, and nothing can be done.

Re: FLOWCODE ARM

Posted: Tue Mar 11, 2014 11:25 am
by Benj
Hello,

Just checking but are the LED jumpers in place on the board. To light the LEDs you pull the pin low and this allows the current to flow. Your program is toggling high and low so it should work with the jumper in place.

Can you use the Build -> View C menu and send me the includes from the top of your file. Should look something like this.

Code: Select all

#define MX_ARM
#define MX_CAL_ARM
#define MX_CLK_SPEED 47923200
#define FCP_NULL Unconnected_Port
#define MCK MX_CLK_SPEED
#define MCKKHz (MCK/1000)
#define MCKMHz ((MCKKHz+500)/1000)
#include <Cstartup_SAM7_FCV4.c>
#include <Board_Generic.h>
#include <arm7io.c>
#include <MX_interrupts.h>
#include <stdlib.h>
#include <OSstubs.c>

Re: FLOWCODE ARM

Posted: Tue Mar 11, 2014 7:06 pm
by Sergiv
Thank you for your help. Last hope for you :)
Yes, the jumpers stands.
Here's the code:

Code: Select all

//************************************************************************************
//**  
//**  Source name:   D:\test\test.fcfx
//**  Title:         
//**  Description:   
//**  Device:        ARM.AT91SAM7S.AT91SAM7S256
//**  
//**  Generated by:  Flowcode v6.0.4.0
//**  Date:          Tuesday, March 11, 2014 22:07:08
//**  Users:         0
//**  Registered to: 54177102
//**  Licence key:   PN3MUR
//**  
//**  
//**     NOT FOR COMMERCIAL USE
//**  
//**  http://www.matrixmultimedia.com
//**  
//************************************************************************************


#define MX_ARM
#define MX_CAL_ARM
#define MX_CLK_SPEED 47923200


//Configuration Start
//Configuration End

#define MCK MX_CLK_SPEED
#define MCKKHz (MCK/1000)
#define MCKMHz ((MCKKHz+500)/1000)

#include <Cstartup_SAM7_FCV4.c>
#include <Board_Generic.h>
#include <arm7io.c>
#include <MX_interrupts.h>
#include <stdlib.h>
#include <OSstubs.c>

int errno;

/*========================================================================*\
   Use :Include the type definitions
\*========================================================================*/
#include "C:\Program Files (x86)\Flowcode 6\CAL\internals.c"



/*========================================================================*\
   Use :panel
       :Variable declarations
       :Macro function declarations
\*========================================================================*/
#define FCV_FALSE (0)
#define FCV_TRUE (1)


/*========================================================================*\
   Use :Include the chip adaption layer
\*========================================================================*/
#include "C:\Program Files (x86)\Flowcode 6\CAL\includes.c"


/*========================================================================*\
   Use :panel
       :Macro implementations
\*========================================================================*/


/*========================================================================*\
   Use :Main
\*========================================================================*/
int main()
{
AT91F_PIO_CfgInput(AT91C_BASE_PIOA, 0xffffffff);
    AT91C_BASE_PIOA->PIO_IFER = 0xffffffff;
    AT91C_BASE_PIOA->PIO_PPUDR = 0xffffffff;
    AT91C_BASE_TCB->TCB_BMR = 0;

InterruptCfg();

    // Loop
    // Loop: While 1
    while (1)
    {

        // Output
        // Output: true -> D0
        FCP_SET(B, D, 0x01, 0, (FCV_TRUE));
        // Delay
        // Delay: 500 ms
        FCI_DELAYBYTE_MS(500);

        // Output
        // Output: false -> D0
        FCP_SET(B, D, 0x01, 0, (FCV_FALSE));
        // Delay
        // Delay: 500 ms
        FCI_DELAYBYTE_MS(500);


    }

    mainendloop: goto mainendloop;
}



/*========================================================================*\
   Use :Interrupt
\*========================================================================*/
void FC_Interrupt(unsigned int, unsigned int);
void FC_Interrupt(unsigned int periphID, unsigned int IFlags)
{

}

Re: FLOWCODE ARM

Posted: Thu Mar 13, 2014 7:48 pm
by Sergiv
What possible reason that the program is not blinking LED?

Re: FLOWCODE ARM

Posted: Fri Mar 14, 2014 10:58 am
by Benj
Hello,

The code is designed to work with a bootloader which we provide but don't really document very well at the moment are you using the code directly on the device without the bootloader?

If your not using the bootloader then you can use this attached file to change the reallocation of Flash which will hopefully allow your program to run.
AT91SAM7S256-ROM.zip
(1.31 KiB) Downloaded 243 times
Extract the .ld file into your "Flowcode 6\compilers\arm\Global" directory and then re-compile.

Let me know how you get on.

Re: FLOWCODE ARM

Posted: Fri Mar 14, 2014 7:29 pm
by Sergiv
Thanks for the answer!
Yes, I want to use the code directly on the device.
I did everything according to your instructions. I replaced AT91SAM7S256-ROM.dl from your archive, but the LED and did not blink! I was upset. Then I decided to compare the file that I had and you gave me. They are completely identical. So it should be?

Re: FLOWCODE ARM

Posted: Mon Mar 17, 2014 1:13 pm
by Benj
Hello,

I changed this line...
CODE (rx) : ORIGIN = 0x2000, LENGTH = 0x0003E000
To this...
CODE (rx) : ORIGIN = 0x100000, LENGTH = 0x0003E000
You could maybe also try this...
CODE (rx) : ORIGIN = 0x0, LENGTH = 0x0003E000
If you can't get it working then let me know and I will see if we still have a 256 device here I can dig out.

Re: FLOWCODE ARM

Posted: Mon Mar 17, 2014 8:10 pm
by Sergiv
Hi, Benj !!!

I tried all three options. With either LED flashes do not, unfortunately. What options are there to solve the problem yet?

Re: FLOWCODE ARM

Posted: Tue Mar 18, 2014 8:21 pm
by Sergiv
What else can be done? Or is useless?

Re: FLOWCODE ARM

Posted: Wed Mar 19, 2014 12:15 pm
by Benj
Hello Sergiv,

I noticed in the pictures you posted that it is saying the program does not fit into the selected sectors and is being shifted.

Does this also happen when you use firmware that came with the dev board or does this go in without issue?

Re: FLOWCODE ARM

Posted: Wed Mar 19, 2014 5:55 pm
by Sergiv
Firmware that works only gives this message.
1.JPG
1.JPG (90.01 KiB) Viewed 13344 times
Firmware in .*bin (by the way, I also tried to download and .*bin .*heh)

archive directly firmware and source code
SAM7-P256-blinking-LED.rar
(527.36 KiB) Downloaded 243 times

Re: FLOWCODE ARM

Posted: Fri Mar 21, 2014 11:06 am
by Thomas Thor
Dears,

I saw that sergiv's computer has Windows 8 OS. and 64 bit. I know that almost every Arm C compiler works only 32 bit OS.

Maybe this a reason for your code not working properly, am I right ?

Re: FLOWCODE ARM

Posted: Sat Mar 22, 2014 7:47 pm
by Sergiv
Thomas Thor, thanks for the tip!
Tomorrow, if I can, I will try to windows 7 32-bit.

Re: FLOWCODE ARM

Posted: Sun Mar 23, 2014 8:50 am
by Sergiv
Tried on windows 7 32-bit, still does not work ((((((

Re: FLOWCODE ARM

Posted: Tue Apr 01, 2014 5:18 am
by Sergiv
Hello! Will work with flowcode processor ARM? or better go to the AVR or PIC?